getElementsByTagNameNS Function Call

L

Learner

When I execute this script with the xml document placed below it . It
fails. Can Anyonw tell me the cause of it.


var root=xmlDoc.documentElement

var temp8 =
xmlDoc.getElementsByTagNameNS('http://www.tryit.com/fiction','title')

temp8 = temp8.item(0);

if(temp8.nodeName == "d:title")
{
return success;
}
else
{
return fialure;

}



<?xml version="1.0" encoding="ISO-8859-1" ?>
- <bookstore>
- <book xmlns:d="http://www.tryit.com/fiction" category="FICTION">
<d:title d:lang="en">The Alchemist</d:title>
<d:author>Paulo Coelho</d:author>
<d:year>2005</d:year>
<d:price>130.00</d:price>
</book>
- <book xmlns:c="http://www.tryit.com/children" category="CHILDREN">
<c:title c:lang="en">Harry Potter</c:title>
<c:author>J K. Rowling</c:author>
<c:year>2005</c:year>
<c:price>429.5</c:price>
</book>
</bookstore>


Thanks in Advance

Regards

Ankush
 
M

Martin Honnen

Learner said:
When I execute this script with the xml document placed below it . It
fails. Can Anyonw tell me the cause of it.


var root=xmlDoc.documentElement

var temp8 =
xmlDoc.getElementsByTagNameNS('http://www.tryit.com/fiction','title')

temp8 = temp8.item(0);

if(temp8.nodeName == "d:title")
{
return success;
}
else
{
return fialure;

}

Where are the variables |sucess| and |fialure| defined?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top