} // toString() /* **************************************************************************** * dump() **************************************************************************** */ /** * Returns obj as a formatted XML string. * @param sTab - The characters to prepend before each new line */ public String dump() { Document doc = new DocumentImpl(); Element elm = this.toDOM(doc); doc.appendChild(elm); return DOMUtils.toString(doc); } // dump()
} // reset() /* **************************************************************************** * fromDOM() **************************************************************************** */ /** * This method populates the obj from DOM. It does not keep a * copy of the DOM around. Whitespace information is lost in this process. */ public void fromDOM(Element oElem) { reset(); // get the id attribute if (oElem.hasAttributeNS(null, Tags.ATTR_ID_CAP)) { msXmlID = oElem.getAttributeNS(null, Tags.ATTR_ID_CAP); } if (oElem.hasAttributeNS(null, Tags.ATTR_ISSUEINSTANT)) { msIssueInstant = oElem.getAttributeNS(null, Tags.ATTR_ISSUEINSTANT); } for ( Node oChild = DOMUtils.getFirstChildElement(oElem); oChild != null; oChild = DOMUtils.getNextSiblingElement(oChild)) { if (oChild.getLocalName().equals(Tags.TAG_ISSUER)) { // only accept the first XRIAuthority if (moIssuer == null) { moIssuer = new NameID((Element) oChild); } } else if (oChild.getLocalName().equals(Tags.TAG_SIGNATURE)) { // only accept the first XRIAuthority if (moSignature == null) { try { Document oDoc = new DocumentImpl(); Element oChildCopy = (Element) oDoc.importNode(oChild, true); moSignature = new XMLSignature(oChildCopy, null); } catch (Exception oEx) { soLog.warn( "Caught exception while parsing Signature", oEx); } } } else if (oChild.getLocalName().equals(Tags.TAG_SUBJECT)) { // only accept the first XRIAuthority if (moSubject == null) { moSubject = new Subject((Element) oChild); } } else if (oChild.getLocalName().equals(Tags.TAG_CONDITIONS)) { // only accept the first XRIAuthority if (moConditions == null) { moConditions = new Conditions((Element) oChild); } } else if (oChild.getLocalName().equals(Tags.TAG_ATTRIBUTESTATEMENT)) { // only accept the first XRIAuthority if (moAttrStatement == null) { moAttrStatement = new AttributeStatement((Element) oChild); } } } } // fromDOM()