Login   Register  
PHP Classes
elePHPant
Icontem

amba XML document: Extend the DOM XML classes

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

  Author Author  
Picture of Alexey V Ryazhskikh
Name: Alexey V Ryazhskikh <e-mail contact>
Packages: 1 Browse all classes by Alexey V Ryazhskikh Browse all classes by
Country: Russian Federation Russian Federation - PHP jobs in Russian Federation
Age: 28
All time rank: 346089 in Russian Federation Russian Federation
Week rank: 2008 Up58 in Russian Federation Russian Federation Up


  Detailed description   Download Download .zip .tar.gz  
This package extends the DOM XML classes to provide additional functionality.

The DOM Document extension class can return the document root element, add a new node to the end of the document, select nodes that match a XPath expression, call a function for a list of elements and transform a document using XSL.

The DOM element extension class can get XML for the owner document, get the node XPath, get child nodes, select child nodes that match a XPath expression, get the parent and sibling nodes, get and set attributes by name, copy attributes, add child nodes and character data, import and export nodes to and from another document, set and get the inner XML of a node, call a function for nodes that map a XPath expression, etc..

Standard DOMDocument has rich functionality, but it is not handy enough. XMLDocument is extension of standard PHP DOMDocument and DOMElement.


This project contains two classes for easy create, navigate and process XML documents.

Main features is:

* SelectSingleNode and SelectNodes - node related functions works like same functions in C#.
* Inner XML getting/setting - easy and in one line.
* Chain style to create new node sets.
* Functions for frequently used actions: copy attributes, delete all childs etc.

Usage sample:

$doc = new XMLDocument("<Users/>");
$doc->getRoot()->addNode('User')
->setAttribute('Active', 'true')
->addNodeWithCData('Name', 'John')
->getParent()->getParent()
->addNode('User')
->setInnerXML('<Name><![CDATA[Peter]]></Name>');
echo $doc->saveXML();

Result:

<Users>
<User Active="true">
<Name><![CDATA[John]]></Name>
</User>
<User>
<Name><![CDATA[Peter]]></Name>
</User>
</Users>

See Samples for more details.

  Classes of Alexey V Ryazhskikh  >  amba XML document  >  Download Download .zip .tar.gz  >  Support forum Support forum  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: amba XML document
Base name: amba-xml-document
Description: Extend the DOM XML classes
Version: 3.2
PHP version: 5.3
License: BSD License
All time users: 241 users
All time rank: 6829
Week users: 0 users
Week rank: 1803 Equal
 
  Groups   Rate classes User ratings   Applications   Files Files  

  Groups  
Group folder image XML XML parsing and generation View top rated classes
Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes


  User ratings  
Not yet rated by the users

  Applications that use this class  
No application links were specified for this class.
Add link image If you know an application of this package, send a message to the author to add a link here.
  Files folder image Files  
File Role Description
Plain text file XMLDocument.php Class Extends DOMDocument
Accessible without login Plain text file XMLDocumentTest.php Test Tests for XMLDocument and XMLElement
Plain text file XMLElement.php Class Extends DOMElement

Download Download all files: amba-xml-document.tar.gz amba-xml-document.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.