[mapguide-commits] r5014 - in sandbox/rfc102/MgDev: Common/Foundation/System Common/MdfParser Server/src/Services/Feature

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Jul 9 09:52:50 EDT 2010


Author: rohitr
Date: 2010-07-09 13:52:50 +0000 (Fri, 09 Jul 2010)
New Revision: 5014

Modified:
   sandbox/rfc102/MgDev/Common/Foundation/System/XmlUtil.cpp
   sandbox/rfc102/MgDev/Common/MdfParser/SAX2Parser.h
   sandbox/rfc102/MgDev/Server/src/Services/Feature/FilterUtil.h
Log:
Changes for upgrade to xerces 3.1.0. Additional information in Ticket #1399


Modified: sandbox/rfc102/MgDev/Common/Foundation/System/XmlUtil.cpp
===================================================================
--- sandbox/rfc102/MgDev/Common/Foundation/System/XmlUtil.cpp	2010-07-08 22:24:16 UTC (rev 5013)
+++ sandbox/rfc102/MgDev/Common/Foundation/System/XmlUtil.cpp	2010-07-09 13:52:50 UTC (rev 5014)
@@ -731,8 +731,10 @@
 MgByte* MgXmlUtil::ToBytes()
 {
     Ptr<MgByte> bytes;
-    DOMWriter* theSerializer = NULL;
-    MemBufFormatTarget* memTarget = NULL;
+    DOMLSSerializer* theSerializer = NULL;
+    DOMLSOutput* theOutputDesc = NULL;
+    DOMConfiguration* theDC = NULL;
+    XMLFormatTarget* memTarget = NULL;
 
     MG_XML_TRY()
 
@@ -745,32 +747,40 @@
     DOMImplementation *impl  = DOMImplementationRegistry::getDOMImplementation(tempStr);
     CHECKNULL(impl, L"MgXmlUtil.ToBytes");
 
-    theSerializer = ((DOMImplementationLS*)impl)->createDOMWriter();
+    theSerializer = ((DOMImplementationLS*)impl)->createLSSerializer();
+    theOutputDesc = ((DOMImplementationLS*)impl)->createLSOutput();
     CHECKNULL(theSerializer, L"MgXmlUtil.ToBytes");
+    CHECKNULL(theOutputDesc, L"MgXmlUtil.ToBytes");
+    theDC = theSerializer->getDomConfig();
 
     // set user specified output encoding
     XMLCh encodeStr[100];
     XMLString::transcode("UTF-8", encodeStr, 99);
-    theSerializer->setEncoding(encodeStr);
+    theOutputDesc->setEncoding(encodeStr);
 
     // set feature if the serializer supports the feature/mode
-    if (theSerializer->canSetFeature(XMLUni::fgDOMWRTSplitCdataSections, gSplitCdataSections))
-        theSerializer->setFeature(XMLUni::fgDOMWRTSplitCdataSections, gSplitCdataSections);
+    if (theDC->canSetParameter(XMLUni::fgDOMWRTSplitCdataSections, gSplitCdataSections))
+        theDC->setParameter(XMLUni::fgDOMWRTSplitCdataSections, gSplitCdataSections);
 
-    if (theSerializer->canSetFeature(XMLUni::fgDOMWRTDiscardDefaultContent, gDiscardDefaultContent))
-        theSerializer->setFeature(XMLUni::fgDOMWRTDiscardDefaultContent, gDiscardDefaultContent);
+    if (theDC->canSetParameter(XMLUni::fgDOMWRTDiscardDefaultContent, gDiscardDefaultContent))
+      
+theDC->setParameter(XMLUni::fgDOMWRTDiscardDefaultContent,gDiscardDefaultContent);
 
-    if (theSerializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, gFormatPrettyPrint))
-        theSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, gFormatPrettyPrint);
+    if (theDC->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint, 
+gFormatPrettyPrint))
+        theDC->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, 
+gFormatPrettyPrint);
 
-    if (theSerializer->canSetFeature(XMLUni::fgDOMWRTBOM, gWriteBOM))
-        theSerializer->setFeature(XMLUni::fgDOMWRTBOM, gWriteBOM);
+    if (theDC->canSetParameter(XMLUni::fgDOMWRTBOM, gWriteBOM))
+        theDC->setParameter(XMLUni::fgDOMWRTBOM, gWriteBOM);
 
     memTarget = new MemBufFormatTarget();
-    theSerializer->writeNode(memTarget, *m_doc);
+    theOutputDesc->setByteStream(memTarget);
 
-    INT32 bytesLen = (INT32)memTarget->getLen();
-    BYTE_ARRAY_IN rawBytes = (BYTE_ARRAY_IN)(memTarget->getRawBuffer());
+    theSerializer->write(m_doc, theOutputDesc);
+
+    INT32 bytesLen = (INT32)((MemBufFormatTarget*)memTarget)->getLen();
+    BYTE_ARRAY_IN rawBytes = (BYTE_ARRAY_IN)((MemBufFormatTarget*)memTarget)->getRawBuffer();
     bytes->Append(rawBytes, bytesLen);
 
     MG_XML_CATCH(L"MgXmlUtil.ToBytes")

Modified: sandbox/rfc102/MgDev/Common/MdfParser/SAX2Parser.h
===================================================================
--- sandbox/rfc102/MgDev/Common/MdfParser/SAX2Parser.h	2010-07-08 22:24:16 UTC (rev 5013)
+++ sandbox/rfc102/MgDev/Common/MdfParser/SAX2Parser.h	2010-07-09 13:52:50 UTC (rev 5014)
@@ -40,6 +40,8 @@
 #include <xercesc/framework/XMLFormatter.hpp>
 #include <xercesc/util/XMLString.hpp>
 #include <xercesc/framework/MemBufInputSource.hpp>
+#include <xercesc/parsers/SAX2XMLReaderImpl.hpp>
+
 #pragma warning(pop)
 
 #include "IOUtil.h"

Modified: sandbox/rfc102/MgDev/Server/src/Services/Feature/FilterUtil.h
===================================================================
--- sandbox/rfc102/MgDev/Server/src/Services/Feature/FilterUtil.h	2010-07-08 22:24:16 UTC (rev 5013)
+++ sandbox/rfc102/MgDev/Server/src/Services/Feature/FilterUtil.h	2010-07-09 13:52:50 UTC (rev 5014)
@@ -21,11 +21,11 @@
 #include "ServerFeatureDllExport.h"
 
 //fwd declare
-namespace xercesc_2_7
+namespace xercesc_3_0
 {
     class DOMElement;
 }
-using namespace xercesc_2_7;
+using namespace xercesc_3_0;
 
 class MgCoordinateSystemTransform;
 



More information about the mapguide-commits mailing list