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 February 18th, 2004, 10:07 AM
Registered User
 
Join Date: Feb 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Extract Data From Node

Is there a way to extract data from a specific node without using an xsl file? I need to get the data and then display it to the screen. Any suggestions.

 
Old February 18th, 2004, 10:31 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

The most common way would be to open the xml as a DOM tree. If it were a huge file of many megabytes then perhaps SAX would be better.
To read data using msxml then you would use something like this in JavaScript:
Code:
var oDom = new ActiveXObject("Msxml2.DomDocument.4.0");
oDom.async = false;
oDom.load(<pathToFile>);
var sPath = "root/people/person[@id = 1]";
var oNode = oDom.selectSingleNode(sPath);
var sText = oNode.text;
//Display text 'Joe'
wher you xml file would be like
Code:
<root>
<people>
<person id="1">Fred</person>
<person id="2">Joe</person>
<person id="3">Tom</person>
</people>
</root>
Joe (MVP - xml)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract data out from datareader yukijocelyn ASP.NET 2.0 Basics 1 September 21st, 2007 07:27 AM
Missing Node (Node data) pashworth XSLT 3 January 29th, 2007 12:39 PM
How to extract data from Dynamic Checkboxes? leothelion123 BOOK: Professional C#, 2nd and 3rd Editions 0 October 11th, 2006 04:35 AM
how to extract THIS node from XML in ASP?? zoreli XML 1 July 21st, 2006 09:51 AM
How to extract certain data patterns from textbox method VB How-To 4 May 3rd, 2006 02:54 AM





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