Add xsi:nil support to objects.
[shibboleth/xmltooling.git] / xmltooling / XMLObjectBuilder.h
index 25fcbb7..80fa690 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2006 Internet2
+ *  Copyright 2001-2007 Internet2
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  */
 
 /**
- * @file XMLObjectBuilder.h
+ * @file xmltooling/XMLObjectBuilder.h
  * 
- * Factory interface for XMLObjects 
+ * Factory interface for XMLObjects.
  */
 
-#if !defined(__xmltooling_xmlobjbuilder_h__)
+#ifndef __xmltooling_xmlobjbuilder_h__
 #define __xmltooling_xmlobjbuilder_h__
 
 #include <map>
@@ -47,7 +47,7 @@ namespace xmltooling {
         
         /**
          * Creates an empty XMLObject with a particular element name.
-         * The results are undefined if localName is NULL or empty.
+         * <p>The results are undefined if localName is NULL or empty.
          * 
          * @param nsURI         namespace URI for element
          * @param localName     local name of element
@@ -76,7 +76,7 @@ namespace xmltooling {
          * @param bindDocument  true iff the XMLObject should take ownership of the DOM Document
          * @return the unmarshalled XMLObject
          */
-        XMLObject* buildFromElement(DOMElement* element, bool bindDocument=false) const {
+        XMLObject* buildFromElement(xercesc::DOMElement* element, bool bindDocument=false) const {
             std::auto_ptr<XMLObject> ret(
                 buildObject(element->getNamespaceURI(),element->getLocalName(),element->getPrefix(),XMLHelper::getXSIType(element))
                 );
@@ -91,32 +91,18 @@ namespace xmltooling {
          * @param bindDocument  true iff the XMLObject should take ownership of the DOM Document
          * @return the unmarshalled XMLObject
          */
-        XMLObject* buildFromDocument(DOMDocument* doc, bool bindDocument=true) const {
+        XMLObject* buildFromDocument(xercesc::DOMDocument* doc, bool bindDocument=true) const {
             return buildFromElement(doc->getDocumentElement(),bindDocument);
         }
 
         /**
-         * Creates an empty XMLObject using the default build method, if a builder can be found.
-         * 
-         * @param key   the element key used to locate a builder
-         * @return  the empty object or NULL if no builder is available 
-         */
-        static XMLObject* buildOne(const QName& key) {
-            const XMLObjectBuilder* b=getBuilder(key);
-            if (b)
-                return b->buildFromQName(key);
-            b=getDefaultBuilder();
-            return b ? b->buildFromQName(key) : NULL;
-        }
-
-        /**
          * Creates an unmarshalled XMLObject using the default build method, if a builder can be found.
          * 
          * @param element       the unmarshalling source
          * @param bindDocument  true iff the new XMLObject should take ownership of the DOM Document
          * @return  the unmarshalled object or NULL if no builder is available 
          */
-        static XMLObject* buildOneFromElement(DOMElement* element, bool bindDocument=false) {
+        static XMLObject* buildOneFromElement(xercesc::DOMElement* element, bool bindDocument=false) {
             const XMLObjectBuilder* b=getBuilder(element);
             return b ? b->buildFromElement(element,bindDocument) : NULL;
         }
@@ -139,7 +125,7 @@ namespace xmltooling {
          * @param element the element for which to locate a builder
          * @return the builder or NULL
          */
-        static const XMLObjectBuilder* getBuilder(const DOMElement* element);
+        static const XMLObjectBuilder* getBuilder(const xercesc::DOMElement* element);
 
         /**
          * Retrieves the default XMLObjectBuilder for DOM elements