/** * Unmarshall a DOM Attr to an AttributeMap. * * @param attributeMap the target AttributeMap * @param attribute the target DOM Attr */ public static void unmarshallToAttributeMap(AttributeMap attributeMap, Attr attribute) { QName attribQName = XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute .getPrefix()); attributeMap.put(attribQName, attribute.getValue()); if (attribute.isId() || Configuration.isIDAttribute(attribQName)) { attributeMap.registerID(attribQName); } }
/** * Unmarshall a DOM Attr to an AttributeMap. * * @param attributeMap the target AttributeMap * @param attribute the target DOM Attr */ public static void unmarshallToAttributeMap(AttributeMap attributeMap, Attr attribute) { QName attribQName = XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute .getPrefix()); attributeMap.put(attribQName, attribute.getValue()); if (attribute.isId() || Configuration.isIDAttribute(attribQName)) { attributeMap.registerID(attribQName); } }
/** {@inheritDoc} */ protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException { AuthnContextDecl authnCtxDecl = (AuthnContextDecl) xmlObject; Attr attribute; for (Entry<QName, String> entry : authnCtxDecl.getUnknownAttributes().entrySet()) { attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey()); attribute.setValue(entry.getValue()); domElement.setAttributeNodeNS(attribute); if (Configuration.isIDAttribute(entry.getKey()) || authnCtxDecl.getUnknownAttributes().isIDAttribute(entry.getKey())) { attribute.getOwnerElement().setIdAttributeNode(attribute, true); } } }
/** {@inheritDoc} */ protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException { XSAny xsAny = (XSAny) xmlObject; Attr attribute; for (Entry<QName, String> entry : xsAny.getUnknownAttributes().entrySet()) { attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey()); attribute.setValue(entry.getValue()); domElement.setAttributeNodeNS(attribute); if (Configuration.isIDAttribute(entry.getKey()) || xsAny.getUnknownAttributes().isIDAttribute(entry.getKey())) { attribute.getOwnerElement().setIdAttributeNode(attribute, true); } } }
/** {@inheritDoc} */ protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException { Header header = (Header) xmlObject; Attr attribute; for (Entry<QName, String> entry : header.getUnknownAttributes().entrySet()) { attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey()); attribute.setValue(entry.getValue()); domElement.setAttributeNodeNS(attribute); if (Configuration.isIDAttribute(entry.getKey()) || header.getUnknownAttributes().isIDAttribute(entry.getKey())) { attribute.getOwnerElement().setIdAttributeNode(attribute, true); } } }
/** {@inheritDoc} */ protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException { Envelope envelope = (Envelope) xmlObject; Attr attribute; for (Entry<QName, String> entry : envelope.getUnknownAttributes().entrySet()) { attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey()); attribute.setValue(entry.getValue()); domElement.setAttributeNodeNS(attribute); if (Configuration.isIDAttribute(entry.getKey()) || envelope.getUnknownAttributes().isIDAttribute(entry.getKey())) { attribute.getOwnerElement().setIdAttributeNode(attribute, true); } } }
/** {@inheritDoc} */ protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException { Detail detail = (Detail) xmlObject; Attr attribute; for (Entry<QName, String> entry : detail.getUnknownAttributes().entrySet()) { attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey()); attribute.setValue(entry.getValue()); domElement.setAttributeNodeNS(attribute); if (Configuration.isIDAttribute(entry.getKey()) || detail.getUnknownAttributes().isIDAttribute(entry.getKey())) { attribute.getOwnerElement().setIdAttributeNode(attribute, true); } } }
/** {@inheritDoc} */ protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException { Body body = (Body) xmlObject; Attr attribute; for (Entry<QName, String> entry : body.getUnknownAttributes().entrySet()) { attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey()); attribute.setValue(entry.getValue()); domElement.setAttributeNodeNS(attribute); if (Configuration.isIDAttribute(entry.getKey()) || body.getUnknownAttributes().isIDAttribute(entry.getKey())) { attribute.getOwnerElement().setIdAttributeNode(attribute, true); } } }
/** {@inheritDoc} */ protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException { XSAny xsAny = (XSAny) xmlObject; Attr attribute; for (Entry<QName, String> entry : xsAny.getUnknownAttributes().entrySet()) { attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey()); attribute.setValue(entry.getValue()); domElement.setAttributeNodeNS(attribute); if (Configuration.isIDAttribute(entry.getKey()) || xsAny.getUnknownAttributes().isIDAttribute(entry.getKey())) { attribute.getOwnerElement().setIdAttributeNode(attribute, true); } } }
/** * Marshall the attributes represented by the indicated AttributeMap into the indicated DOM Element. * * @param attributeMap the AttributeMap * @param domElement the target Element */ public static void marshallAttributeMap(AttributeMap attributeMap, Element domElement) { Document document = domElement.getOwnerDocument(); Attr attribute = null; for (Entry<QName, String> entry : attributeMap.entrySet()) { attribute = XMLHelper.constructAttribute(document, entry.getKey()); attribute.setValue(entry.getValue()); domElement.setAttributeNodeNS(attribute); if (Configuration.isIDAttribute(entry.getKey()) || attributeMap.isIDAttribute(entry.getKey())) { domElement.setIdAttributeNode(attribute, true); } } }
/** * Marshall the attributes represented by the indicated AttributeMap into the indicated DOM Element. * * @param attributeMap the AttributeMap * @param domElement the target Element */ public static void marshallAttributeMap(AttributeMap attributeMap, Element domElement) { Document document = domElement.getOwnerDocument(); Attr attribute = null; for (Entry<QName, String> entry : attributeMap.entrySet()) { attribute = XMLHelper.constructAttribute(document, entry.getKey()); attribute.setValue(entry.getValue()); domElement.setAttributeNodeNS(attribute); if (Configuration.isIDAttribute(entry.getKey()) || attributeMap.isIDAttribute(entry.getKey())) { domElement.setIdAttributeNode(attribute, true); } } }
/** * {@inheritDoc} */ protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException { Organization org = (Organization) xmlObject; Attr attribute; for (Entry<QName, String> entry : org.getUnknownAttributes().entrySet()) { attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey()); attribute.setValue(entry.getValue()); domElement.setAttributeNodeNS(attribute); if (Configuration.isIDAttribute(entry.getKey()) || org.getUnknownAttributes().isIDAttribute(entry.getKey())) { attribute.getOwnerElement().setIdAttributeNode(attribute, true); } } } }
/** * Check whether the attribute's QName is registered in the global ID attribute registry. If it is, and the * specified attribute's DOM Level 3 Attr.isId() is false (due to lack of schema validation, for example), then * declare the attribute as an ID type in the DOM on the attribute's owning element. This is to handle cases where * the underlying DOM needs to accurately reflect an attribute's ID-ness, for example ID reference resolution within * the Apache XML Security library. * * @param attribute the DOM attribute to be checked */ protected void checkIDAttribute(Attr attribute) { QName attribName = XMLHelper.getNodeQName(attribute); if (Configuration.isIDAttribute(attribName) && !attribute.isId()) { attribute.getOwnerElement().setIdAttributeNode(attribute, true); } }
/** * Check whether the attribute's QName is registered in the global ID attribute registry. If it is, and the * specified attribute's DOM Level 3 Attr.isId() is false (due to lack of schema validation, for example), then * declare the attribute as an ID type in the DOM on the attribute's owning element. This is to handle cases where * the underlying DOM needs to accurately reflect an attribute's ID-ness, for example ID reference resolution within * the Apache XML Security library. * * @param attribute the DOM attribute to be checked */ protected void checkIDAttribute(Attr attribute) { QName attribName = XMLHelper.getNodeQName(attribute); if (Configuration.isIDAttribute(attribName) && !attribute.isId()) { attribute.getOwnerElement().setIdAttributeNode(attribute, true); } }
/** * Marshalls the <code>xs:anyAttribute</code> attributes. * * {@inheritDoc} */ protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException { AttributeExtensibleXMLObject anyAttribute = (AttributeExtensibleXMLObject) xmlObject; Attr attribute; Document document = domElement.getOwnerDocument(); for (Entry<QName, String> entry : anyAttribute.getUnknownAttributes().entrySet()) { attribute = XMLHelper.constructAttribute(document, entry.getKey()); attribute.setValue(entry.getValue()); domElement.setAttributeNodeNS(attribute); if (Configuration.isIDAttribute(entry.getKey()) || anyAttribute.getUnknownAttributes().isIDAttribute(entry.getKey())) { attribute.getOwnerElement().setIdAttributeNode(attribute, true); } } }
/** * Marshalls the <code>xs:anyAttribute</code> attributes. * * {@inheritDoc} */ protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException { AttributeExtensibleXMLObject anyAttribute = (AttributeExtensibleXMLObject) xmlObject; Attr attribute; Document document = domElement.getOwnerDocument(); for (Entry<QName, String> entry : anyAttribute.getUnknownAttributes().entrySet()) { attribute = XMLHelper.constructAttribute(document, entry.getKey()); attribute.setValue(entry.getValue()); domElement.setAttributeNodeNS(attribute); if (Configuration.isIDAttribute(entry.getKey()) || anyAttribute.getUnknownAttributes().isIDAttribute(entry.getKey())) { attribute.getOwnerElement().setIdAttributeNode(attribute, true); } } }
/** {@inheritDoc} */ protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException { ShibbolethMetadataKeyAuthority keyAuthority = (ShibbolethMetadataKeyAuthority) xmlObject; if (keyAuthority.getVerifyDepth() != null) { domElement.setAttributeNS(null, ShibbolethMetadataKeyAuthority.VERIFY_DEPTH_ATTRIB_NAME, keyAuthority.getVerifyDepth().toString()); } Attr attr; for(Entry<QName, String> entry: keyAuthority.getUnknownAttributes().entrySet()){ attr = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey()); attr.setValue(entry.getValue()); domElement.setAttributeNodeNS(attr); if (Configuration.isIDAttribute(entry.getKey()) || keyAuthority.getUnknownAttributes().isIDAttribute(entry.getKey())) { attr.getOwnerElement().setIdAttributeNode(attr, true); } } }
/** {@inheritDoc} */ protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException { ContactPerson person = (ContactPerson) samlObject; if (person.getType() != null) { domElement.setAttributeNS(null, ContactPerson.CONTACT_TYPE_ATTRIB_NAME, person.getType().toString()); } Attr attribute; for (Entry<QName, String> entry : person.getUnknownAttributes().entrySet()) { attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey()); attribute.setValue(entry.getValue()); domElement.setAttributeNodeNS(attribute); if (Configuration.isIDAttribute(entry.getKey()) || person.getUnknownAttributes().isIDAttribute(entry.getKey())) { attribute.getOwnerElement().setIdAttributeNode(attribute, true); } } } }
/** {@inheritDoc} */ public String remove(Object key) { String removedValue = attributes.remove(key); if (removedValue != null) { releaseDOM(); QName attributeName = (QName) key; if (isIDAttribute(attributeName) || Configuration.isIDAttribute(attributeName)) { attributeOwner.getIDIndex().deregisterIDMapping(removedValue); } attributeOwner.getNamespaceManager().deregisterAttributeName(attributeName); checkAndDeregisterQNameValue(attributeName, removedValue); } return removedValue; }
/** {@inheritDoc} */ public String remove(Object key) { String removedValue = attributes.remove(key); if (removedValue != null) { releaseDOM(); QName attributeName = (QName) key; if (isIDAttribute(attributeName) || Configuration.isIDAttribute(attributeName)) { attributeOwner.getIDIndex().deregisterIDMapping(removedValue); } attributeOwner.getNamespaceManager().deregisterAttributeName(attributeName); checkAndDeregisterQNameValue(attributeName, removedValue); } return removedValue; }