You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Petar Obradovic <pe...@yahoo.com> on 2005/03/10 07:25:22 UTC

DOMWriter outputs double new line characters

I am using the following code to output DOM tree into a file:

int main(int argc, char* argv[])
{
XMLPlatformUtils::Initialize();

DOMImplementation * impl = DOMImplementationRegistry::getDOMImplementation(0);

DOMDocument * doc = impl->createDocument(0, X("test"), 0);
DOMElement * root = doc->getDocumentElement();

DOMElement * item = doc->createElement(X("item"));
root->appendChild(item);

DOMWriter * writer = impl->createDOMWriter();
writer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
XMLFormatTarget * writerTarget = new
LocalFileFormatTarget("xerces_output.xml");
writer->writeNode(writerTarget, *root);

XMLPlatformUtils::Terminate();

return 0;
}


What I get out is a pretty-printed XML but each new line character 0x0A is
outputted twice (I verified this with a HEX editor).  How do I prevent this
from happening?

I am using Xerces 2.6.0 built using VC++ 6.0 SP3.

Thanks,
Petar

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org