From sbarai at cisco.com Mon Aug 15 20:44:41 2011
From: sbarai at cisco.com (Swapnil Barai (sbarai))
Date: Mon, 15 Aug 2011 11:44:41 -0700
Subject: [Expat-discuss] XML_Parse( ) Stripping the '\r' characters from the
XML message
Message-ID: <2979E38DD6FC6544B789C8DAD7BAFC520F918CAE@xmb-sjc-235.amer.cisco.com>
HI Folks,
I am facing the following problem using EXPAT's XML_Parse() API.
I have an XML message shown below,
\n\n \nGET
http://sjst81.cisco.com/preview.wmf HTTP/1.0\r\nUser-Agent: Wget/1.10.2
(Red Hat modified)\r\nAccept: */*\r\nHost:
sjst81.cisco.com\r\n\r\n\n \n\n"
Now after we pass this XML message to the XML_Parse API for parsing, the
output we get does not contain any '\r' characters inside any of the XML
tags. However in my case I need these characters to be still present
there after the XML Parsing.
Is this a known issue and is there a workaround to overcome this.
Any help is appreciated.
Thanks
Swapnil
From fdrake at acm.org Tue Aug 16 00:47:40 2011
From: fdrake at acm.org (Fred Drake)
Date: Mon, 15 Aug 2011 18:47:40 -0400
Subject: [Expat-discuss] XML_Parse( ) Stripping the '\r' characters from
the XML message
In-Reply-To: <2979E38DD6FC6544B789C8DAD7BAFC520F918CAE@xmb-sjc-235.amer.cisco.com>
References: <2979E38DD6FC6544B789C8DAD7BAFC520F918CAE@xmb-sjc-235.amer.cisco.com>
Message-ID:
On Mon, Aug 15, 2011 at 2:44 PM, Swapnil Barai (sbarai)
wrote:
> Is this a known issue and is there a workaround to overcome this.
This is correct behavior. The line separators \r\n and \r (normally found on
Mac OS 9 and earlier) are normalized to \n.
If you want to encode the \r en the XML, you need to use a character reference:
-Fred
--
Fred L. Drake, Jr.? ?
"A person who won't read has no advantage over one who can't read."
?? --Samuel Langhorne Clemens