You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by "calfi@inwind.it" <ca...@inwind.it> on 2003/04/05 12:15:46 UTC
xpath problem
Hi all,
sorry for my bad english.
I have some problems with xpath queries. I have the file xml:
<?xml version="1.0"?>
<person>
<fname>John</fname>
<lname>Smith</lname>
<age>30</age>
</person>
the following query:
"/person[age>20]"
gives me the message: >was unexpected at this time.
the same problem whith
"/person[fname='John']and[lname='Smith']"
the message is: and was unexpected at this time
Can you help me?
T.I.A
Carmen
Re: xpath problem
Posted by jmt2 <jm...@dxdydz.net>.
Use > in lieu of >
and < in lieu of <
because your query MUST comply with xml notations.
calfi@inwind.it wrote:
>Hi all,
>sorry for my bad english.
>I have some problems with xpath queries. I have the file xml:
>
><?xml version="1.0"?>
><person>
> <fname>John</fname>
> <lname>Smith</lname>
> <age>30</age>
></person>
>
>the following query:
>
>"/person[age>20]"
>
>gives me the message: >was unexpected at this time.
>
>the same problem whith
>
>"/person[fname='John']and[lname='Smith']"
>
>the message is: and was unexpected at this time
>
>
>Can you help me?
>
>T.I.A
>
>Carmen
>
>
>
>
>
Re: xpath for NOT Operator
Posted by Richard Light <ri...@light.demon.co.uk>.
In message <00...@THEBEAST>, Paul Brown
<pj...@cs.nott.ac.uk> writes
>>>Also is there any XPath that allows you to carry out phrase searching,
>
>>>or word searches?
>
>>You have the contains() and starts-with() functions.
>
>Is there a way to make contains() case insensitive?
It's not pretty, and I'm sure it wouldn't be efficient in a searching
context, but there is the translate() function:
... contains(translate(text(), 'abcdefghijklmnopqrstuvwxyz',
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 'SEARCHSTRING') ...
Richard Light
--
Richard Light
SGML/XML and Museum Information Consultancy
richard@light.demon.co.uk
RE: xpath for NOT Operator
Posted by Paul Brown <pj...@cs.nott.ac.uk>.
>>Also is there any XPath that allows you to carry out phrase searching,
>>or word searches?
>You have the contains() and starts-with() functions.
Is there a way to make contains() case insensitive?
Paul
-----Original Message-----
From: Richard Light [mailto:richard@light.demon.co.uk]
Sent: 05 April 2003 13:03
To: xindice-users@xml.apache.org
Subject: Re: xpath for NOT Operator
In message <10...@webmail.brad.ac.uk>, Gul Akbar
<G....@Bradford.ac.uk> writes
>
>Hi,
>Can you perform a query with the boolean NOT operator? can anyuone give
>me examples. I have the query:
> //mets [ /mets/agent/name='Gul Akbar' NOT /mets/role='Administrator' ]
Check out the XPath standard: it isn't a secret! :-
http://www.w3.org/TR/xpath
I think your example query would have more luck if re-phrased thus:
//mets[agent/name='Gul Akbar' and not(role='Administrator')]
>Also is there any XPath that allows you to carry out phrase searching,
>or word searches?
You have the contains() and starts-with() functions.
Richard Light
--
Richard Light
SGML/XML and Museum Information Consultancy richard@light.demon.co.uk
Re: xpath for NOT Operator
Posted by Richard Light <ri...@light.demon.co.uk>.
In message <10...@webmail.brad.ac.uk>, Gul Akbar
<G....@Bradford.ac.uk> writes
>
>Hi,
>Can you perform a query with the boolean NOT operator? can anyuone give me
>examples.
>I have the query:
> //mets [ /mets/agent/name='Gul Akbar' NOT /mets/role='Administrator' ]
Check out the XPath standard: it isn't a secret! :-
http://www.w3.org/TR/xpath
I think your example query would have more luck if re-phrased thus:
//mets[agent/name='Gul Akbar' and not(role='Administrator')]
>Also is there any XPath that allows you to carry out phrase searching, or word
>searches?
You have the contains() and starts-with() functions.
Richard Light
--
Richard Light
SGML/XML and Museum Information Consultancy
richard@light.demon.co.uk
xpath for NOT Operator
Posted by Gul Akbar <G....@Bradford.ac.uk>.
Hi,
Can you perform a query with the boolean NOT operator? can anyuone give me
examples.
I have the query:
//mets [ /mets/agent/name='Gul Akbar' NOT /mets/role='Administrator' ]
Also is there any XPath that allows you to carry out phrase searching, or word
searches?
Thanks in advance
Gul Akbar
-------------------------------------------------
This mail sent through IMP: webmail.brad.ac.uk