$xmlDoc = new MiniXMLDoc(); $xmlRoot =& $xmlDoc->getRoot(); $childElement =& $xmlRoot->cre " /> 亚洲午夜av,亚洲人午夜精品,久久66热re国产

色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

php minixml詳解

使用方法如下,可以看到miniXML的使用,與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(); 

添加一個子元素,有兩種方式,第一種是直接該結點createChild,第二種是先xmlDoc先createElement,然后,該結點在appendChild. 

最后打印出來的結果是: 
<?xml version="1.0"?> 
<achild name="annie" eyes="#0000FF" hair="#FF0000"> 
This element has attributes and children, such as this 
<image location="http://psychogenic.com/image.png" /> 
image and little 
<song> tomorrow, tomorrow </song> 
</achild> 


可以很明顯的看得出,miniXML的使用方法是非常簡單的,尤其是對于簡單的保存數據的XML文件,更是如此,詳細可以看miniXML提供的例子.此處不詳說. 

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

解析 

minixml文件結構是: 
minixml.inc.php 
------classes 
-----------doc.inc.php element.inc.php node.inc.php treecomp.inc.php 

詳細的API解釋說明,在官方網站上有介紹: http://minixml.psychogenic.com/api.html.

php技術php minixml詳解,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 武强县| 弥勒县| 贡山| 武邑县| 司法| 璧山县| 东乌珠穆沁旗| 肇源县| 安乡县| 平度市| 溧阳市| 仲巴县| 麻栗坡县| 青铜峡市| 长治县| 双鸭山市| 莎车县| 于都县| 阿合奇县| 高台县| 陵川县| 肇源县| 浑源县| 盘山县| 东宁县| 丹巴县| 温州市| 桐庐县| 延长县| 中山市| 黔江区| 阳信县| 多伦县| 民丰县| 延津县| 富川| 定日县| 丰城市| 金华市| 平和县| 丹江口市|