Hello everyone,
I've been reading through a bunch of XPath tutorials and am
confused by a couple items. First, is it possible to have multiple
predicates in my XPath statement. For example, the following xpath
statement: "//AAA/BBB[@name="b1"]/c[c=6]" should only return the last
<c> node containing the 6, correct? Also consider the statement
"//AAA/BBB[@name="b1" or @name="b2"]" returns the first two <BBB>
items, correct? the and's and or's in the predicates are all right yes?
Does JAXEN support these kind of queries?
<AAA>
<BBB name = "b1">
<c>4</c>
</BBB>
<BBB name = "b2">
<c>5</c>
</BBB>
<BBB name = "b1">
<c>6</c>
</BBB>
</AAA>
Also, I read that the "|" operator will combine the results of several
xpath queries. I understand that it will append the results into one
big list... Is there any way to preform logical AND's OR's and NOT's on
the results of each query and have it combine into one big list?
(Instead of a simple append)
Thanks everyone 4 2138
Hi, I've been reading through a bunch of XPath tutorials and am confused by a couple items. First, is it possible to have multiple predicates in my XPath statement.
AFAIK, perfectly possible For example, the following xpath statement: "//AAA/BBB[@name="b1"]/c[c=6]" should only return the last <c> node containing the 6, correct?
Almost. write that as <xsl:value-of select="//AAA/BBB[@name='b1']/c[.=6]"/>
Mark the two types of quotes and the '.' in stead of 'c'
Also consider the statement "//AAA/BBB[@name="b1" or @name="b2"]" returns the first two <BBB> items, correct? the and's and or's in the predicates are all right yes?
Yes, (but mind the quotes)
Does JAXEN support these kind of queries?
I have no idea.
<AAA> <BBB name = "b1"> <c>4</c> </BBB> <BBB name = "b2"> <c>5</c> </BBB> <BBB name = "b1">
Is suppose that should be 'b3' <c>6</c> </BBB> </AAA>
Also, I read that the "|" operator will combine the results of several xpath queries. I understand that it will append the results into one big list... Is there any way to preform logical AND's OR's and NOT's on the results of each query and have it combine into one big list? (Instead of a simple append)
Only if you use XPath2.0 or extension functions.
regards,
--
Joris Gillis ( http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Veni, vidi, wiki ( http://www.wikipedia.org)
Also, I read that the "|" operator will combine the results of several
xpath queries. I understand that it will append the results into one
big list... Is there any way to preform logical AND's OR's and NOT's on
the results of each query and have it combine into one big list?
(Instead of a simple append)
No, XPath 1 doesn't have lists, only sets (which are unordered) and | is
set-union not append, so if $a is a variable holding a node then $a | $a
is just one copy of the node in $a, not two. so | is not at all like a
list append.
David
David Carlisle wrote: Also, I read that the "|" operator will combine the results of
several xpath queries. I understand that it will append the results into
one big list... Is there any way to preform logical AND's OR's and
NOT's on the results of each query and have it combine into one big list? (Instead of a simple append)
No, XPath 1 doesn't have lists, only sets (which are unordered) and |
is set-union not append, so if $a is a variable holding a node then $a |
$a is just one copy of the node in $a, not two. so | is not at all like
a list append.
David
The set-union that you are talking about... is that the equivilent of a
logical AND between those two sets?
Thanks gf******@hotmail.com writes: David Carlisle wrote:
The set-union that you are talking about... is that the equivilent of a logical AND between those two sets?
Thanks
Not sure what you mean. There are some basic operations that apply to
sets, union and intersection being the main ones. Logical operations
don't naturally apply to sets. There are of course various ways to map
logical operations into set ones, union can be read as and or or
depending on the circumstances.
<xsl:template match="foo|bar">
that template matches any element that is foo OR bar
or you could say
that template matches foo elements AND bar elements
David This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
by: gfrommer |
last post by:
Hello Everyone,
I'm writing a server in java, and I want the clients to pass me an
XPath query. I want the XPath queries to be in a specific format
though, I'm pretty sure it's valid but I want...
|
by: Brad Hehe |
last post by:
I am attempting to use XPath to query for a specific node
in the sample XML I've provided below.
I'm unsure of the exact XPath syntax, but I believe I
need the following query to get the proper...
|
by: chris.millar |
last post by:
The below xml is saved as a file, i want the quickest way in c# of reading just the DataSource section and returning it as a string, can anyone help me out.
Cheers
Chris.
<NewDataSet>...
|
by: Arthur Dzhelali |
last post by:
I have a two xml files schema is identical.
When I read file into dataset and then bind dataset to the form.
These are weather files we are getting from weather service.
One file has only...
|
by: Gerrit |
last post by:
It must be simple, but I don't find how I can read a XmlFile in an
ArrayList.
Sample of my XmlFile:
<?xml version="1.0" encoding="utf-8" ?>
<Relations>
<Person>
<FirstName>John</FirstName>...
|
by: Jason Mobarak |
last post by:
Hello --
I'm attempting to get a handle on how to do xpath queries with
System.Xml -- so far the biggest hurdle has been how to deal with a
default namespace. If I use the test xml:
<?xml...
|
by: =?Utf-8?B?RGlmZmlkZW50?= |
last post by:
Hello All,
I am trying to construct an XPath query against an XML document, for a
requirement that I have. Below is the XML fragment:
<SUBMISSIONS>
<SUBMISSION YEAR="2004">
<MONTH...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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
|
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...
|
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...
| |