Could someone please tell me how to create a generic XML parser using
VB
For example for this xml
<address>
<name>Jonty</name>
<petname>Popo</petname>
<address>Your house</address>
<tell>you tell me 12321</tell>
<addresstt hi="ho">
<name1>Jippa</name1>
<tell1>9873</tell1>
</addresstt>
</address>
how to get the output to show
Address
Name:Jonty
Petname:Popo
Address:Your house
Tell: you tell me 12321
AddressTT
Hi:Ho
Name1:Jippa
Tell1:9873
******************************­******************************­***
My code at the moment is
Option Explicit
Private m_AppPath As String
Private Sub LoadValues()
Dim xml_document As DOMDocument
Dim values_node As IXMLDOMNode
Dim root As IXMLDOMElement
Dim child As IXMLDOMNode
' Load the document.
Set xml_document = New DOMDocument
xml_document.Load m_AppPath & "output.xml"
' If the file doesn't exist, then
' xml_document.documentElement is Nothing.
If xml_document.documentElement Is Nothing Then
' The file doesn't exist. Do nothing.
Exit Sub
End If
' Find the Values section.
Set root = xml_document.documentElement
For Each child In root.childNodes
Text1.Text = Text1.Text & child.nodeName & " : " & child.Text &
vbCrLf
Next
End Sub
Private Sub Form_Load()
' Get the application's startup path.
m_AppPath = App.Path
If Right$(m_AppPath, 1) <> "\" Then m_AppPath = m_AppPath & "\"
' Load the values.
LoadValues
End Sub
******************************­***************************
And it is giving me output
name : Jonty
petname : Popo
address : Your house
tell : you tell me 12321
addresstt : Jippa 9873
As you would see..it is not reading the node names name1 and Tell1...Also how
to read attributes and values??
Looking forward to your help
Thanks
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
[Non-text portions of this message have been removed]
'// =======================================================
Rules : http://ReliableAnswers.com/List/Rules.asp
Home : http://groups.yahoo.com/group/vbHelp/
=======================================================
Post : [email protected]
Join : [EMAIL PROTECTED]
Leave : [EMAIL PROTECTED]
'// =======================================================
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/vbhelp/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/