XML PHP #text problem

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.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Other Programming Languages

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Mar 19th, 2006, 19:42
Junior Member
Join Date: Mar 2006
Age: 21
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
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>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

Reply

Tags
xml, php, text, problem

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT. The time now is 04:53.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved