473,385 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

getElementsByTagNameNS Function Call

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

Oct 11 '06 #1
2 1660


Learner wrote:
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?
--

Martin Honnen
http://JavaScript.FAQTs.com/
Oct 11 '06 #2
Actually

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

This statement itself returns nodelist that has length as 0 .
I don't know why ??
Martin Honnen wrote:
Learner wrote:
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?
--

Martin Honnen
http://JavaScript.FAQTs.com/
Oct 11 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: JKop | last post by:
Take the following simple function: unsigned long Plus5Percent(unsigned long input) { return ( input + input / 20 ); } Do yous ever consider the possibly more efficent:
2
by: laredotornado | last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to have my Javascript function execute from the BODY's "onload" method, but if there is already an onload method defined, I would...
13
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make...
23
by: bluejack | last post by:
Ahoy... before I go off scouring particular platforms for specialized answers, I thought I would see if there is a portable C answer to this question: I want a function pointer that, when...
3
by: Beta What | last post by:
Hello, I have a question about casting a function pointer. Say I want to make a generic module (say some ADT implementation) that requires a function pointer from the 'actual/other modules'...
9
by: CryptiqueGuy | last post by:
Consider the variadic function with the following prototype: int foo(int num,...); Here 'num' specifies the number of arguments, and assume that all the arguments that should be passed to this...
6
by: RandomElle | last post by:
Hi there I'm hoping someone can help me out with the use of the Eval function. I am using Access2003 under WinXP Pro. I can successfully use the Eval function and get it to call any function with...
1
by: Steve | last post by:
With the help of this newsgroup and Google I have got this code working fully in Firefox and can alert the XML in IE but because IE does not impliment the DOM "getElementsByTagNameNS()" function I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.