Hi Dave, XML parsers are required to normalize end of line sequences on input. Sequences CR LF, and CR on its own are translated to LF. See: http://www.w3.org/TR/REC-xml#sec-line-ends.
If you want to include a CR in the content of your document then it needs to be inserted with a character reference (
), or an entity reference containing CR. On Sun, 24 Aug 2003, Dave Hoffer wrote: > > > > -----Original Message----- > > From: Dave Hoffer > > Sent: Saturday, August 23, 2003 10:17 AM > > To: '[EMAIL PROTECTED]' > > Subject: Xerces-C v2.2 CR LF bug/question > > > > I have a question about how Xerces handles reading and writing strings that > > contain CR and LF characters. > > > > I have an application that allows the user to enter a multiline text string. The > > string may have multiple CR LF pairs. When I save the string to the XML file, all > > is well. I can look at the file and find the CR LF pairs. (I am saving in UTF-8 > > format but my application is UTF-16.) > > > > However, when my application is shut down and restarted and I load the same file, > > when I read the string the CR LF pair is replaced with a single LF. Why is this > > happening? My code structure for reading the file is something like... > > > > // This part is used when creating a new document and when opening an existing > > document... > > DOMImplementation* pDOMImplementation = > > DOMImplementationRegistry::getDOMImplementation(L"Core"); > > m_pDomDocument = pDOMImplementation->createDocument(NULL, L"Target", 0); > > m_pDomDocument->setEncoding(WSZ_ENCODING_UTF_8); > > ... > > // This part is only used when opening an existing document... > > m_pDomDocument->release(); > > m_pDomDocument = NULL; > > DOMImplementation* pDOMImplementation = > > DOMImplementationRegistry::getDOMImplementation(L"LS"); > > m_DOMBuilder = > > ((DOMImplementationLS*)pDOMImplementation)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, > > 0); > > m_DOMBuilder->setFeature(L"namespaces", true); > > DOMDocument* pDomDocument = m_DOMBuilder->parseURI( m_strTargetSpec ); > > m_pDomDocument = (DOMDocument*)pDomDocument->cloneNode(true); > > m_pDomDocument->setEncoding(pDomDocument->getEncoding()); > > > > > > Thanks for any help! > > > > -dh > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -------------------- Michael Glavassevich [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
