PHP minixml detailed _php Tips

Source: Internet
Author: User
Using the following methods, you can see the use of minixml, compared with activelink-php-xml-package-0.4.0, more in line with the use of habits, but also more simple.

$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 ();

Add a child element, there are two ways, the first is directly the node Createchild, the second is first XmlDoc first createelement, then, the node in AppendChild.

The final print results are:
<?xml version= "1.0"?>
<achild name= "Annie" eyes= "#0000FF" hair= "#FF0000" >
This element has attributes and children, such as this
<image location= "Yun_qi_img/leech.jpg"/>
Image and Little
<song> tomorrow, Tomorrow </song>
</achild>


It is obvious that Minixml's use of the method is very simple, especially for simple data-saving XML files, but also, in detail, to see the examples provided by Minixml. Here is an unknown.

=========================================================================

Analytical

The Minixml file structure is:
minixml.inc.php
------Classes
-----------doc.inc.php element.inc.php node.inc.php treecomp.inc.php

Detailed API explanations are presented on the official website: http://minixml.psychogenic.com/api.html.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.