hi,

how to read value from xml file. for example i have booth id stored in xml and i want to read the id number in vb.net. how do i do that.

Recommended Answers

All 5 Replies

Could you please post the content of the xml file?

hi,

can i post to you private.

sure thing

hi,

i just posted private, actualy i try to get kioskno (from xml) but i have no idea i doesn't want to read the value from xml. i have no idea where goes wrong with the code.
please guide me

hi,

i really have problem read value from xml. i have no idea whats wrong with the code.
Can anyone HELP ME PLEASE !!!!

this id the code i coded at form load

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
        xmlKioskNo = ReadRetailerSettingXML(strXMLPath, 0)
         Label3.Text = Format(CreditBalance(), "RM" & vbTab & "#,###,###.00")
     
    End Sub

and this is i coded at module level

Public Function ReadRetailerSettingXML(ByVal strXMLPath As String, ByVal LoopID As Integer) As String
        Dim xmlRoot As MSXML.IXMLDOMElement
        Dim objDOMXML As New MSXML.DOMDocument
        Dim intNodesLength As Short
        Dim a As Integer = 0
        Dim stroutput As String = ""

        strXMLPath = RBMKioskPath

        objDOMXML.resolveExternals = True
        objDOMXML.validateOnParse = True
        objDOMXML.async = False
        Call objDOMXML.load(strXMLPath)
     
        xmlRoot = objDOMXML.documentElement
        If xmlRoot.baseName = "Configuration" Then
            If xmlRoot.childNodes.item(LoopID).hasChildNodes = True Then
                intNodesLength = xmlRoot.childNodes.item(LoopID).childNodes.length
                xmlRoot = xmlRoot.childNodes.item(LoopID).firstChild
             
                For a = 0 To intNodesLength - 1
                    If xmlRoot.attributes.item(0).text = "Knumber" Then
                        xmlKioskNo = xmlRoot.text
                                          End If

                    xmlRoot = xmlRoot.nextSibling
                Next a

                       End If
        End If
        objDOMXML.abort()
      
    End Function
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.