473,387 Members | 1,859 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,387 software developers and data experts.

XMLDOM Question

Hello,

I have a block of xml and need to determine if a specific element exists.
(Using IE 6).

I might have the following:

<Results>
<Personal>
<Lastname>Doe</Lastname>
<Firstname>John</Firstname>
<Middlename>Q</Middlename> (this element may or may not exist,
depending on the results)
</Personal>
</Results>

Using the XMLDOM, is there a property or method I can use to determine if,
say, the <Middlename> element even exists in the block?

Thanks.
Jul 20 '05 #1
1 1812


George Jewell wrote:

I have a block of xml and need to determine if a specific element exists.
(Using IE 6).

I might have the following:

<Results>
<Personal>
<Lastname>Doe</Lastname>
<Firstname>John</Firstname>
<Middlename>Q</Middlename> (this element may or may not exist,
depending on the results)
</Personal>
</Results>

Using the XMLDOM, is there a property or method I can use to determine if,
say, the <Middlename> element even exists in the block?


You can check
xmlDocument.getElementsByTagName('Middlename').len gth
to find out how many elements with the tag name 'Middlename' exist.
If you have a certain element already you can also appy that method to
the element say you have
personalElementObject
you can then check
personalElementObject.getElementsByTagName('Middle name').length
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #2

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

Similar topics

3
by: Robert Zurer | last post by:
Hello all, I want to load an in-memory XmlDocument from the server to the client and create an XMLDOM object using javascript. I can do it from a url by calling this Javascript from the...
8
by: Mr. x | last post by:
Hello, How can I use xmlpath technogy by xmldom. (or there is another technique, but not xmldom). I need some code samples, please. Thanks :)
0
by: Robert Zurer | last post by:
Hello all, I want to load an in-memory XmlDocument from the server to the client and create an XMLDOM object using javascript. I can do it from a url by calling this Javascript from the...
3
by: xq386 | last post by:
Question: In the XSL file below I put a part of the code (concerning the euro-sign) in comment. If I remove the comment then it doesn't work anymore. How can this be solved? I run Test.html with...
2
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I have the following code which I try to load an xml file, but in browser, I only get text value for each node, not whole xml string. I expect to see something like <name...
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: 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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.