none
how to read value from xml file RRS feed

  • Question

  • <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <EmpDetails>
     <Details>
    <Employee>
    <Name>ABC</Name>
    <Dept>IT-Software</Dept>
    <Location>New Delhi</Location>
    </Employee>
    <Employee>
    <Name>XYZ</Name>
    <Dept>IT-Software</Dept>
    <Location>Chennai</Location>
    </Employee>
    <Employee>
    <Name>IJK</Name>
    <Dept>HR Operations</Dept>
    <Location>Bangalore</Location>
    </Employee>
     </Details>
    </EmpDetails>

    how to read name node value from each employee record

    Wednesday, March 12, 2014 3:20 PM

All replies

  • For sample:

    Sub t()
    'via kulasart EF
    Dim XMLDoc As MSXML2.DOMDocument
    Dim XMLNodes As IXMLDOMSelection
    '......
    'ladowanie dokumentu xml
    XMLDoc.Load "C:\XML_DOCS\DB\exp_documents_FI.xml"
    'malutki xpath
    Set XMLNodes = XMLDoc.selectNodes("//truck[/dest='FI_HEL']//driver[last_stop_lt<4]")
    
    'tu kilka operacji na wezłach
    ' ....
    ' ....
    'pobranie wezla do ktorego cos bede dodawal
    Set node = XMLDoc.selectSingleNode(//truck[/dest='FI_HEL']//point[position()=3])
    
    ' dodanie wezla
    Set newNode = xmlDoc.createElement("unloading_time")
    newNode.Text = "12:30"
    node.AppendChild newNode
    
    'zapis
    XMLDoc.save "C:\XML_DOCS\DB\exp_documents_FI_dt.xml
    End Sub 

    and some tutorial http://www.jpsoftwaretech.com/search/xml/


    Oskar Shon, Office System MVP - www.VBATools.pl
    if Helpful; Answer when a problem solved

    Wednesday, March 12, 2014 8:25 PM
    Answerer