Code example for Attr

Methods: getLocalName, getNamespaceURI, getOwnerElement, getPrefix, getValue

0
    /** {@inheritDoc} */ 
    protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
        AttributedDateTime dateTime = (AttributedDateTime) xmlObject;
         
        QName attrName =
            XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute.getPrefix());
        if (AttributedDateTime.WSU_ID_ATTR_NAME.equals(attrName)) {
            dateTime.setWSUId(attribute.getValue());
            attribute.getOwnerElement().setIdAttributeNode(attribute, true);
        } else { 
            XMLHelper.unmarshallToAttributeMap(dateTime.getUnknownAttributes(), attribute);
        } 
    } 
 
    /** {@inheritDoc} */ 
    protected void processElementContent(XMLObject xmlObject, String elementContent) {
        AttributedDateTime dateTime = (AttributedDateTime) xmlObject;
        if (!DatatypeHelper.isEmpty(elementContent)) {
            dateTime.setValue(elementContent);
        } 
    }