473,405 Members | 2,282 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,405 software developers and data experts.

XPath Help

I have the followign XML document format.

<Asset>
<App Name="Title" Value"Pigs" />
<App Name="Rating" Value"G" />
</Asset>

I'm trying to figure out how to display the Title's value but being
sorted by the Rating's value.

So far I have.

Displays title: Asset_Metadata/App_Data[@Name = 'Title']/@Value

I've tried many other variations to get this to work with no luck.

Any help would be greatly appreciated.

May 2 '07 #1
3 2390
* al**********@hotmail.com wrote in microsoft.public.dotnet.xml:
>I have the followign XML document format.

<Asset>
<App Name="Title" Value"Pigs" />
<App Name="Rating" Value"G" />
</Asset>

I'm trying to figure out how to display the Title's value but being
sorted by the Rating's value.

So far I have.

Displays title: Asset_Metadata/App_Data[@Name = 'Title']/@Value

I've tried many other variations to get this to work with no luck.
I am not sure what you are trying to do (are you using DataSets or some
other form of control that would display XML content based on XPath ex-
pressions?), but you cannot sort in XPath expressions, you have to use
some external means, and your expression does not work because you have
no "Asset_Metadata" element or "App_Data" element in your document, the
names have to match exactly what is in the document.
--
Björn Höhrmann · mailto:bj****@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
May 2 '07 #2
Yes, I'm using an XMLDataSource. In binding (Client side) I'm using
XPath("...").

I can retrieve the title by doing the following:

XPath("Asset_Metadata/App_Data[@Name = 'Title']/@Value")

However, I only want those titles that fit into another filter.
Namely being a filter that determines the Rating of the title.

So basically I want all the titles a that have the following node:

<App_Data Name="Rating" Value="G" />

Can you do this with XPath?
May 2 '07 #3
al**********@hotmail.com wrote:
Yes, I'm using an XMLDataSource. In binding (Client side) I'm using
XPath("...").

I can retrieve the title by doing the following:

XPath("Asset_Metadata/App_Data[@Name = 'Title']/@Value")

However, I only want those titles that fit into another filter.
Namely being a filter that determines the Rating of the title.

So basically I want all the titles a that have the following node:

<App_Data Name="Rating" Value="G" />
What is the relation between the two App_Data elements? If the next
sibling element should be the App_Data element with Name="Rating" and
Value="G" then you can do e.g.
XPath("Asset_Metadata/App_Data[@Name = 'Title and
following-sibling::*[1][self::AppData and @Name = 'Rating' and @Value =
'G']]/@Value")
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
May 3 '07 #4

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...
0
by: gael.pegliasco | last post by:
Hi, How are you dear and nice helper :) ? I'm trying to test xpath with this simple program : import xml.dom.minidom from xml.xpath.Context import Context import xml.xpath
3
by: Nelson Minar | last post by:
Could someone help me get started using XPath or XQuery in Python? I'm overwhelmed by all the various options and am lacking guidance on what the simplest way to go is. What library do I need to...
13
by: tfsquare | last post by:
All, I am new to XSLT and having some problems understanding the syntax of XPath which selects nodes in the XML document. Consider this bit of XML, which contains three outer XML elements. ...
8
by: Terry P | last post by:
Are there any tools (java classes, tag libraries) which can translate xpath statements into a SQL query? Given an xpath query which has a predicate that filters node values or attributes, I want...
3
by: Kathy Burke | last post by:
Hi again, I'm using the following xpath (works in visualizer) with a SelectSingleNode("xpath") statement. //Station/(WI])]/@order Problem is I get an error "expression passed to this method...
6
by: Chua Wen Ching | last post by:
Hi there, I had this xml file with me (not yet consider implementing xml namespaces yet). <?xml version='1.0'?> <Object> <Windows> <EID>1</EID> <EDesc>Error 1</EDesc> </Windows>
2
by: Locusta | last post by:
Hello, I would like to use XPATH in a C program to retrieve values from XML documents. Did anyone tried this and can give me some advice? Cheers, Locusta
3
by: ziggyware | last post by:
Hi All, I have updated my XPath Generator software: XPath Studio .NET. ( http://www.ziggyware.com/downloads.php?cat_id=2 ) Easily select nodes from an xml file to generate XPath statements ...
2
by: Monty | last post by:
Despite reading posts in Google, I don't understand XPATH. Can someone help me write an XPATH. From Google I think my problem is that the default namespace does not have a prefix. I can't change...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.