This is a discussion on "XML PHP #text problem" within the Other Programming Languages section. This forum, and the thread "XML PHP #text problem are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
XML PHP #text problem
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
XML PHP #text problem
Hello again
Could anyone tell me why I get the following results? The root element is British_Birds. There are 1 child elements. They are: #text resident #text rarevisitors #text ------------------- There should be 2 child elements and why is there #text in the results? I tried looking for answers but search engines won't accept a # in the query. Thanks Don code:- <?php $XMLDoc = DOMDocument::load('birds5.xml'); $root = $XMLDoc->documentElement; echo("The root element is " . $root->nodeName . ".<br />"); $children = $root->childNodes; echo("There are " . count($children) . " child elements. <br />"); echo("They are: <br />"); for ($child = $root->firstChild; $child; $child = $child->nextSibling){ echo $child->nodeName; echo "<br />"; } ?> birds5.xml <?xml version="1.0" encoding="ISO-8859-1"?> <!-- Edited with XML Spy v2006 (http://www.altova.com) --> <British_Birds> <resident> <name>Golden oriole</name> <latin>Oriolus oriolus</latin> <status>Summer</status> <breeding>9-42</breeding> <passage>85</passage> <image>siskin.jpg</image> <url>www.rspb.org.uk/birds/guide/s/siskin/index.asp</url> </resident> <rarevisitors> <name>Hawk Owl</name> <latin>Accipiter nisus</latin> <status>rarevisitor</status> <breeding>0</breeding> <passage>0</passage> <image>hawkowl.jpg</image> <url>www.rspb.org.uk/birds/guide/h/hawkowl/index.asp</url> </rarevisitors> </British_Birds> |
|
|
![]() |
| Tags |
| xml, php, text, problem |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Image and text caption problem | George | Web Page Design | 8 | Feb 27th, 2008 18:14 |
| [SOLVED] Problem with Mac and Text Edit | Claridge | Starting Out | 6 | Nov 29th, 2007 08:43 |
| Cross-browser text problem | LarsUnit | Web Page Design | 5 | Oct 8th, 2007 15:19 |
| Text box disable problem in Safari | Thanuja | JavaScript Forum | 1 | Jun 15th, 2007 14:21 |
| Problem to add text to the textbox | flexed | JavaScript Forum | 1 | Aug 21st, 2006 06:43 |