Hi,
This works OK for me. Can you give a sample of your XML? Its possible that the pretty print just does not do what you want.
Gareth
Myles Bunbury wrote:
Greetings.
I'm using the Xerces C++ 2.6.0 XML parser to output some XML. The XML itself is fine, however, it is quite unweildy due to the fact that I can't seem to get any new line charcters out. I'm wondering if I'm doing something wrong or if this is a bug.
In my code, I initialize a DOMWriter by doing:
m_pWriter->setNewLine(L"\n\r");
When I call getNewLine(), I get my string back. So that looks OK, but it doesn't get included in the output.
Looking around at the documention, I tried:
m_pWriter->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true); m_pWriter->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
The first line return true, and after the second line I get call getFeature and get a true value returned as well. Still no new line characters on the output though.
The code I'm using to output (C++ Builder 6) is:
DOMNode* pRoot = m_pParser->getDocument(); AnsiString sXML = m_pWriter->writeToString(*pRoot); pStream->Write(sXML.c_str(), sXML.Length());
I've also tried:
XMLFormatTarget* pFormatTarget = (XMLFormatTarget*) new MemBufFormatTarget(); DOMNode* pRoot = m_pParser->getDocument(); m_pWriter->writeNode(pFormatTarget, *pRoot); AnsiString sXML = (char*) ((MemBufFormatTarget*) pFormatTarget)->getRawBuffer(); pStream->Write(sXML.c_str(), sXML.Length());
No decernable difference in the output was detected. Either way, when looking at the sXML variable, I do not see any "\n" charcters.
Again, what am I doing wrong or is this a bug?
Thanks for the help.
---
"Some would ask, how could a perfect God create a universe that is filled with so much that is evil. They have missed a greater conundrum: why would a perfect God create a universe at all?" -Sister Miriam Godwinson - "But For The Grace Of God" "The best things in life aren't things." -Art Buchwald "Never leave a friend behind. Friends are all we have to get us through life - and they are the only things from this world that we could hope to see in the next." -Dean Koontz - "Fear Nothing"
Myles Bunbury, BASc. - Software Engineer CD Name Search Phone: (613) 739-2956 Fax: (613) 739-1739 Web: www.cdnamesearch.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Gareth Reakes, Managing Director Parthenon Computing +44-1865-811184 http://www.parthcomp.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]