Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 11th, 2005, 07:31 AM
Authorized User
 
Join Date: Jan 2005
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to JelfMaria
Default How to get a list of specific tag from xml using v

:)

 I have a problem in accessing a specific tag without considering the same tag inside child nodes.

The problem is:
<bib>
<au>
<fnm> Jelfy</fnm>
<snm>Mary</snm>
</au>
<au>
<fnm> Sumitha</fnm>
<snm>Susan</snm>
</au>
<eds>
<au>
<fnm> Joy</fnm>
<snm>Peter</snm>
</au>
<au>
<fnm> Flora</fnm>
<snm>Sania</snm>
</au>

</eds>
</bib>
Here I want only Jelfy Mary and Sumitha Susan,the <au> inside <eds>
I dont want to extract.I used getelementbytagname,select singlenodes etc but it is fetching all the 4 au tags.
I want only the first 2.Can u help me? :(

__________________
Thanks
Jelfy
 
Old January 11th, 2005, 07:47 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

You could use XPath...



dom.selectNodes("bib/au")



HTH,

Chris

 
Old January 12th, 2005, 12:39 AM
Authorized User
 
Join Date: Jan 2005
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to JelfMaria
Default


 Without using xpath also that selectnodes works but
the exact problem is:
<bibl>
<bib id="1">
<bookref>
<old>
<au>
<fnm> Jelfy</fnm>
<snm>Mary</snm>
</au>
<au>
<fnm> Sumitha</fnm>
<snm>Susan</snm>
</au>
<eds>
<au>
<fnm> Joy</fnm>
<snm>Peter</snm>
</au>
<au>
<fnm> Flora</fnm>
<snm>Sania</snm>
</au>

</eds>
</old>
</bookref>
</bib>
<bib id="2">
<jnlref>
<present>
<au>
<fnm> Joseph</fnm>
<snm>M</snm>
</au>
<au>
<fnm> Chris</fnm>
<snm>N</snm>
</au>
<eds>
<au>
<fnm> Joy</fnm>
<snm>Peter</snm>
</au>
<au>
<fnm> Flora</fnm>
<snm>Sania</snm>
</au>

</eds>
</present>
</jnlref>
</bib>
</bibl>
Here I want to extract only all <au> tags outside <eds></eds>.
I tried xmlDoc.selectNodes("bibl//bib//au")with xpath but its extracting all the au tags.
Can u pls help me with code?




 
Old January 13th, 2005, 06:18 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

How about xmlDoc.selectNodes("bibl/bib/*/*/au")
 
Old January 13th, 2005, 09:34 AM
Authorized User
 
Join Date: Jan 2005
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to JelfMaria
Default

Thank You Very Much.....
The * concept usage is extremely helpful to me in solving some of my major project issues.Thanxxxxxxxxxxx.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a list depending on a tag value josephine XSLT 1 October 26th, 2007 05:39 AM
How to fetch text after specific tag text dipsut XSLT 10 May 23rd, 2007 02:57 PM
how to load specific value from dropdown list? method ASP.NET 1.0 and 1.1 Basics 1 June 17th, 2005 08:08 AM
To get a list of specific tag from xml using v JelfMaria VB How-To 0 January 11th, 2005 07:21 AM
XML to (different <tag>) XML mapping Thodoris XML 4 April 27th, 2004 04:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.