1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.opensaml.xml;
19
20 import java.util.Map.Entry;
21
22 import javax.xml.namespace.QName;
23
24 import org.opensaml.xml.io.MarshallingException;
25 import org.opensaml.xml.util.XMLHelper;
26 import org.w3c.dom.Attr;
27 import org.w3c.dom.Document;
28 import org.w3c.dom.Element;
29
30
31
32
33
34 public class AbstractExtensibleXMLObjectMarshaller extends AbstractElementExtensibleXMLObjectMarshaller {
35
36
37
38
39
40
41
42
43
44
45
46 public AbstractExtensibleXMLObjectMarshaller(String targetNamespaceURI, String targetLocalName) {
47 super(targetNamespaceURI, targetLocalName);
48 }
49
50
51
52
53
54
55 protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
56 AttributeExtensibleXMLObject anyAttribute = (AttributeExtensibleXMLObject) xmlObject;
57 Attr attribute;
58 Document document = domElement.getOwnerDocument();
59 for (Entry<QName, String> entry : anyAttribute.getUnknownAttributes().entrySet()) {
60 attribute = XMLHelper.constructAttribute(document, entry.getKey());
61 attribute.setValue(entry.getValue());
62 domElement.setAttributeNodeNS(attribute);
63 if (Configuration.isIDAttribute(entry.getKey())
64 || anyAttribute.getUnknownAttributes().isIDAttribute(entry.getKey())) {
65 attribute.getOwnerElement().setIdAttributeNode(attribute, true);
66 }
67 }
68 }
69
70 }