[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Parsing Special Characters with Expat



The person or process that sends the xml should already have the special characters replaced. For example the & should appear in the xml as &
Expat does a fine job of parsing the xml as long as the xml is valid. 

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Michael Ryan
Sent: Tuesday, January 20, 2009 8:21 AM
To: HTTPAPI and FTPAPI Projects
Subject: Parsing Special Characters with Expat

Help! I'm using Scott's port of Expat, and it works great, but I'm
having a problem with special characters in the XML. Here's an
example:

<ItemProductDescription>This daybed includes back & arms.
Th...</ItemProductDescription>

The ampersand is getting me of course, as well as other characters
such as accents. I know that the data could be escaped coming in to
me, but I don't know if I can get the sender to change the data. A
couple questions:

Is there a way I can handle these characters in Expat as they are,
without the sender having to change the data?

If I can get the sender to change the data, how to I 'unescape' the
incoming data?

I guess I could handle it manually if I could trap for the XML Parsing
Error: not well-formed.

Any suggestions gratefully accepted.

Thanks!

- Michael
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------