Hello........

liunx

Guest
I using php DOM object
<php>
$Dom= new DOMDocument('1.0','utf-8');
$Dom->load('testadmin.xml');
$keyitems= $Dom->getElementsByTagName('key');
$Node= $keyitems->item(0);
var_dump($Node);
</php>

the $Node is a DOMElement object but on Manual DOMNodeList->item() return a DOMNode object.

I want handle XML Node,How to come true?:confused:

thanks!I'm sorry, Class DOMElement extends DOMNode..... in Manual...I think $domelement->saveXML() gives the object back as an XML string.Try this:

<php>
$Dom= new DOMDocument();
$Dom->load('testadmin.xml');
$keyitems= $Dom->getElementsByTagName('key');
$Node= $keyitems->item(0);
var_dump($Node.textContent);
//but it isn't very useful
//the follow is better
foreach ($keyitems as $item) {
echo $item->nodeValue . "\n";
}
</php>


Let's take a look <!-- m --><a class="postlink" href="http://devzone.zend.com/node/view/id/1713">http://devzone.zend.com/node/view/id/1713</a><!-- m --> good tutorial ;)

Bye.
 
Back
Top