Motivation:
I wrote QXml because I didn't found a php class that was able to handle array to xml conversion sufficiently. QXML is able to preserve attributes and does a lot more.
An array structure is geared to the structure of a simple xml object.
SimpleXMLElement attributes are printed out (via print_r()-method) like the following: [@attributes]
Analogous to this convention you have to declare a nested array by setting its name to @attributes:
array (
"@attributes" => array("id" => "myID")
"@textNode" => "MyTextNode Data"
);
If you declare a nested array with @textNode as key, then a CDDATE escaped text node will be created.
Otherwise new elements will be created.
QSet is my favorite array helper class that allows array handling with ease. I adopted it from CakePHP. I renamed it, reconditioned it a bit and made some useful enhancements.
QSet and QXML are working together. It is a strong team. It allows e.g. following:
ARRAY to XML Conversion
XML to Array Conversion
XML to Object Conversion
Array to Object Conversion
(vice versa)
By including the vendor classes Services_JSON from PEAR and the IBM xml2json class you can do this additionally:
XML to JSON Conversion
Array to JSON Conversion
and so on.
The other classes are for now just example classes.
The QReflection class is an extraction from another project where i use it for documentary demands and purposes.
I hope you enjoy this class as i do.
best regards
Thomas Schäfer
|