Home >Backend Development >PHP Tutorial >Use PHP 5.0 to easily parse XML documents (6)_PHP Tutorial

Use PHP 5.0 to easily parse XML documents (6)_PHP Tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-13 11:00:16928browse

The following is to add products through the createNode() function, and then display the added results
<?xml version="1.0" encoding="GB2312" ?>
<shop>
<name>Hualian< /name>
<address>No. 9999, Chang'an Street, Beijing</address>
<desc>Supermarket chain</desc>
<telphone>123456789</telphone>
<cat id=" food">
<goods id="food11">
<name>food11</name>
<price>12.90</price>
<leaveword author="hahawen" date="2004 -12-05">This product is good</leaveword>
</goods>
<goods id="food12">
<name>new food12</name>
<price>22.10 </price>
</goods>
<goods id="food13">
<name>food13</name>
<price>100</price>
</goods >
</cat>
<cat>
<goods id="tel21">
<name>tel21</name>
<price>1290</price>
</goods>
</cat>
<cat id="coat">
<goods id="coat31">
<name>coat31</name>
<price> 112</price>
</goods>
<goods id="coat32">
<name>coat32</name>
<price>45</price>
</ goods>
</cat>
<special id="hot">
<goods>
<name>hot41</name>
<price>99</price>
</goods>
</special>
</shop>
 The following is to delete the product through the removeNode() function, and then display the result after deletion
<?xml version="1.0" encoding="GB2312" ?>
<shop>
<name>Hualian</name>
<address>No. 9999, Chang'an Street, Beijing</address>
<desc>Supermarket chain< /desc>
<telphone>123456789</telphone>
<cat id="food">
<goods id="food11">
<name>food11</name>
<price>12.90</price>
<leaveword author="hahawen" date="2004-12-05">This product is good</leaveword>
</goods>
<goods id=" food13">
<name>food13</name>
<price>100</price>
</goods>
</cat>
<cat>
<goods id="tel21">
<name>tel21</name>
<price>1290</price>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631831.htmlTechArticleThe following is to add products through the createNode() function, and then display the added results
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