Home >Backend Development >PHP Tutorial >Detailed explanation of php minixml_PHP tutorial

Detailed explanation of php minixml_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:51:011024browse

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 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 is obvious that the use of miniXML is very simple, especially for simple saving This is especially true for data XML files. For details, you can see the examples provided by miniXML. No details are given 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 is introduced on the official website: http://minixml.psychogenic.com/ api.html.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319193.htmlTechArticleThe usage method is as follows, you can see the use of miniXML, which is similar to ActiveLink-PHP-XML-Package-0.4.0 Than, it is more consistent with usage habits and simpler. $xmlDoc=newMiniXMLDoc(); $xmlRoot=nbsp;$xmlDoc...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn