Advise on parsing XML
| From: | Gerard Samuel | Date: | Thu, 05 Aug 2004 20:23:48 +0000 |
| Subject: | Advise on parsing XML | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-192929@lists.php.net to get a copy of this message | ||
Im writing an xml parser. Most of the documents Im parsing, is written by
someone else, so have no control over the validity of the xml file.
Im running into problems with parsing a few documents where the author uses
"exotic" characters such as "é".
Characters like this kill the parser. Ok.
Im trying something different and it seems to work, but Im looking for
comments on if there may be a better way of doing this.
1. Get the document, and pass it through the php function utf8_encode()
2. Parse the encoded document
3. In the character handler function of the parser, pass the string data back
through utf8_decode()
The sequence seem to work, but as I said, any comments (pro/con) would be
appreciated.
Thanks