The usage method is as follows. You can see that the use of miniXML is more consistent with usage habits and simpler than ActiveLink-PHP-XML-Package-0.4.0.
$xmlDoc = new MiniXMLDoc();
$xmlRoot =& $xmlDoc->getRoot();
$childElement =& $xmlRoot->createChild('achild');
$childElement->attribute('name', 'annie');
$childElement->text ('This element has attributes and children, such as this');
$image =& $childElement->createChild('image');
$image->attribute('location', 'http://psychogenic .com/image.png');
$childElement->text('image and little');
$orphan =& $xmlDoc->createElement('song');
$orphan->text(' tomorrow, tomorrow');
$childElement->appendChild($orphan);
print $xmlDoc->toString();
There are two ways to add a child element. The first is to createChild directly on the node, The second method is to createElement first with xmlDoc, and then, the node is in appendChild.
The final printed result is:
This element has attributes and children, such as this
image and little
< ;song> tomorrow, tomorrow
It can be clearly seen that the use of miniXML is very simple, especially for simple XML files that save data, For details, please see the examples provided by miniXML. Not detailed here.
====================================== =====================================
Analysis
minixml file structure is:
minixml.inc. php
------classes
-----------doc.inc.php element.inc.php node.inc.php treecomp.inc.php
Detailed API explanation, in the official There is an introduction on the website: http://minixml.psychogenic.com/api.html.
The above introduces the detailed explanation of hp mini110 php minixml, including the content of hp mini110. I hope it will be helpful to friends who are interested in PHP tutorials.