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 public AbstractExtensibleXMLObjectMarshaller(){
38 super();
39 }
40
41
42
43
44
45
46
47
48
49
50
51 public AbstractExtensibleXMLObjectMarshaller(String targetNamespaceURI, String targetLocalName) {
52 super(targetNamespaceURI, targetLocalName);
53 }
54
55
56
57
58
59
60 protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
61 AttributeExtensibleXMLObject anyAttribute = (AttributeExtensibleXMLObject) xmlObject;
62 Attr attribute;
63 Document document = domElement.getOwnerDocument();
64 for (Entry<QName, String> entry : anyAttribute.getUnknownAttributes().entrySet()) {
65 attribute = XMLHelper.constructAttribute(document, entry.getKey());
66 attribute.setValue(entry.getValue());
67 domElement.setAttributeNodeNS(attribute);
68 if (Configuration.isIDAttribute(entry.getKey())
69 || anyAttribute.getUnknownAttributes().isIDAttribute(entry.getKey())) {
70 attribute.getOwnerElement().setIdAttributeNode(attribute, true);
71 }
72 }
73 }
74
75 }