Hi,
I am currently writing a program which will take a document:

<?xml version="1.0" encoding="utf-8"?>
<MenuItem version="1.0">
<item_text>
<TEXT default_lang="en" str="NAME" /> ( language/ text string)
</item_text>
<item_help>
<TEXT default_lang="en" str="DESCRIPTION" /> (help menu/language/ description)
</item_help>
<item_icon>
<LEFT str="IMAGE" /> (image)
</item_icon>
<item_action>
<ACTION type="Internal" str="Positioning_Maps_Id"/> (internal,external/????)
</item_action>
</MenuItem>

and what I want to do is get the NAME, DESCRIPTION and IMAGE parts in the document, put them into text boxes, and once they have been edited they must put the NAME, DESCRIPTION and IMAGE back into the bit of code, if you want me to explain further please ask

Thank you so much
Luke

Recommended Answers

All 6 Replies

I would parse the document into an XML document object, bind the XML document object nodes to the text boxes and then do the reverse and write over the document. (Thats the principal with bits cut out, see example for more info)

Example of parsing an XML document:
http://www.codeproject.com/KB/cpp/parsefilecode.aspx

Green2go

Thanks, will give it a go!!!

Please could I ask you to explain, I am really confused by the link that you gave me, please would you parse the NAME part of the document I gave you then I will do the others,
If you would do this I would appreciate it SO much,

Thank you
Luke

Please could someone do it! I would really appreciate it. I know quite a bit about VB.net coding but nothing about XML documents,
Thank you in advance
Luke

Sure, I charge £120/$169 p/h, I reckon it'll take about an hour. I'll give you my PayPal account details!
(Note to moderaters, above is a joke)

People are here to help not write your software for you. Simply copying code will not help you in the long run. If you know enough VB.NET you will not find it difficult!?

Heres a snip of code that should point you in the right direction (modified from the codeproject example i posted):

Try
Dim m_xmld As XmlDocument
Dim m_nodelist As XmlNodeList
Dim m_node As XmlNode
'Create the XML Document
m_xmld = New XmlDocument()
'Load the Xml file
m_xmld.Load("C:\text.xml")
'Get the list of item text nodes
m_nodelist = m_xmld.SelectNodes("/MenuItem/item_text")
'Get the first node inner text
Dim varName = m_nodelist(0).InnerText
'Output to msg box
MsgBox(varName)
Catch errorVariable As Exception
'Error trapping
MsgBox(errorVariable.ToString())
End Try


Green2Go

I apologise and thank you so much, i'll try and figure it out from that

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.