-
how to extract certain tags from an xml using getElementsByTagName
Hi,
I have a large xml and need to extract some xml tags containing some 16 characters codes used in my company to identify things.
the problem is that this code is contained inside tags <Ident> and all through-out the xml the tag <Ident> also contains other stuff, I need to extract only the ones with the codes.
Example:
</Agency>
<Ident>OU_CVRD</Ident>
</Identifier>
</PartyID>
<NameAddress>
.....
</Agency>
<Ident>BLANKET</Ident>
</Identifier>
</ContactID>
......
<AgencyDescription>SupplyCentre Seller</AgencyDescription>
</Agency>
<Ident>017e4e5c-78b2-1000-afd9-40ddab0a0001</Ident>
</Identifier>
</PartyID>
and so on for several lines and more lines, as you can see the tag <Ident> is used for many things but I am only interested in the one containing that long code.
So far I am using:
var i, n_elems, elems = xml_doc.getElementsByTagName("Ident");
n_elems = elems.length;
for (i = 4; i < n_elems; i++)
document.write(elems[i].firstChild.nodeValue + "<br>" + "<br>");
but this is returning ALL <Ident> tags, how can I make this conditional?
Thanks!
Paulo
Similar Threads
-
By Tim in forum xml.announcements
Replies: 0
Last Post: 10-11-2001, 04:00 PM
-
By xmlstartkabel in forum XML
Replies: 0
Last Post: 10-10-2001, 04:07 AM
-
By Tim Frost in forum xml.announcements
Replies: 0
Last Post: 04-02-2001, 10:53 AM
-
By Extensibility in forum web.announcements
Replies: 0
Last Post: 07-20-2000, 06:20 PM
-
By Sales in forum xml.announcements
Replies: 0
Last Post: 07-20-2000, 06:18 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|