Wrox Programmer Forums
|
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 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 5th, 2010, 01:24 AM
Friend of Wrox
 
Join Date: Oct 2004
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 01:26 AM..
 
Old January 5th, 2010, 01:22 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 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





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 05:30 AM
how to read node dynamically gantait XSLT 4 February 27th, 2007 11: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 06:50 PM





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