That's all working as designed. Pretty-printing is an operation that adds whitespace to the document; if you don't pretty-print, Xerces serializes your document exactly as it exists in the DOM, without adding whitespace. Note, too, that pretty-printing behavior is not spelled out in the DOM specifications, so it's up to implementers to decide what to do.
So, I would expect setNewLine() to affect how newlines that are found in the DOM are serialized (CR, LF, or CR-LF). In the event that pretty-printing is enabled, I'd expect it to also determine how inserted newlines are serialized. Of course, you also get whatever other whitespace the pretty-printing algorithm inserts. If you want to add newlines but not indenting, you have three options: - Modify your DOM to include the desired newlines before serializing it. - Modify DOMWriter's pretty-printing algorithm. (One approach would be to add a method that allows you to specify the string to be used for each level of indenting. If " " were the default, serialization behavior would be the same as it currently is unless the indent string were changed.) - Create your own clone of DOMWriter that implements a different pretty-printing algorithm. > -----Original Message----- > From: Elisha Berns [mailto:[EMAIL PROTECTED] > Sent: Sunday, May 22, 2005 11:08 PM > To: Xerces C++ Development > Subject: Xml formatting problem > > When creating new xml instance documents I can't get the > document to be > formatted with new line characters when using: > > XMLCh szNL[4] = { 0xD, 0xA, 0, 0 }; > pWriter->setNewLine(szNL); > > > It only works is I use the format-pretty-print feature: > > m_pWriter->setFeature(L"format-pretty-print", true) > > and that's overkill and doesn't meet my needs. > > What makes the setNewLine() method work? > > Thanks, > > Elisha Berns > [EMAIL PROTECTED] > tel. (310) 556 - 8332 > fax (310) 556 - 2839 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
