From e08781393afc0bd73e7335a36003b39ccc11122f Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Sun, 11 Feb 2018 19:52:13 -0700 Subject: [PATCH] Migrated from xerces=2.x --- Makefile | 9 +++++---- src/DIGFile/DIGFile.cpp | 33 +++++++++++++++++++-------------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index e0b36a6..6d96e10 100644 --- a/Makefile +++ b/Makefile @@ -28,10 +28,11 @@ SRC_CXX = $(foreach dir,src/snark,$(wildcard src/snark/*.cpp)) SRC_C = $(foreach dir,src/snark,$(wildcard src/snark/*.c)) OBJ_CXX = $(patsubst src/snark/%.cpp,build/%.o,$(SRC_CXX)) OBJ_C = $(patsubst src/snark/%.c,build/%.o,$(SRC_C)) -INCLUDES = -I./include -I$(XERCES)/include $(addprefix -I,$(DIGFILED),$(DIGFILESD),$(DIGFILERD)) -Iinclude/DIGFile -Iinclude/DIGFileSnark -Iinclude/DIGRand -I/usr/include +INCLUDES = -I./include $(addprefix -I,$(DIGFILED),$(DIGFILESD),$(DIGFILERD)) -Iinclude/DIGFile -Iinclude/DIGFileSnark -Iinclude/DIGRand -I/usr/include -LIBPATH = -L$(PREFIX)/lib -L$(XERCES)/lib -LIBS = $(LIBPATH) -lm -lxerces-c -lxerces-depdom -lDIGFile -lDIGFileSnark -lDIGRand +#LIBPATH = -L$(PREFIX)/lib -L$(XERCES)/lib +LIBPATH = -L$(PREFIX)/lib +LIBS = $(LIBPATH) -lm -lxerces-c -lDIGFile -lDIGFileSnark -lDIGRand SNARK14 = snark14 INPUT = snark14Input @@ -44,7 +45,7 @@ DISPLAY_INC = $(foreach dir,tools/Display,$(wildcard tools/Display/*.hpp)) all: $(OBJDIR) $(LIBSDIR) $(BINDIR) $(BINDIR)/$(SNARK14) $(BINDIR)/$(DISPLAY) $(BINDIR)/$(INPUT) $(BINDIR)/$(SNARK14): $(LDIGFILED) $(LDIGFILESD) $(LDIGFILERD) $(OBJ_C) $(OBJ_CXX) - $(LD) $(LIBS) $(LDFLAGS) -o bin/$(SNARK14) $(OBJ_C) $(OBJ_CXX) + $(LD) $(LIBPATH) $(LDFLAGS) $(OBJ_C) $(OBJ_CXX) $(LIBS) -o bin/$(SNARK14) $(BINDIR)/$(DISPLAY): $(DISPLAY_SRC) $(DISPLAY_INC) cd tools/Display ; make diff --git a/src/DIGFile/DIGFile.cpp b/src/DIGFile/DIGFile.cpp index 486a762..2531529 100644 --- a/src/DIGFile/DIGFile.cpp +++ b/src/DIGFile/DIGFile.cpp @@ -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; // -- 2.34.1