473,473 Members | 1,847 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Filter XML using XPath

Hello,

The following XML file shows an example of some config
data for a Side Button Bar control. There are two forms
this Button Bar control relates to, "frmMainMenu"
and "Listing".

<?xml version="1.0" standalone="yes" ?>
- <productx>
- <Table Name="Group1">
<value>ABCDEG</value>
<Parent>MainMenuButtonBar</Parent>
<Menu>NO</Menu>
<Form Name="frmMainMenu" />
</Table>
- <Table Name="Group1">
<value>ABCDEFG</value>
<Parent>MainMenuButtonBar</Parent>
<Menu>NO</Menu>
<Form Name="Listing" />
</Table>
</productx>

Using the following line of code I filter to these two
nodes.

Dim xmlLabelconfigNI as XPathNodeIterator
Dim xmlButtonBarLabelConfigNav as XPathNavigator

xmlLabelconfigNI = xmlButtonBarLabelConfigNav.Select
("/productx/Table[@Name='Group1']" )

I want to know what XPath to use to navigate directly to
the node with Form Name = "frmMainMenu" and Table Name
= 'Group1'. I am VERY unfamilar with XML and have had
some trouble finding valuable help on filtering XML using
XPath.

THanks in advance,

Felicity

Thanks in
Nov 12 '05 #1
2 5292
The XPath you are looking for is the following:

/productx/Table[Name=='"Group1='" and ./Form/@Name = 'frmMainMenu']

Neetu

Nov 12 '05 #2
Thanks !!

Using the XPath as below has solved the problem !!

/productx/Table[@Name'Group1' and ./Form/@Name
= 'frmMainMenu']

Once I have successfully found the correct node, how can I
get the value of any of the elements value, parent or Menu?

I have tried using .GetAttribute and .MoveTo on
xmlLabelconfigNI.Current.

Thanks in advance,

Felicity

<?xml version="1.0" standalone="yes" ?>
- <productx>
- <Table Name="Group1">
<value>ABCDEG</value>
<Parent>MainMenuButtonBar</Parent>
<Menu>NO</Menu>
<Form Name="frmMainMenu" />
</Table>
- <Table Name="Group1">
<value>ABCDEFG</value>
<Parent>MainMenuButtonBar</Parent>
<Menu>NO</Menu>
<Form Name="Listing" />
</Table>
</productx>

/productx/Table[Name=='"Group1='" and ./Form/@Name
= 'frmMainMenu']

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: bdinmstig | last post by:
I am building various framework components for my team to use in development, and one of those components is a Facade for reading/writing user preferences. The idea is that preference settings...
1
by: bdinmstig | last post by:
I refined my attempt a little further, and the following code does seem to work, however it has 2 major problems: 1. Very limited support for XPath features Basic paths are supported for...
0
by: Earl Teigrob | last post by:
I have PW/UserID info as follows and would like to use xpath to find if a userid and pw exists within the xml file. What Xpath query statement do I need and what query command do I need? <users>...
2
by: Felicity | last post by:
Hello, Using the following XML file, I would like to be able to filter using an XPath to the nodes where Menu = Yes and Form Name = frmMainMenu <?xml version="1.0" standalone="yes"?>...
2
by: nick_tucker | last post by:
Hi, I am very new to XML and XPATH. I have made a sample XML fileto ask my question. <?xml version="1.0" encoding="utf-8"?> <Test> <A> <B> <C> <D>
1
by: BillGatesFan | last post by:
Does anyone have any code to get Attributes of an XML Element Using XPATH. I have been trying all day and cannot get this to work. I have been using XPathNavigator, XPathDocument and the...
2
by: luthriaajay | last post by:
I need some help to extract the LatestFillQuantity element value using XPATH. in Java. I am unable to extract the value of 10000. Please help as to what have I done wrong.? Help appreciated. ...
15
by: Briansmi1116 | last post by:
I created two buttons, that filter my form, They filter in different Fields, and if one is filtered, and the other is not there is a certain amount of record, if they are both pushed, then there is...
5
by: ianoble | last post by:
Here is the outline of the XML data that we are getting from an external source. I would like to use XPath in an xslt to get to the elements that I need. Right now I am only able to get to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.