This post originated from an RSS feed registered with PHP Buzz
by Stephan Schmidt.
Original Post: New versions of XML_Parser and XML_Serializer released
Feed Title: a programmer's best friend
Feed URL: http://blog.php-tools.net/rss.php?version=1.0
Feed Description: The blog of PHP Application Tools
I released new versions of two of my PEAR packages: XML_Parser 1.2.2 and XML_Serializer 0.14.0. While XML_Parser 1.2.2 only fixes two bugs, XML_Serializer 0.14.0 provides two cool new features:
By splitting the SAX-handlers from the XML_Parser class (which is possible since XML_Parser 1.2.0) you may now set the source and the target encoding of the XML documents that you want to unserialize. This enables you to read UTF-8 encoded documents and convert them to ISO-8859-1 on-the-fly.
I added a new option "encodeFunction" to the XML_Serializer class, which lets you specify a PHP function or method that will be called for all character data and attributes before they are written to the XML document. This allows you to encode your data in UTF-8 before creating an XML-document. As XML_Unserializer provides a mathing option to decode the data, you could also use this to transparently encrypt XML and decrypt XML documents
I added these two new features, as eBay requires applications to work with UTF-8 encoded XML documents and thus Services_Ebay needs to read and write UTF-8 encoded XML-streams. But the more I think about these features the more situations come to my mind where those options could be timesavers.