I am a beginner and started to use xerces-c-src_2_8_0 with C++ in VisualStudio
2005I have the following code which is supposed to read Test1.txt then dump it
to Test2.txtContent of Test1.txt is listed under the code.The problem is, when
I open output file "Test2.txt" using "notepad" I see all lines combined such as
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> [] [] <Items> [] <Item
a="1"> [] </Item> [] </Items> [] []
Am I doing somthing wrong? I wish to be able to split these into several lines
Thanks for your help
code----#include <xercesc/parsers/XercesDOMParser.hpp>#include
<xercesc/dom/DOM.hpp>#include <xercesc/sax/HandlerBase.hpp>#include
<xercesc/util/XMLString.hpp>#include <xercesc/util/PlatformUtils.hpp>#include
<xercesc/framework/LocalFileFormatTarget.hpp>XERCES_CPP_NAMESPACE_USEint
main(int argc, char *argv[]){ XMLPlatformUtils::Initialize(); XercesDOMParser*
parser= new XercesDOMParser(); parser->parse("Test1.txt"); DOMDocument*
MyDoc=parser->getDocument(); DOMImplementation *impl
=MyDoc->getImplementation(); DOMWriter *theSerializer =impl->createDOMWriter();
theSerializer->setNewLine(XMLString::transcode("\n\r") );
theSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
XMLFormatTarget *myFormTarget; myFormTarget = new
LocalFileFormatTarget("Test2.txt"); theSerializer->writeNode(myFormTarget,
*MyDoc); xercesc::XMLPlatformUtils::Terminate();}Input
(Test1.txt)-----------------<?xml version="1.0" encoding="UTF-8"
standalone="no" ?><Items> <Item a="1"> </Item
></Items>Output (Test2.txt)-----------------<?xml version="1.0"
>encoding="UTF-8" standalone="no" ?> [] [] <Items> [] <Item a="1"> [] </Item>
>[] </Items> [] []
_________________________________________________________________