Poll: Did you understand the thread Problem well
You do not have permission to vote in this poll.
Yes
0%
0 0%
No
0%
0 0%
Total 0 vote(s) 0%
* You voted for this item. [Show Results]

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script to read a XML file
#1
Not Solved
Hi all,

I am new to VBScripting. i want to read XML file to itereate through all tag names, Tag Values,Attribute Names and Attribute Value.

I have attached the sample XML

Please anyone can help me with the code.

Regards,
Anand
Reply
#2
Not Solved
Anand,

Please go through the below link, hopefully that will solve your problem.

http://motevich.blogspot.com/2008/09/how...tp_08.html
Reply
#3
Not Solved
Hi Anand,

Please go through XMLDOM Object model...you can google it "vbscript+XMLDOM" and go through the methods and properties which XML DOM provides. You'll also get some examples/sample code which'll help you to better understand the concept.
Reply
#4
Not Solved
I got the code for retriving node values but i was not able to find the code for retriving attribute value.

i want to get the value of attribute "ref" in the below xml:
---------------------------------------------

Code:
<States>
   <State ref="FL">
      <name>Florida</name>
      <capital>Tallahassee</capital>
   </State>
   <State ref="IA">
      <name>Iowa</name>
      <capital>Des Moines</capital>
   </State>
</States>

VBScript:

Code:
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load("states.xml")

Dim objChildNodes, strNode
Set objChildNodes = objXMLDoc.documentElement.childNodes<State>

For Each strNode In objChildNodes
   document.write(strNode.nodeName & "<br>")
Next
Reply
#5
Not Solved
@suresh vasu : The link provided by you also doesnt gives info of how to get the values of attribute
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to read a text file using FSO from bottom to up order?? vallalarasu.p 0 2,505 10-13-2014, 11:14 AM
Last Post: vallalarasu.p
  XML FILE COULD NOT BE PARSED tripathy.pilu23 1 8,126 04-18-2014, 06:38 AM
Last Post: kgovadav
  Getting an 'Error in XML document' Error when submitting web services XML luckyexpert 0 3,118 08-20-2013, 10:23 PM
Last Post: luckyexpert
  Read text from text file and save it into a variable in qtp arpan 3 12,957 06-19-2013, 08:34 PM
Last Post: arpan
  XML Data read and extract output in an array SweetyChowdhury 9 7,736 05-10-2013, 03:05 PM
Last Post: SweetyChowdhury

Forum Jump:


Users browsing this thread: 1 Guest(s)