Parsing XML file with non-unique tag names using VB
- From: LCharlier@xxxxxxxxxxx
- Date: 10 Oct 2005 05:19:24 -0700
While I have a rudimentary understanding of how to read XML where tag
names themselves are unique, I am unsure how best to navigate XML where
tag names are not unique but instead have unique attribute values
associated with them (<object key="something">). I have reviewed many
XML/DOM resources on the net but it still isn't clear to me whether or
not there exists a way to drill down directly to the level I want or
whether I have to walk the entire tree programmatically. Can someone
please provide me with an example demonstrating the correct approach?
Specifically, I am trying to retrieve menu items for a program (not my
own) that stores the menu configuration in an XML file. The program
stores menu actions as a list of values, each one a pointer to a menu
action definition section. The simplified, stripped-down structure of
the file is shown below:
<?xml version="1.0"?>
<object key="actionsConfiguration" version="3.0">
<array key="topLevelActions">
<value>action1</value>
<value>action2</value>
<value>action3</value>
<value>action4</value>
<value>action5</value>
</array>
<list key="actionDefinitions">
<object key="actionDefinition">
<setting key="id">action1</setting>
<setting key="title">title1</setting>
</object>
<object key="actionDefinition">
<setting key="id">action2</setting>
<setting key="title">title2</setting>
</object>
<object key="actionDefinition">
<setting key="id">action3</setting>
<setting key="title">title3</setting>
</object>
<object key="actionDefinition">
<setting key="id">action4</setting>
<setting key="title">title4</setting>
</object>
<object key="actionDefinition">
<setting key="id">action5</setting>
<setting key="title">title5</setting>
</object>
</list>
</object>
I would like to be able to read this file and present a client with a
list box containing each of the menu actions. By selecting a menu
item, the client could then edit the menu action definition associated
with that particular selection. I also need to be able to add and
delete both menu actions and their associated definitions.
Thanks in advance for any-and-all assistance.
.
- Follow-Ups:
- Re: Parsing XML file with non-unique tag names using VB
- From: Tony Proctor
- Re: Parsing XML file with non-unique tag names using VB
- Prev by Date: Re: Read File Into Access
- Next by Date: Re: SHBrowseForFolder - startup folder
- Previous by thread: VB6 DAO360 incompatability after installing VB.net
- Next by thread: Re: Parsing XML file with non-unique tag names using VB
- Index(es):
Relevant Pages
|