Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read XML config file

Status
Not open for further replies.

Kenny62

Programmer
Mar 3, 2004
54
GB
I have a large config XML file that uses simple tags:
e.g
<tag1>"Data1"</tag1>
<tag2>"Data2"</tag2>
I read this file into a dataset then process the only row. This works very well - also updating the xml file is a breeze.
However some tags really need attributes so that further process may be carried out.
If i do the following:
<tag1>"Data1" cmd="Modify"</tag>

This item is ignored when the dataset reads the file. Is there a workaround. Using the example,I want to get hold of the "Data1" item and the cmd="Modify" attribute.
I don't want to use the xmlreader as resulting code is complex and messy. I'd rather stay with the Dataset because reading/writing to the xml file is easy. Any ideas.

Thanks for your help in advance.

Ken
 
attributes are best stored within the node tag

<tag1 cmd="Modify">Data1</tag1>
 
Hi-jubble, i've made a typo the first example should read:

<tag1 "Data1" /tag1>
<tag2 "Data2" /tag2>

The second example should read:

<tag1 "Data1" cmd="Modify" /tag>

Any ideas - with regard to the orginal question.
(Assume that i have some 200 tags in my xml file and that about 25 need attributes. I've written a friendly UI that allows managers/folks etc to modify the XML file indirectly - hopefully i don't have to make major changes to this app)

Thanks again in advance.

 
Hi -Jubble, i've made a typo, the first example should read:

<tag1 "Data1" /tag1>
<tag2 "Data2" /tag1>
The second example should read:

<tag1 "Data1" cmd="Modify" /tag1>

Any ideas - with regard to the orginal question.
(Assume that i have some 200 tags in my xml file and that about 25 need attributes. I've written a friendly UI that allows managers/folks etc to modify the XML file indirectly - hopefully i don't have to make major changes to this app)

Thanks again in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top