473,406 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Matching values in XPATH


I use Xpath to retrieve nodes in a document like :

doc.SelectSingleNode("/properties/layer[@width='0.2']");

- however this is not very robust as I'm only query on
text. What if width='0.200' instead of width='0.2', then
the above Xpath line wont match the node in question. Is
there a way to query for the value instead of the text?

Best regards
Jesper.

Nov 15 '05 #1
2 1636
Please post xml related questions to microsoft.public.dotnet.xml, I'm sure
you will find better help there.
Willy.

"Jesper Denmark" <an*******@discussions.microsoft.com> wrote in message
news:05****************************@phx.gbl...

I use Xpath to retrieve nodes in a document like :

doc.SelectSingleNode("/properties/layer[@width='0.2']");

- however this is not very robust as I'm only query on
text. What if width='0.200' instead of width='0.2', then
the above Xpath line wont match the node in question. Is
there a way to query for the value instead of the text?

Best regards
Jesper.

Nov 15 '05 #2
Jesper,
Is there a way to query for the value instead of the text?


Try

doc.SelectSingleNode("/properties/layer[number(@width)=0.2]");

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 15 '05 #3

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

Similar topics

2
by: ahogue at theory dot lcs dot mit dot edu | last post by:
Hello - Is there any way to match complex subtree patterns with XPath? The functions I see all seem to match along a single path from root to leaf. I would like to match full subtrees. For...
1
by: Hardy Merrill | last post by:
I have an XML document that has this structure: <applications> <application> <app_name>ABC</app_name> </application> <application> <app_name>DEF</app_name> </application> </applications>
6
by: Petterson Mikael | last post by:
How can I count all java packages that contains fpx in their name using xslt? cheers, //mikael I have the following data: <report>
2
by: Jesper Denmark | last post by:
I use Xpath to retrieve nodes in a document like : doc.SelectSingleNode("/properties/layer"); - however this is not very robust as I'm only query on text. What if width='0.200' instead of...
2
by: Echo 8 | last post by:
Is there a simple way of compare dates? I am trying to create a list of perishable stock in an inventory that is near or past its expiration date. I've tried telling it to compare a node's value...
1
by: malc | last post by:
How do I do pattern matching with xpath? Say I want to match <b> It is cold <b/> I have tried match="htm:b[contains(text(),'is') But it doesn't seem to work. Can anyone help?
4
by: David S. Alexander | last post by:
I am trying to transform XML to XML using an XSLT in C#, but the root node of my XML is not being matched by the XSLT if it has an xmlns attribute. Am I handling my namespaces incorrectly? My C#...
4
by: SteveT | last post by:
I am wanting to populate several treeviews, one for the <TRs> group and one for the <TGsgroup. Is there a simplier way to populate the Treeview than the one I did below? It seems difficult to...
1
by: JB | last post by:
Does anyone know why this code works in example A but not in example B ? Is this a problem with special characters within the data values? A) Set xmlNodeList =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
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,...

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.