|
-
Jan 16th, 2002, 05:43 AM
#1
Thread Starter
Junior Member
XML..Example please...
Dear all,
I have been spending so many time in searching a simple example of VB code to make modifications in XML file. Can anyone get me an example please..
I have msxml3.0 and 4 beta with me installed in VB 6.0
Please give me the example ASAP..
thanks in advance..
-
Jan 16th, 2002, 08:58 AM
#2
Member
If you have MSXML v4 then use the language filter to only include VB, then search again. Try using document fragments.
-
Jan 18th, 2002, 06:09 PM
#3
Fanatic Member
If you have MSXML v4 then use the language filter to only include VB, then search again.
Of course you need to use the SDK which comes with the XML parser. You should be able to download it from Micro$oft's site.
Of course I don't know what you want to do, but usually you should create an MSXML2.DOMDocument (which will represent your XML doc), read the XML file (with the load method), and set your doc's documentElement property (which is an IXMLDOMElement). From this point on you should be able to navigate through the XML tree structure.
Don't be frightened by the tons of properties and methods I was really scared the first time I saw them. You'll get familiar with them soon enough.
Good luck!
-
Jan 29th, 2002, 09:56 PM
#4
PowerPoster
Code:
Option Explicit
Private Sub Command1_Click()
Dim xmlDOM As New DOMDocument
Dim xmlNode As IXMLDOMNode
Dim intIndex As Integer
xmlDOM.appendChild xmlDOM.createElement("NAMES")
For intIndex = 0 To List1.ListCount - 1
Set xmlNode = xmlDOM.documentElement.appendChild(xmlDOM.createElement("NAME"))
xmlNode.Text = List1.List(intIndex)
Set xmlNode = Nothing
Next
Debug.Print xmlDOM.xml
End Sub
Private Sub Form_Load()
List1.AddItem "Mike"
List1.AddItem "John"
List1.AddItem "Tom"
List1.AddItem "Jerry"
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|