Migrated from xerces=2.x
[snark14.git] / src / DIGFile / DIGFile.cpp
index 486a762d3181cab609e4235caeada099788e799d..2531529ccaaf9fcc69b63778c61864389aea3cc5 100644 (file)
@@ -2363,12 +2363,15 @@ int DIGFile::WriteXMLHeader()
   ///DOMPrintFilter   *myFilter = 0;
 
   try {
-               // get a serializer, an instance of DOMWriter
+               // get a serializer, an instance of DOMWriter (kmr Now DOMLSSerializer)
                XMLCh tempStr[100];
                XMLString::transcode("LS", tempStr, 99);
                DOMImplementation *impl          = DOMImplementationRegistry::getDOMImplementation(tempStr);
-               DOMWriter         *theSerializer = ((DOMImplementationLS*)impl)->createDOMWriter();
-
+               DOMLSSerializer   *theSerializer = ((DOMImplementationLS*)impl)->createLSSerializer();
+                DOMConfiguration  *dc            = theSerializer->getDomConfig();
+                DOMLSOutput* theOutput = ((DOMImplementationLS*)impl)->createLSOutput();
+                theOutput->setByteStream(mymFormTarget);
+                
                // set user specified end of line sequence and output encoding
                //theSerializer->setNewLine(gMyEOLSequence);
 
@@ -2376,8 +2379,9 @@ int DIGFile::WriteXMLHeader()
 
     static XMLCh* gOutputEncoding = 0;
 
-               theSerializer->setEncoding(gOutputEncoding);
-
+    // kmr theSerializer->setEncoding(gOutputEncoding);
+    theOutput->setEncoding(gOutputEncoding);
+    
                // plug in user's own filter
     /*
                if(gUseFilter) {
@@ -2399,24 +2403,24 @@ int DIGFile::WriteXMLHeader()
 
                // plug in user's own error handler
                DOMErrorHandler* myErrorHandler = new DOMPrintErrorHandler();
-               theSerializer->setErrorHandler(myErrorHandler);
+               dc->setParameter(XMLUni::fgDOMErrorHandler,myErrorHandler);
 
                // set feature if the serializer supports the feature/mode
     
     static bool gSplitCdataSections = true;
 
-               if(theSerializer->canSetFeature(XMLUni::fgDOMWRTSplitCdataSections, gSplitCdataSections))
-                       theSerializer->setFeature(XMLUni::fgDOMWRTSplitCdataSections, gSplitCdataSections);
+               if(dc->canSetParameter(XMLUni::fgDOMWRTSplitCdataSections, gSplitCdataSections))
+                       dc->setParameter(XMLUni::fgDOMWRTSplitCdataSections, gSplitCdataSections);
 
     static bool gDiscardDefaultContent = true;
                
-               if(theSerializer->canSetFeature(XMLUni::fgDOMWRTDiscardDefaultContent, gDiscardDefaultContent))
-                       theSerializer->setFeature(XMLUni::fgDOMWRTDiscardDefaultContent, gDiscardDefaultContent);
+               if(dc->canSetParameter(XMLUni::fgDOMWRTDiscardDefaultContent, gDiscardDefaultContent))
+                        dc->setParameter(XMLUni::fgDOMWRTDiscardDefaultContent, gDiscardDefaultContent);
 
     static bool gFormatPrettyPrint = true;
 
-               if(theSerializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, gFormatPrettyPrint))
-                       theSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, gFormatPrettyPrint);
+               if(dc->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint, gFormatPrettyPrint))
+                       dc->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, gFormatPrettyPrint);
 
     //
                // Plug in a format target to receive the resultant
@@ -2442,8 +2446,9 @@ int DIGFile::WriteXMLHeader()
 
     //((LocalFileFormatTarget*) myfFormTarget)->Target.setEscapeFlags();
 
-               theSerializer->writeNode(mymFormTarget, *Document);
-
+                //kmr          theSerializer->writeNode(mymFormTarget, *Document);
+                theSerializer->write(Document, theOutput);
+                delete theOutput;
                delete theSerializer;
 
     //