XML Serializer

From: Date: Mon, 22 Sep 2003 09:53:46 +0000
Subject: XML Serializer
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-21878@lists.php.net to get a copy of this message
I've been playing with the cvs copy of xml_serializer, the new scalarAsAttributes option works well for me. it would be nice if anew release came up soon ;) I've made a patch, to append the ident of the indent of the element to the prependAttributes parameter. Basically the idea is that if you want to indent the xml attributes you probably want them to be indented after the xml element. Example $options = array( 'indent' => ' ', 'linebreak' => "\n", 'defaultTagName' => 'unnamedItem', 'tagName' => 'pap', 'scalarAsAttributes' => true, 'prependAttributes' => "\n " ); -- Without patch <pap> <push-message deliver-after-timestamp="2003-01-21T06:45:00Z" deliver-before-timestamp="2004-01-21T06:45:00Z" progress-notes-requested="false" push-id="7f8e59c6169cd9a9a9fc7c5403590dc5"> <address address-value="address-value"/> <quality-of-service priority="low"/> </push-message> -- With Patch <pap> <push-message deliver-after-timestamp="2003-01-21T06:45:00Z" deliver-before-timestamp="2004-01-21T06:45:00Z" progress-notes-requested="false" push-id="0ee5327ed7400a965e9a6d2b9edf5cb5"> <address address-value="address-value"/> The patch needs few things like maybe avoid the str_repeat duplication of code and reuse the indent generated for the tag below. Also this behavior might be controlled with another option although this might make it more complicated to use, i think putting this as default would be ok. Also the option value prependAttributes should have a different name to be more consistent (ie indentArrtibute or attributeIndent) with the other option. I have another question since am lazy to browse the source, how does the Serializer handle invalid xml in the values (like & ) Great work, this class looks like a time saver -- Yavor Shahpasov yavo@siava.org

« previous php.pear.dev (#21878) next »