1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.opensaml.xacml.ctx.impl;
18
19 import javax.xml.namespace.QName;
20
21 import org.opensaml.xacml.ctx.ResourceContentType;
22 import org.opensaml.xml.XMLObject;
23 import org.opensaml.xml.io.AbstractXMLObjectUnmarshaller;
24 import org.opensaml.xml.io.UnmarshallingException;
25 import org.opensaml.xml.util.DatatypeHelper;
26 import org.opensaml.xml.util.XMLHelper;
27 import org.w3c.dom.Attr;
28
29
30 public class ResourceContentTypeUnmarshaller extends AbstractXMLObjectUnmarshaller {
31
32
33 public ResourceContentTypeUnmarshaller() {
34 super();
35 }
36
37
38
39
40
41
42
43
44
45 protected ResourceContentTypeUnmarshaller(String targetNamespaceURI, String targetLocalName) {
46 super(targetNamespaceURI, targetLocalName);
47 }
48
49
50 protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
51 ResourceContentType resourceContent = (ResourceContentType) xmlObject;
52
53 QName attribQName = XMLHelper.getNodeQName(attribute);
54 if (attribute.isId()) {
55 resourceContent.getUnknownAttributes().registerID(attribQName);
56 }
57 resourceContent.getUnknownAttributes().put(attribQName, attribute.getValue());
58 }
59
60
61 protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject)
62 throws UnmarshallingException {
63 ResourceContentType resourceContent = (ResourceContentType) parentXMLObject;
64 resourceContent.getUnknownXMLObjects().add(childXMLObject);
65 }
66
67
68 protected void processElementContent(XMLObject xmlObject, String elementContent) {
69 ResourceContentType resourceContent = (ResourceContentType) xmlObject;
70 resourceContent.setValue(DatatypeHelper.safeTrimOrNullString(elementContent));
71 }
72 }