How do i read data from an XML file in VB6.0(Parse it) and display it in a TextField on the VB6.0 form? I would be highly grateful for any help on that.
Reading data from an XML file in VB6.0
Collapse
X
-
-
no. but u may create itOriginally posted by anupkossambeHow do i read data from an XML file in VB6.0(Parse it) and display it in a TextField on the VB6.0 form? I would be highly grateful for any help on that.
that means create it by urself
Good Luck -
try to use MSXML3.dllOriginally posted by vijaydiwakarno. but u may create it
that means create it by urself
Good LuckComment
-
I am new to visual basic and i needed the source code to load a file say "abc.xml" stored in my C drive, parse it's tags and display the data on the vb6.0 form.Comment
-
dear the xml concept works very well in .net try it to code it in .netOriginally posted by anupkossambeI am new to visual basic and i needed the source code to load a file say "abc.xml" stored in my C drive, parse it's tags and display the data on the vb6.0 form.Comment
-
by the way i found the solution. For an xml file having a root node as "note" and child nodes as to,from,heading and body the following code will parse it for you
Private Sub Readxml()
Dim XmlDoc As New DOMDocument30
Dim nodlst As IXMLDOMNodeList
'============== ===========
'Declaring node variable for the child elements
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("fi le:///C:/anup.xml") Then
'============== ============
'Assigning root node to the node list variable
Set nodlst = XmlDoc.selectNo des("/note")
ReDim Data(nodlst.len gth)
For nodCnt = 0 To nodlst.length - 1
Set nod = nodlst(nodCnt). selectSingleNod e("to")
Data(nodCnt) = nod.Text
Set nod = nodlst(nodCnt). selectSingleNod e("from")
'============== =============
'Appending data inside "from" to "to"
Data(nodCnt) = Data(nodCnt) & vbTab & nod.Text
Set nod = nodlst(nodCnt). selectSingleNod e("heading")
'Appending data inside "to,from" to "heading"
Data(nodCnt) = Data(nodCnt) & vbTab & nod.Text
Set nod = nodlst(nodCnt). selectSingleNod e("body")
'Appending data inside "to,from,headin g" to "body"
Data(nodCnt) = Data(nodCnt) & vbTab & nod.Text
Debug.Print nodCnt, Data(nodCnt)
Next nodCnt
Else
MsgBox ("Can't load file")
End If
End SubComment
-
-
How do i read data from an XML file in VB6.0(Parse it) and display it in a TextField on the VB6.0 form? I would be highly grateful for any help on thatOriginally posted by anupkossambeHow do i read data from an XML file in VB6.0(Parse it) and display it in a TextField on the VB6.0 form? I would be highly grateful for any help on that.Comment
Comment