473,508 Members | 2,195 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XPath to find all nodes without children

455
Hey all...

I have this:

<Category>
<Category>
<Product>
<Product>
</Category>
<Category/>
<Product/>
<Product/>
</Category>

And I'd like some XPath syntax to return ALL Category nodes that do not have
children (either Product or Category children). Categories and products can
be n nodes deep...

I thought this might work: //Category[not(Category or Product)]
but alas, it does not.

Any help would be appreciated.

- m -
Nov 12 '05 #1
1 1994
455
Sorry... please disregard... This was the answer, I just had a bug.

For those who care, this does work.

- m -
"455" <45*@notavalidaddress.com> wrote in message
news:QkVXe.528931$s54.144834@pd7tw2no...
Hey all...

I have this:

<Category>
<Category>
<Product>
<Product>
</Category>
<Category/>
<Product/>
<Product/>
</Category>

And I'd like some XPath syntax to return ALL Category nodes that do not
have children (either Product or Category children). Categories and
products can be n nodes deep...

I thought this might work: //Category[not(Category or Product)]
but alas, it does not.

Any help would be appreciated.

- m -

Nov 12 '05 #2

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

Similar topics

1
6812
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...
7
1796
by: steve bull | last post by:
I have the following code snippet to read the colorRange attributes for the colorRangeSwatch in the xml file listed below. string expr = "/swatches/colorRangeSwatch/colorRange";...
8
1167
by: Michael Wohlwend | last post by:
Hi, this is my first xpath try and after reading many web-pages that xpath is still not working :-( (btw, it's my own project, not a homework) I have something like that: <root> <one/>
2
2861
by: ree32 | last post by:
When I import an xml document in Visual studio and Genereate as schema from it, and create a dataset from it, it adds this line into to the root element of my xml file -...
13
3215
by: David Thielen | last post by:
XPathNavigator nav = MyCreateNav(); // InnerXml == "software" nav.SelectSingleNode"."); The select returns an exception: + $exception {"'.' has an invalid token."} System.Exception...
2
1383
by: Candle | last post by:
I am new to XML Programming and I am hoping someone can help me out with this. Assuming I have the following XML: <root> <E C="P_E1" O="E1" Y='True'> <A C="P_E1A1" V="7" Y='True'/> <A...
3
3071
by: Arndt Jonasson | last post by:
Let's say we have a schema (maybe expressed in XML Schema, but not necessarily so), that allows this instance document: <top> <txt>This is text</txt> <books> <book>Tarzan</book> <book>Harry...
0
7227
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
7127
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
7331
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,...
0
7391
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7501
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
4713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3188
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1564
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
768
muto222
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.