首頁  >  文章  >  後端開發  >  hp mini110 php minixml詳解

hp mini110 php minixml詳解

WBOY
WBOY原創
2016-07-29 08:38:25969瀏覽

使用方法如下,可以看到miniXML的使用,與ActiveLink-PHP-XML-Package-0.4.0相比,更符合使用習慣,也更加的簡單. 
$xmlDoc = new MiniXMLDoc(); 
$xmlRoot =& $xmlDoc->getRoot(); 
$childElement =& $xmlRoot->createChild('achild'); 
$childElement =& $xmlRoot->createChild('achild'); 
$childElement  $childElement->text('This element has attributes and children, such as this'); 
$image =& $childElement->createChild('image'); 
$image> ', '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. 
最後打印出來的結果是: 
 
 
This element has attributes ://psychogenic.com/image.png" /> 
image and little 
 tomorrow, tomorrow  
 
可以很明顯的看出來的看得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.
以上就介紹了hp mini110 php minixml詳解,包含了hp mini110方面的內容,希望對PHP教學有興趣的朋友有幫助。

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn