Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. XML & VB6.0

XML & VB6.0

Scheduled Pinned Locked Moved Visual Basic
xmlhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Shazz Rock
    wrote on last edited by
    #1

    Dear all I am having xml file that look as below ABC 16 XYZ 26 AAA 26 Now i want to read every name and age from the xml file. The code used as Dim XMLDoc As New DOMDocument30 Dim NodLst As IXMLDOMNodeList Dim Node As IXMLDOMNode Dim Nod As IXMLDOMNode Dim nodCnt As Long Dim Data() As String XMLDoc.async = False 'Loading the XML file on C drive If XMLDoc.Load("D:\XML\123.xml") Then '========================== 'Assigning root node to the node list variable Set NodLst = XMLDoc.selectNodes("/People") ReDim Data(NodLst.length) For nodCnt = 0 To NodLst.length - 1 Set Nod = NodLst(nodCnt).selectSingleNode("Person") Data(nodCnt) = Nod.Text Set Nod = NodLst(nodCnt).childNodes(0) '=========================== 'Appending data inside "from" to "to" Data(nodCnt) = Data(nodCnt) & vbTab & Nod.Text Text1.Text = nodCnt Text3.Text = Data(nodCnt) Next nodCnt Else MsgBox ("Can't load file") End If The result is ABC () 16 where as i need Name="ABC" & Age="16" Please help Thanx in advance...!!! Shazz here to help you...

    D 1 Reply Last reply
    0
    • S Shazz Rock

      Dear all I am having xml file that look as below ABC 16 XYZ 26 AAA 26 Now i want to read every name and age from the xml file. The code used as Dim XMLDoc As New DOMDocument30 Dim NodLst As IXMLDOMNodeList Dim Node As IXMLDOMNode Dim Nod As IXMLDOMNode Dim nodCnt As Long Dim Data() As String XMLDoc.async = False 'Loading the XML file on C drive If XMLDoc.Load("D:\XML\123.xml") Then '========================== 'Assigning root node to the node list variable Set NodLst = XMLDoc.selectNodes("/People") ReDim Data(NodLst.length) For nodCnt = 0 To NodLst.length - 1 Set Nod = NodLst(nodCnt).selectSingleNode("Person") Data(nodCnt) = Nod.Text Set Nod = NodLst(nodCnt).childNodes(0) '=========================== 'Appending data inside "from" to "to" Data(nodCnt) = Data(nodCnt) & vbTab & Nod.Text Text1.Text = nodCnt Text3.Text = Data(nodCnt) Next nodCnt Else MsgBox ("Can't load file") End If The result is ABC () 16 where as i need Name="ABC" & Age="16" Please help Thanx in advance...!!! Shazz here to help you...

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      It appears that you're relying on the Nod.Text property to format the field names and values for you. Don't. Just get the Name and Age values for each person and format the output string yourself.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups