[java-opensaml COMMIT] in /trunk/opensaml-core/src/main/java/org/opensaml/core/xml/io: AbstractXMLObjectMarshaller.ja...

noreply at shibboleth.net noreply at shibboleth.net
Fri Jun 8 21:39:39 BST 2012


Author: putmanb
Date: Fri Jun  8 21:39:38 2012
New Revision: 3064

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3064&view=rev
Log:
Change abstract class helper methods to use exiting support class calls, for consistency with other usage.

Modified:
    trunk/opensaml-core/src/main/java/org/opensaml/core/xml/io/AbstractXMLObjectMarshaller.java
    trunk/opensaml-core/src/main/java/org/opensaml/core/xml/io/AbstractXMLObjectUnmarshaller.java

Modified: trunk/opensaml-core/src/main/java/org/opensaml/core/xml/io/AbstractXMLObjectMarshaller.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-core/src/main/java/org/opensaml/core/xml/io/AbstractXMLObjectMarshaller.java?rev=3064&r1=3063&r2=3064&view=diff
==============================================================================
--- trunk/opensaml-core/src/main/java/org/opensaml/core/xml/io/AbstractXMLObjectMarshaller.java (original)
+++ trunk/opensaml-core/src/main/java/org/opensaml/core/xml/io/AbstractXMLObjectMarshaller.java Fri Jun  8 21:39:38 2012
@@ -36,6 +36,7 @@
 import org.opensaml.core.xml.Namespace;
 import org.opensaml.core.xml.XMLObject;
 import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
+import org.opensaml.core.xml.util.XMLObjectSupport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Attr;
@@ -489,17 +490,7 @@
      * @param domElement where to marshall them to.
      */
     protected void marshallUnknownAttributes(AttributeExtensibleXMLObject xmlObject, Element domElement) {
-        Attr attribute;
-        for (Entry<QName, String> entry : xmlObject.getUnknownAttributes().entrySet()) {
-            attribute = AttributeSupport.constructAttribute(domElement.getOwnerDocument(), entry.getKey());
-            attribute.setValue(entry.getValue());
-            domElement.setAttributeNodeNS(attribute);
-            if (XMLObjectProviderRegistrySupport.isIDAttribute(entry.getKey())
-                    || xmlObject.getUnknownAttributes().isIDAttribute(entry.getKey())) {
-                attribute.getOwnerElement().setIdAttributeNode(attribute, true);
-            }
-        }
-
+        XMLObjectSupport.marshallAttributeMap(xmlObject.getUnknownAttributes(), domElement);
     }
  
 }

Modified: trunk/opensaml-core/src/main/java/org/opensaml/core/xml/io/AbstractXMLObjectUnmarshaller.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-core/src/main/java/org/opensaml/core/xml/io/AbstractXMLObjectUnmarshaller.java?rev=3064&r1=3063&r2=3064&view=diff
==============================================================================
--- trunk/opensaml-core/src/main/java/org/opensaml/core/xml/io/AbstractXMLObjectUnmarshaller.java (original)
+++ trunk/opensaml-core/src/main/java/org/opensaml/core/xml/io/AbstractXMLObjectUnmarshaller.java Fri Jun  8 21:39:38 2012
@@ -31,6 +31,7 @@
 import org.opensaml.core.xml.XMLObjectBuilderFactory;
 import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
 import org.opensaml.core.xml.schema.XSBooleanValue;
+import org.opensaml.core.xml.util.XMLObjectSupport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Attr;
@@ -398,16 +399,15 @@
     }
     
     /**
-     * Called to store unrecognised attributes, if the object supports that.  It is expected that the
-     * objects marshaller will have checked and dealt with for known attributes before calling this. 
+     * Called to store wildcard attributes, if the object supports that.  It is expected that the
+     * object's unmarshaller will have checked and dealt with known attributes before calling this. 
      * @param xmlObject The object which support anyAttribute.
      * @param attribute The attribute in question.
      */
     protected void processUnknownAttribute(AttributeExtensibleXMLObject xmlObject, Attr attribute) {
-        QName attribQName = QNameSupport.getNodeQName(attribute);
-        if (attribute.isId()) {
-            xmlObject.getUnknownAttributes().registerID(attribQName);
-        }
-        xmlObject.getUnknownAttributes().put(attribQName, attribute.getValue());
+        // TODO Add support for validating whether attribute's namespace is consistent with the
+        // anyAttribute/@namespace.  Either via this method directly (new arguments) or in the 
+        // below support method.
+        XMLObjectSupport.unmarshallToAttributeMap(xmlObject.getUnknownAttributes(), attribute);
     }
 }



More information about the commits mailing list