Thanks Dave for your answer. That seemed to help splitting the header "<?xml
version="1.0"....." and body "<Items ..." into two separate lines. However, the
body is still a one-line printout.Is there an easy way to be able to split the
body further to look more like a tree, preferably with appropriate tab
indent?My alternative is to iterate through the DOM tree and output the file
myself, but I am hoping that there is a magical command in xerces that I am not
aware of to do that.> Date: Mon, 22 Sep 2008 21:52:31 -0700> From: [EMAIL
PROTECTED]> To: [email protected]> Subject: Re: Prettyprint & newline
?> > Michel Morgan wrote:> > I am a beginner and started to use
xerces-c-src_2_8_0 with C++ in > > VisualStudio 2005> > I have the following
code which is supposed to read Test1.txt then dump > > it to Test2.txt> >
Content 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_USE> >
int 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") );> This is a memory
leak. You need to free the pointer re
turn by the > transcode function:> > XMLCh* lfSeq =
XMLString::transcode("\r\n");> theSerialize->setNewLine(lfSeq);>
XMLString::release(&lfSeq);> > Also, the DOS sequence is CR/LF, so you want
"\r\n" instead of "\n\r".> > Dave> >
---------------------------------------------------------------------> To
unsubscribe, e-mail: [EMAIL PROTECTED]> For additional commands, e-mail: [EMAIL
PROTECTED]>
_________________________________________________________________