|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
how to get the "content" with "xmlDoc" or "xmlDocFile"?
I have some problem in using domxml in php
how to get the "content" with "xmlDoc" or "xmlDocFile"? I use Php 4.2.0 , and try this script : <?php $theXML = "<?xml version='1.0'?>"; $theXML .= " <people>"; $theXML .= " <person id='13' dob='13/07/82'>"; $theXML .= " Mitchell Harper"; $theXML .= " </person>"; $theXML .= " <person id='14' dob='20/08/1960'>"; $theXML .= " Bodger Dodger"; $theXML .= " </person>"; $theXML .= " </people>"; $xmlDoc = xmldoc($theXML); $root = $xmlDoc->root(); $people = $root->children(); while($person = array_shift($people)) { if($person->tagname == "person") { echo "<b>Person Found:</b><br> "; echo "Name: " . $person->content . "<br>"; echo "Id: " . $person->get_attribute("id") . "<br>"; echo "DOB: " . $person->get_attribute("dob") . "<br><br>"; } } ?> and why the $person->content still does'nt appear, what's wrong with this? but if i use $xmlDoc = xmltree($theXML); and $person->chidren[0]->content I get the content |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Programming Tools > how to get the "content" with "xmlDoc" or "xmlDocFile"? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|