Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT 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 Search this Thread Display Modes
  #1 (permalink)  
Old April 28th, 2006, 01:53 PM
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 Reading XML file using ASP

Hello,

Using ASP I need to read a xml file and save the values in variables. The data in XML file is in following format:


 <CLIENT adSource="MSN" age="14">
  <PERSON SSN="00000345" lastName="Blood" firstName="Anderson" DOB="4/3/62" />
     <EMPLOYER name="The itHighway" position="clerk" payDays="">
       <PHONE type="Work" number="603-921-0677" />
       <PHONE type="Boss" number="603-924-0067" />
     </EMPLOYER>
 </CLIENT>


Any Idea..
Any Help...
Will be greatly appriciated.

Thanks!
Zeeshan Ahmed

Reply With Quote
  #2 (permalink)  
Old April 28th, 2006, 02:43 PM
Authorized User
 
Join Date: Jan 2006
Location: , , .
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This should get you started

Dim oXML, oClientNode, iClientAge
Set oXML = Createobject("MSXML2.DOMDocument.4.0")
oXML.Load(PATH_TO_FILE_ON_DISK)
Set oClientNode = oXML.selectSingleNode("//CLIENT")
iClientAge = oClientNode.getAttribute("age")
Set oXML = Nothing

Create an XML object, load your document, select a node with an XPath query, get an attribute from it.

Reply With Quote
  #3 (permalink)  
Old April 29th, 2006, 04:52 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

Thanks tclancy. It worked.

How should I implement the loop if there are multiple records

Example:


<CLIENT adSource="MSN" age="14">
  <PERSON SSN="00000345" lastName="Blood" firstName="Anderson" DOB="4/3/62" />
     <EMPLOYER name="The itHighway" position="clerk" payDays="">
       <PHONE type="Work" number="603-921-0677" />
       <PHONE type="Boss" number="603-924-0067" />
     </EMPLOYER>
 </CLIENT>
<CLIENT adSource="Yahoo" age="24">
  <PERSON SSN="00000345" lastName="Blood" firstName="Anderson" DOB="4/3/62" />
     <EMPLOYER name="The itHighway" position="clerk" payDays="">
       <PHONE type="Work" number="603-921-0677" />
       <PHONE type="Boss" number="603-924-0067" />
     </EMPLOYER>
 </CLIENT>


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Help with PHP file reading XML file for output rydog65 Beginning PHP 0 March 26th, 2008 05:13 PM
reading a XML file connect2sandep XML 1 December 14th, 2006 04:50 AM
reading a XML file connect2sandep General .NET 0 December 13th, 2006 02:10 PM
Reading XML file using ASP itHighway Classic ASP XML 1 June 7th, 2006 06:16 AM
Reading XML file using ASP itHighway Classic ASP Basics 1 May 1st, 2006 06:21 PM



All times are GMT -4. The time now is 05:42 PM.


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