[Expat-discuss] CRLF conversion question
Karl Waclawek
karl at waclawek.net
Thu Sep 9 15:18:27 CEST 2004
----- Original Message -----
From: "Armin Bauer" <armin.bauer at desscon.com>
To: "Fred L. Drake, Jr." <fdrake at acm.org>
Cc: <expat-discuss at libexpat.org>
Sent: Thursday, September 09, 2004 8:31 AM
Subject: Re: [Expat-discuss] CRLF conversion question
> So what fix do you think would be best?
>
> I have a cdata section like this
>
> <![CDATA[BEGIN:VCARD
> VERSION:2.1
> X-EVOLUTION-FILE-AS:Mike, Smith
> FN:Smith Mike
> N:Mike;Smith
> TEL;PREF;WORK:+1 469 43220403
> EMAIL;INTERNET:mike.smith at yahoo.com
> TITLE:Business Developer
> UID:pas-id-413DC011000000B2
> END:VCARD]]>
>
> the lines are seperated by 0x0d 0x0a
> The tree builder make two text nodes out of every line:
> the first one hold the text of the line like: "VERSION:2.1"
> the second one holds a 0x0a
> the 0x0d is lost
>
> the tree is built by XML_Parse. The parser was created by
> XML_ParserCreate(NULL)
To be precise XML_Parse does not build a tree, this
would rather be the function of the call-backs.
> the wbxml library later just concatenates these text nodes in the
> assumptions that they were not altered (Which is wrong since the 0x0d is
> lost)
>
> so could you give me an hint how to fix this?
Line breaks are reported by Expat as 0x0A, no matter what
the input. So, depending on your platform, convert them back
to the appropriate line break characters.
Another option would be to Base64 encode your CDATA section.
You may not even need a CDATA section then, and everything
is preserved as if it were binary.
Karl
More information about the Expat-discuss
mailing list