View previous topic :: View next topic |
Author |
Message |
Euzinho Dassilva Advanced Cheater
Reputation: 0
Joined: 08 Sep 2007 Posts: 62
|
Posted: Wed Oct 10, 2007 6:18 am Post subject: XML in VB 2008 |
|
|
Hi (again again ^^)
My problem with dynamic combobox was resolved, now I would like to know how can I insert and read a XML file with VB 2008
I would like to make a structure to my Trainer:
Code: | <shop>
<ID>1</ID>
<name>Yulgar's Shop</name>
<ID>2</ID>
<name>The Inn Shop</name>
(...)
</shop> |
Why? Because the VB method to add items in a combobox is horrible. All in a unique line.
Code: | Dim Falconreach As Object() = New Object() {"Yulgar's Shop", "The Inn Shop"} |
And, I don't know how can I would load the shop ID, because the Object stores Strings.
Then, a XML file is a better option.
But, I don't know where I can save the XML file. Together the .vb files? In the /bin/Release folder? Or in a custom folder readable after compile trainer?
An, of course, I need to learn to manipulate XML DOM Nodes with Visual Basic (it's some different that JavaScript, PHP...)
Anyone experient desktop programmer can help me?
|
|
Back to top |
|
 |
atom0s Moderator
Reputation: 204
Joined: 25 Jan 2006 Posts: 8580 Location: 127.0.0.1
|
|
Back to top |
|
 |
Euzinho Dassilva Advanced Cheater
Reputation: 0
Joined: 08 Sep 2007 Posts: 62
|
Posted: Wed Oct 10, 2007 11:57 am Post subject: |
|
|
No, this article isn't useful (not for me).
I only need a XML Reader to read (duh) content of XML's and show in fields
[EDIT]
I don't found a solution, but found this:
Code: | Dim Falconreach As XmlReader = XmlReader.Create(My.Computer.FileSystem.CurrentDirectory & "\XML\Shop\Falconreach\NormalShop.xml")
If Me.listTowns.SelectedItem = "Falconreach" Then
Me.listNormalShops.Text = ""
While Falconreach.Read
If Falconreach.NodeType = XmlNodeType.Element Then
xmlContent.Text &= Falconreach.Name
End If
End While
Falconreach.Close()
End If |
My test XML structure is:
Code: | <?xml version="1.0" encoding="utf-8"?>
<Shop>
<ID>1</ID>
<name>Yulgar's Shop</name>
<ID>2</ID>
<name>The Inn Shop</name>
</Shop> |
This sub returns, in a textfield:
If I replace Falconreach.Name by/for Falconreach.ReadString returns:
Code: |
Yulgar's Shop2The Inn Shop |
** Including the initial space
Anyone can help me to make a new sub to show only the string of tag <name>?
The MSDN help is sucks
[EDIT 2]
THIS problem was solved with XPath. When I can, I post complete solution
|
|
Back to top |
|
 |
|