Multi-line svn commit, see body.
[shibboleth/cpp-xmltooling.git] / xmltoolingtest / XMLObjectBaseTestCase.h
index 85d42b1..d0b3b89 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2005 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.
@@ -35,6 +35,7 @@
 #endif
 
 using namespace xmltooling;
+using namespace xercesc;
 using namespace std;
 
 extern string data_path;
@@ -60,7 +61,7 @@ protected:
 #endif
         VectorOf(SimpleXMLObject) mine=getSimpleXMLObjects();
         for (vector<SimpleXMLObject*>::const_iterator i=src.m_simples.begin(); i!=src.m_simples.end(); i++) {
-            mine.push_back((*i) ? (*i)->clone() : NULL);
+            mine.push_back(dynamic_cast<SimpleXMLObject*>((*i)->clone()));
         }
     }
 
@@ -85,7 +86,7 @@ public:
         XMLString::release(&m_id);
     }
 
-    SimpleXMLObject* clone() const {
+    XMLObject* clone() const {
         auto_ptr<XMLObject> domClone(AbstractDOMCachingXMLObject::clone());
         SimpleXMLObject* ret=dynamic_cast<SimpleXMLObject*>(domClone.get());
         if (ret) {
@@ -122,14 +123,14 @@ public:
     }
 
 protected:
-    void marshallAttributes(DOMElement* domElement) const {
+    void marshallAttributes(xercesc::DOMElement* domElement) const {
         if(getId()) {
             domElement->setAttributeNS(NULL, SimpleXMLObject::ID_ATTRIB_NAME, getId());
             domElement->setIdAttributeNS(NULL, SimpleXMLObject::ID_ATTRIB_NAME);
         }
     }
 
-    void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+    void processChildElement(XMLObject* childXMLObject, const xercesc::DOMElement* root) {
         SimpleXMLObject* simple=dynamic_cast<SimpleXMLObject*>(childXMLObject);
         if (simple) {
             getSimpleXMLObjects().push_back(simple);
@@ -147,7 +148,7 @@ protected:
         throw UnmarshallingException("Unknown child element cannot be added to parent object.");
     }
 
-    void processAttribute(const DOMAttr* attribute) {
+    void processAttribute(const xercesc::DOMAttr* attribute) {
         if (XMLHelper::isNodeNamed(attribute, NULL, SimpleXMLObject::ID_ATTRIB_NAME))
             setId(attribute->getValue());
         else
@@ -165,22 +166,22 @@ private:
 class SimpleXMLObjectBuilder : public XMLObjectBuilder
 {
 public:
-    SimpleXMLObject* buildObject() const {
+    XMLObject* buildObject() const {
         return buildObject(SimpleXMLObject::NAMESPACE, SimpleXMLObject::LOCAL_NAME, SimpleXMLObject::NAMESPACE_PREFIX);
     }
 
-    SimpleXMLObject* buildObject(
+    XMLObject* buildObject(
         const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const QName* schemaType=NULL
         ) const {
         return new SimpleXMLObject(nsURI, localName, prefix, schemaType);
     }
 
-    static SimpleXMLObject* newSimpleXMLObject() {
+    static SimpleXMLObject* buildSimpleXMLObject() {
         const SimpleXMLObjectBuilder* b = dynamic_cast<const SimpleXMLObjectBuilder*>(
             XMLObjectBuilder::getBuilder(QName(SimpleXMLObject::NAMESPACE,SimpleXMLObject::LOCAL_NAME))
             );
         if (b)
-            return b->buildObject();
+            return dynamic_cast<SimpleXMLObject*>(b->buildObject());
         throw XMLObjectException("Unable to obtain typed builder for SimpleXMLObject.");
     }
 };