By the way, since you are using XML, with VB...
You can place code in strings then load with:
DomDocument.LoadXML
This is Great for including small bits of XML, that you don't want people to modify (such as XSL), to your program...
For small XML data blocks, use Const, or any String Variable...
For Large Files, you can use a Resource File...
(If you are interested in this method, Start A New Thread)
Here is an example using the above examples...
Create a new Project, add 2 command buttons, paste this code in the Code Area, and click Run:
Code:
[b]Const sXML = "<test><help>This is the help tag</help><item><name>Item 1</name><data>123</data></item><item><name>Item 2</name><data>456</data></item><item><name>Item 3</name><data>789</data></item></test>"[/b]
Private Sub Command1_Click()
Dim Dom As Object
Set Dom = CreateObject("MSXML.DomDocument")
Dom.async = False
[b]Dom.Loadxml sXML[/b]
MsgBox Dom.SelectSingleNode("//help").Text
End Sub
Private Sub Command2_Click()
Dim Dom As Object
Dim X As Object
Dim msg As String
Set Dom = CreateObject("MSXML.DomDocument")
Dom.async = False
[b]Dom.Loadxml sXML[/b]
For Each X In Dom.SelectNodes("//item")
msg = msg & X.SelectSingleNode("name").Text
msg = msg & " = "
msg = msg & X.SelectSingleNode("data").Text
msg = msg & vbCrLf
Next
MsgBox msg
End Sub
Visit My Site
PROGRAMMER:
Red-eyed, mumbling mammal capable of conversing with inanimate objects.