} // 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(); msTag = oElem.getLocalName(); // get the id attribute if (oElem.hasAttributeNS(null, Tags.ATTR_NAMEQUALIFIER)) { msNQ = oElem.getAttributeNS(null, Tags.ATTR_NAMEQUALIFIER); } Node oChild = oElem.getFirstChild(); if ((oChild != null) && (oChild.getNodeType() == Node.TEXT_NODE)) { msValue = oChild.getNodeValue(); } } // fromDOM()
} // 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 notbefore attribute if (oElem.hasAttributeNS(null, Tags.ATTR_NOTBEFORE)) { String sVal = oElem.getAttributeNS(null, Tags.ATTR_NOTBEFORE); try { moNotBefore = DOMUtils.fromXMLDateTime(sVal); } catch (ParseException oEx) { soLog.warn("Caught exception on notBefore time", oEx); } } // get the notAfter attribute if (oElem.hasAttributeNS(null, Tags.ATTR_NOTONORAFTER)) { String sVal = oElem.getAttributeNS(null, Tags.ATTR_NOTONORAFTER); try { moNotAfter = DOMUtils.fromXMLDateTime(sVal); } catch (ParseException oEx) { soLog.warn("Caught exception on notAfter time", oEx); } } } // fromDOM()
} // 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()
} // reset() /* **************************************************************************** * fromDOM() **************************************************************************** */ /** * This method populates the XRD 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_NAME)) { msName = oElem.getAttributeNS(null, Tags.ATTR_NAME); } for ( Node oChild = DOMUtils.getFirstChildElement(oElem); oChild != null; oChild = DOMUtils.getNextSiblingElement(oChild)) { if (oChild.getLocalName().equals(Tags.TAG_ATTRIBUTEVALUE)) { // only accept the first element and make sure it // is a text node if ( (msValue.equals("")) && (oChild.getFirstChild() != null) && (oChild.getFirstChild().getNodeType() == Node.TEXT_NODE)) { msValue = oChild.getFirstChild().getNodeValue(); } } } } // fromDOM()