Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP XML Using ASP 3 and XML. See also the XML category for more XML discussions not relating to ASP. NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP XML section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 5th, 2010, 12:24 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: , , .
Posts: 198
Thanks: 2
Thanked 0 Times in 0 Posts
Send a message via MSN to itHighway
Default Read XML by Node Name

Hello,

How can I read a xml file using Node Names:

For Example:

I could use:
Quote:
objLst.item(i).childNodes.item(2).text
but instead of that, I want something like this:

Quote:
objLst.item(i).childNodes.item("reference").text
Is it possible ? How can i do that ?

Last edited by itHighway; January 5th, 2010 at 12:26 AM.
Reply With Quote
  #2 (permalink)  
Old January 5th, 2010, 12:22 PM
Friend of Wrox
Points: 6,414, Level: 34
Points: 6,414, Level: 34 Points: 6,414, Level: 34 Points: 6,414, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2007
Location: Germany
Posts: 1,192
Thanks: 0
Thanked 235 Times in 234 Posts
Default

Use selectNodes and/or selectSingleNode which take XPath expressions so e.g.
objLst.item(i).selectSingleNode("reference").text
should do.
Note that with MSXML 3 the default expression language for selectNodes/selectSingleNode is not XPath so you should call
doc.setProperty "SelectionLanguage", "XPath"
(where doc is your MSXML 3 DOM document object) first before using selectNodes or selectSingleNode with XPath expressions.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a node to an existing xml node list. codehelp C# 2008 aka C# 3.0 2 October 12th, 2009 07:41 AM
how to append child node after an node in XML + C# vishnu108mishra XML 5 November 13th, 2007 04:30 AM
how to read node dynamically gantait XSLT 4 February 27th, 2007 10:01 AM
DTS Package, XML task. Read XML file and store it Victoria SQL Server DTS 0 July 24th, 2006 02:43 PM
Read xpath query from node value jaquing XSLT 2 January 11th, 2006 05:50 PM



All times are GMT -4. The time now is 12:20 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.