Get values from file

S

shapper

Hello,

I have a XML (Keywords.xml) file as follows:

<objective name="english">
<keyword>english</keyword>
<keyword>england</keyword>
</objective>

I want to create a string from all the keywords for a given objective.
The steps would be:

Get ALL Keywords for Name = <Something>

MyString = "Keyword1, Keyword2, Keyword3"

Thanks,

Miguel
 
L

Laurent Bugnion

Hi,
Hello,

I have a XML (Keywords.xml) file as follows:

<objective name="english">
<keyword>english</keyword>
<keyword>england</keyword>
</objective>

I want to create a string from all the keywords for a given objective.
The steps would be:

Get ALL Keywords for Name = <Something>

MyString = "Keyword1, Keyword2, Keyword3"

Thanks,

Miguel

What code do you have already?

Usually, when you ask a question on a newsgroup, you're expected to have
tried by yourself first.

Here's a starter: You need to load the XML file in a XmlDocument
http://msdn2.microsoft.com/en-us/library/system.xml.xmldocument.aspx

Once loaded, you access the elements using GetElementsByTagName
http://msdn2.microsoft.com/en-us/library/system.xml.xmldocument.getelementsbytagname.aspx

For the "objective" tag, I would rather use an "ID" and not a "name",
because then you can use the method GetElementById to access the desired
element faster.
http://msdn2.microsoft.com/en-us/library/system.xml.xmldocument.getelementbyid.aspx

HTH,
Laurent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top