Blob Blame History Raw
diff -up ovaldi-5.9.1-src/src/probes/independent/XmlFileContentProbe.cpp.xerces ovaldi-5.9.1-src/src/probes/independent/XmlFileContentProbe.cpp
--- ovaldi-5.9.1-src/src/probes/independent/XmlFileContentProbe.cpp.xerces	2011-02-04 22:41:10.000000000 -0500
+++ ovaldi-5.9.1-src/src/probes/independent/XmlFileContentProbe.cpp	2011-05-11 09:55:31.705703243 -0400
@@ -419,12 +419,25 @@ BinInputStream* DummyEntityResolver::NoO
     return new DummyEntityResolver::DoNothingBinInputStream();
 }
 
+#if XERCES_VERSION_MAJOR < 3
 unsigned int DummyEntityResolver::DoNothingBinInputStream::curPos() const
+#else
+const XMLCh* DummyEntityResolver::DoNothingBinInputStream::getContentType() const
+{
+    return NULL;
+}
+
+XMLFilePos DummyEntityResolver::DoNothingBinInputStream::curPos() const
+#endif
 {
     return 0;
 }
 
+#if XERCES_VERSION_MAJOR < 3
 unsigned int DummyEntityResolver::DoNothingBinInputStream::readBytes(XMLByte *const /*toFill*/, const unsigned int /*maxToRead*/)
+#else
+XMLSize_t DummyEntityResolver::DoNothingBinInputStream::readBytes(XMLByte *const toFill, XMLSize_t maxToRead)
+#endif
 {
     return 0;
 }
diff -up ovaldi-5.9.1-src/src/probes/independent/XmlFileContentProbe.h.xerces ovaldi-5.9.1-src/src/probes/independent/XmlFileContentProbe.h
--- ovaldi-5.9.1-src/src/probes/independent/XmlFileContentProbe.h.xerces	2011-02-04 22:41:10.000000000 -0500
+++ ovaldi-5.9.1-src/src/probes/independent/XmlFileContentProbe.h	2011-05-11 09:46:13.496536017 -0400
@@ -134,8 +134,14 @@ private:
     class DoNothingBinInputStream : public BinInputStream
     {
     public:
+#if XERCES_VERSION_MAJOR < 3
         virtual unsigned int curPos() const;
         virtual unsigned int readBytes(XMLByte *const toFill, const unsigned int maxToRead);
+#else
+	virtual XMLFilePos curPos() const;
+	virtual const XMLCh* getContentType() const;
+        virtual XMLSize_t readBytes(XMLByte *const toFill, XMLSize_t maxToRead);
+#endif
     };
 };
 
diff -up ovaldi-5.9.1-src/src/XmlCommon.cpp.xerces ovaldi-5.9.1-src/src/XmlCommon.cpp
--- ovaldi-5.9.1-src/src/XmlCommon.cpp.xerces	2011-02-04 22:41:10.000000000 -0500
+++ ovaldi-5.9.1-src/src/XmlCommon.cpp	2011-05-11 09:46:13.494536041 -0400
@@ -587,7 +587,11 @@ void XmlCommon::AddSchemaLocation(XERCES
 string XmlCommon::GetNamespace(DOMElement *element) {
 
 	string xmlns = "";
+#if XERCES_VERSION_MAJOR < 3
 	xmlns = XmlCommon::ToString(element->getTypeInfo()->getNamespace());
+#else
+	xmlns = XmlCommon::ToString(element->getSchemaTypeInfo()->getTypeNamespace());
+#endif
 	if (xmlns.compare("") == 0) {
 		xmlns = "";
 	}
diff -up ovaldi-5.9.1-src/src/XmlProcessor.cpp.xerces ovaldi-5.9.1-src/src/XmlProcessor.cpp
--- ovaldi-5.9.1-src/src/XmlProcessor.cpp.xerces	2011-02-04 22:41:10.000000000 -0500
+++ ovaldi-5.9.1-src/src/XmlProcessor.cpp	2011-05-11 09:53:00.382555517 -0400
@@ -35,7 +35,18 @@ using namespace std;
 //			DataDirResolver Class                                   					  //	
 //****************************************************************************************//
 
+#if XERCES_VERSION_MAJOR < 3
 DOMInputSource* DataDirResolver::resolveEntity (const XMLCh *const /*publicId*/, const XMLCh *const systemId, const XMLCh *const /*baseURI*/) {
+#else
+InputSource* DataDirResolver::resolveEntity(const XMLCh* publicId, const XMLCh* systemId)
+{
+	return NULL;
+	//return DataDirResolver::resolveEntity (publicId, systemId, NULL);
+}
+
+DOMLSInput* DataDirResolver::resolveEntity (const XMLCh *const publicId, const XMLCh *const systemId, const XMLCh *const baseURI) {
+#endif
+
 	string path = "";
 	size_t last;
 	string schemapath = Common::GetSchemaPath();
@@ -111,21 +122,36 @@ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocume
     // Instantiate the DOM parser.
     static const XMLCh gLS[] = { chLatin_L, chLatin_S, chNull };
     DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(gLS);
+#if XERCES_VERSION_MAJOR < 3
     parser = ((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0);
+#else
+    parser = ((DOMImplementationLS*)impl)->createLSParser(DOMImplementationLS::MODE_SYNCHRONOUS, 0);
+#endif
 
 	///////////////////////////////////////////////////////
     //	Set fetuares on the builder
 	///////////////////////////////////////////////////////
 
+#if XERCES_VERSION_MAJOR < 3
+#define SetParameter(parser,n,v) parser->setFeature(n,v)
+#else
+#define SetParameter(parser,n,v) parser->getDomConfig()->setParameter(n,v)
+#endif
+
+	SetParameter(parser, XMLUni::fgDOMComments, false); // Discard Comment nodes in the document. 
+    SetParameter(parser, XMLUni::fgDOMDatatypeNormalization, true); // Let the validation process do its datatype normalization that is defined in the used schema language.  
+	SetParameter(parser, XMLUni::fgDOMNamespaces, true); //  Perform Namespace processing
+#if XERCES_VERSION_MAJOR < 3
+	SetParameter(parser, XMLUni::fgDOMValidation, true); // Report all validation errors.  
+#else
+	SetParameter(parser, XMLUni::fgDOMValidate, true); // Report all validation errors.  
+#endif
+	SetParameter(parser, XMLUni::fgXercesSchema, true); //  Enable the parser's schema support.
+	SetParameter(parser, XMLUni::fgXercesSchemaFullChecking, true); //  Enable full schema constraint checking, including checking which may be time-consuming or memory intensive. Currently, particle unique attribution constraint checking and particle derivation restriction checking are controlled by this option.  
+	SetParameter(parser, XMLUni::fgXercesValidationErrorAsFatal, true); //  The parser will treat validation error as fatal and will exit  
+	SetParameter(parser, XMLUni::fgXercesDOMHasPSVIInfo, true); // Enable storing of PSVI information in element and attribute nodes.
 
-	parser->setFeature(XMLUni::fgDOMComments, false); // Discard Comment nodes in the document. 
-    parser->setFeature(XMLUni::fgDOMDatatypeNormalization, true); // Let the validation process do its datatype normalization that is defined in the used schema language.  
-	parser->setFeature(XMLUni::fgDOMNamespaces, true); //  Perform Namespace processing
-	parser->setFeature(XMLUni::fgDOMValidation, true); // Report all validation errors.  
-	parser->setFeature(XMLUni::fgXercesSchema, true); //  Enable the parser's schema support.
-	parser->setFeature(XMLUni::fgXercesSchemaFullChecking, true); //  Enable full schema constraint checking, including checking which may be time-consuming or memory intensive. Currently, particle unique attribution constraint checking and particle derivation restriction checking are controlled by this option.  
-	parser->setFeature(XMLUni::fgXercesValidationErrorAsFatal, true); //  The parser will treat validation error as fatal and will exit  
-	parser->setFeature(XMLUni::fgXercesDOMHasPSVIInfo, true); // Enable storing of PSVI information in element and attribute nodes.
+#undef SetParameter
 
 	///////////////////////////////////////////////////////
 //****************************************************************************************//
@@ -133,7 +159,11 @@ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocume
 //****************************************************************************************//
 	/* Look for XML schemas in local directory instead of Internet */
 		DataDirResolver resolver;
+#if XERCES_VERSION_MAJOR < 3
 		parser->setEntityResolver (&resolver);
+#else
+		parser->getDomConfig()->setParameter(XMLUni::fgXercesEntityResolver, &resolver);
+#endif
 //****************************************************************************************//
 //			End of air-gap code															  //	
 //****************************************************************************************//
@@ -144,7 +174,11 @@ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocume
 	// Create a new DOMErrorHandler
 	// and set it to the builder
 	XmlProcessorErrorHandler *errHandler = new XmlProcessorErrorHandler();
+#if XERCES_VERSION_MAJOR < 3
 	parser->setErrorHandler(errHandler);
+#else
+	parser->getDomConfig()->setParameter(XMLUni::fgDOMErrorHandler, errHandler);
+#endif
 
     try  {
 		// reset document pool
@@ -215,23 +249,27 @@ void XmlProcessor::WriteDOMDocument(XERC
 		XMLCh tempStr[100];
 		XMLString::transcode("LS", tempStr, 99);
 		DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
+#if XERCES_VERSION_MAJOR < 3
 		DOMWriter *theSerializer = ((DOMImplementationLS*)impl)->createDOMWriter();
-
+#else
+		DOMLSSerializer *theSerializer = ((DOMImplementationLS*)impl)->createLSSerializer();
+#endif
+
+#if XERCES_VERSION_MAJOR < 3
+#define SetParameter(serializer,n,v) if (serializer->canSetFeature(n,v)) \
+	serializer->setFeature(n,v)
+#else
+#define SetParameter(serializer,n,v) if (serializer->getDomConfig()->canSetParameter(n,v)) \
+	serializer->getDomConfig()->setParameter(n,v)
+#endif
 		// set feature if the serializer supports the feature/mode
-		if (theSerializer->canSetFeature(XMLUni::fgDOMWRTSplitCdataSections, true))
-			theSerializer->setFeature(XMLUni::fgDOMWRTSplitCdataSections, true);
-
-		if (theSerializer->canSetFeature(XMLUni::fgDOMWRTDiscardDefaultContent, true))
-			theSerializer->setFeature(XMLUni::fgDOMWRTDiscardDefaultContent, true);
-
-		if (theSerializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true))
-			theSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
-
-		if (theSerializer->canSetFeature(XMLUni::fgDOMWRTBOM, false))
-			theSerializer->setFeature(XMLUni::fgDOMWRTBOM, false);
+		SetParameter(theSerializer, XMLUni::fgDOMWRTSplitCdataSections, true);
+		SetParameter(theSerializer, XMLUni::fgDOMWRTDiscardDefaultContent, true);
+		SetParameter(theSerializer, XMLUni::fgDOMWRTFormatPrettyPrint, true);
+		SetParameter(theSerializer, XMLUni::fgDOMWRTBOM, false);
+		//SetParameter(theSerializer, XMLUni::fgDOMWRTBOM, true);
 
-		//if (theSerializer->canSetFeature(XMLUni::fgDOMWRTDiscardDefaultContent, true))
-		//	theSerializer->setFeature(XMLUni::fgDOMWRTBOM, true);
+#undef SetParameter
 
 		//
 		// Plug in a format target to receive the resultant
@@ -249,7 +287,13 @@ void XmlProcessor::WriteDOMDocument(XERC
 		//
 		// do the serialization through DOMWriter::writeNode();
 		//
+#if XERCES_VERSION_MAJOR < 3
 		theSerializer->writeNode(myFormTarget, *doc);
+#else
+		DOMLSOutput *output = ((DOMImplementationLS*)impl)->createLSOutput();
+		output->setByteStream(myFormTarget);
+		theSerializer->write(doc, output);
+#endif
 
 		delete theSerializer;
 		delete myFormTarget;
diff -up ovaldi-5.9.1-src/src/XmlProcessor.h.xerces ovaldi-5.9.1-src/src/XmlProcessor.h
--- ovaldi-5.9.1-src/src/XmlProcessor.h.xerces	2011-02-04 22:41:10.000000000 -0500
+++ ovaldi-5.9.1-src/src/XmlProcessor.h	2011-05-11 09:46:13.495536029 -0400
@@ -39,8 +39,11 @@
 #include "Common.h" 
 
 //	required xerces	includes
-#include <xercesc/dom/DOMImplementationRegistry.hpp>
+#if XERCES_VERSION_MAJOR < 3
 #include <xercesc/dom/DOMBuilder.hpp>
+#else
+#endif
+#include <xercesc/dom/DOMImplementationRegistry.hpp>
 #include <xercesc/dom/DOMException.hpp>
 #include <xercesc/dom/DOMErrorHandler.hpp>
 #include <xercesc/dom/DOMError.hpp>
@@ -48,17 +51,26 @@
 #include <xercesc/dom/DOMNamedNodeMap.hpp>
 
 // for dom Writer
+#if XERCES_VERSION_MAJOR < 3
+#include <xercesc/dom/DOMWriter.hpp>
+#else
+#endif
 #include <xercesc/dom/DOMImplementation.hpp>
 #include <xercesc/dom/DOMImplementationLS.hpp>
-#include <xercesc/dom/DOMWriter.hpp>
 #include <xercesc/framework/StdOutFormatTarget.hpp>
 #include <xercesc/framework/LocalFileFormatTarget.hpp>
 #include <xercesc/parsers/XercesDOMParser.hpp>
 #include <xercesc/util/XMLUni.hpp>
 
 // for entity resolver
+#if XERCES_VERSION_MAJOR < 3
 #include <xercesc/dom/DOMEntityResolver.hpp>
 #include <xercesc/dom/DOMInputSource.hpp>
+#else
+#include <xercesc/sax/EntityResolver.hpp>
+#include <xercesc/sax/InputSource.hpp>
+#include <xercesc/sax2/SAX2XMLReader.hpp>
+#endif
 #include <xercesc/framework/LocalFileInputSource.hpp>
 #include <xercesc/framework/Wrapper4InputSource.hpp>
 
@@ -67,15 +79,24 @@ XERCES_CPP_NAMESPACE_USE
 
 
 /** 
-	This class extends the default DOMEntityResolver and implments the resolve entity method 
+	This class extends the default EntityResolver and implments the resolve entity method 
 	to support 
 */
+#if XERCES_VERSION_MAJOR < 3
 class DataDirResolver : public DOMEntityResolver {
+#else
+class DataDirResolver : public EntityResolver {
+#endif
 public:
 	/**
      *     
 	*/
+#if XERCES_VERSION_MAJOR < 3
 	DOMInputSource *resolveEntity (const XMLCh *const publicId, const XMLCh *const systemId, const XMLCh *const baseURI);
+#else
+	InputSource *resolveEntity (const XMLCh *const publicId, const XMLCh *const systemId);
+	DOMLSInput *resolveEntity (const XMLCh *const publicId, const XMLCh *const systemId, const XMLCh *const baseURI);
+#endif
 };
 
 /**
@@ -114,8 +135,13 @@ private:
 	XmlProcessor();
 
 	static XmlProcessor* instance;
-	
+
+#if XERCES_VERSION_MAJOR < 3	
 	DOMBuilder *parser;
+#else
+	//SAX2XMLReader *parser;
+	DOMLSParser *parser;
+#endif
 };
 
 /**