Examples on using qJerry
Say, we need to create the following XML document:
<?xml version="1.0" encoding="UTF-8"?>
<items><item id="1"/><item id="2"/></items>
Do it using traditional DOM functions:
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->appendChild($dom->createElement('items'));
$dom->documentElement->appendChild($dom->createElement('item'))->setAttribute('id', '1');
$dom->documentElement->appendChild($dom->createElement('item'))->setAttribute('id', '2');
echo $dom->saveXML();
The same using qJerry:
q('items')->append('item')->attr('id', '1')->end()->append('item')->attr('id', '2')->dump();
As can be seen, dealing with XML using qJerry is much easier than using DOM, even in most trivial case, never mind when it comes to complex manipulations with multiple queries and modifications of XML tree.
See the source code of this page for a real world example:
Top ↑
License
The qJerry library is licensed under the terms of the GNU Lesser General Public License (LGPL).
Top ↑
Contact developer
qJerry is written and maintained by Eugeny Ostapenko.
E-mail: qjerry.com_EAR_gmail.com.
Top ↑
Links to other resources
- http://jquery.com/ — original jQuery library;
- http://php.net/ — PHP Hypertext Preprocessor.
Top ↑