Out the difficulties of using simpleXML for xml parsing in PHP(when it invlolves namespaces), I have created this PHP class, CRXML for xml Manipulation.
This class can be used to create, parse and manipulate XML documents using a combination of object and array notations.
It can create a new XML document or load an existing document from a string and allow applications to manipulate the xml using PHPs object and array notations.
The highlights of this class.
1. Name spaced nodes are accessed in the same manner as non-names paced ones, by using notation ->{'prefix:nodeName'}.
2. Php code generation for the access of any node;A feature useful in parsing complex xml strings.This is because, by manualy trying to find the path to a node, one may miss intermediate nodes or namespaces.This class solves that issue by generating statements to access a node.
3.Support for CDATA sections.
4.Better error reporting. When something error occurs, the class tries to respond with a helpful error message, together with the file and line number from which the initial call originated.
5.Full support for name spaced attributes.
6.XML generation made easy.Just add properties and keys to the crxml object to create nodes and attributes. A call to XML() method generates the corresponding XML string.
7.XML manipulation made easy. Uses assignment operator to copy nodes from one xml document to another. |