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 Charles Guo <ch...@rescentris.com> on 2003/01/13 16:39:11 UTC

XPath_attribute

Hello,

I have encountered a problem that the xpath_query dose NOT take the
attribute with LETTERS but takes ONLY NUMBERS.
Is this a bug?  Is there any way to get arround it?  Thanks for help.


For example:

-------------- Following does NOT work ---------------

<?xml version="1.0"?>
<product id="AB123456">
	<description> test </description>
</product>

>xindice xpath_query -c /../..  -q "/product[@id="AB123456"]"
----------------------------------------------------------


-------------- Following (control) works  ---------------

<?xml version="1.0"?>
<product id="123456">
	<description> test </description>
</product>

>xindice xpath_query -c /../..  -q "/product[@id="123456"]"

------------------------------------------------------------

=== === === === System Info === === === ===
SW: 		Xindice Server (xml-xindice-1.0)
Computer: 	PC
OS: 		Windows 2000 Pro
		Red Hat Linux 7.1

Charles


RE: XPath_attribute

Posted by Charles Guo <ch...@rescentris.com>.
Hi Jeff,
I am sorry for the confusion.  In the email, I did forget to type the double
quotes around the 123456.  In the real query, they are there (“123456”).
The testing result on Linux should be like this:


   Following NOT Work 			Following Works
 ----------------------     	--------------------------

-q //*[@id=”123456”] 		-q //product[@id=”123456”]

-q '//*[@id=”123456”]' 		-q '//product[@id=”123456”]'

-q "//*[@id=”123456”]" 		-q "//product[@id=”123456”]"


Still, the    -q '//*[@id=”123456”]'  does NOT work.

Thanks for your explanation of the quote issue on different platforms.

Charles

-----Original Message-----
From: Jeff Greif [mailto:jgreif@alumni.princeton.edu]
Sent: Tuesday, January 14, 2003 11:28 AM
To: xindice-users@xml.apache.org
Subject: Re: XPath_attribute


You've forgotten to quote the value of @id --- should be @id="123456" or
@id='123456'.  I'm surprised any of the queries worked if they are
transcribed correctly below.

On Linux,  '*' needs to be inside single quotes to prevent interpretation as
a file wildcard by the shell.  On Windows (using the Windows command prompt)
/ needs to be inside double quotes to prevent interpretation as a command
switch.  So on Linux, single quotes are needed on the outside of the query,
with double quotes on the inner values (e.g. attribute values).  On Windows,
it needs to be the other way around.

Jeff
----- Original Message -----
From: "Charles Guo" <ch...@rescentris.com>
To: <xi...@xml.apache.org>
Sent: Tuesday, January 14, 2003 7:37 AM
Subject: RE: XPath_attribute


> Hi  Mark
>
> The single quotes do work on Linux. Thanks for you suggestion.
>
> Still, both single and double quotes have failed on Windows.
>
>
> By the way, do you or anyone else have any idea that why the * does not
work
> on Linux, which is independent of the quote issue?
>
>
>   Following NOT Work Following Works
> ----------------------     --------------------------
>
> -q //*[@id=123456] -q //product[@id=123456]
>
> -q '//*[@id=123456]' -q '//product[@id=123456]'
>
> -q "//*[@id=123456]" -q "//product[@id=123456]"
>
> This is an important query for retrieving selected element(s).  I need
help
> badly.
>
>
> Charles
>
> -----Original Message-----
> From: Mark J. Stang [mailto:markstang@earthlink.net]
> Sent: Monday, January 13, 2003 6:31 PM
> To: xindice-users@xml.apache.org
> Subject: Re: XPath_attribute
>
>
> Use single quotes.
>
> >xindice xpath_query -c /../..  -q "/product[@id='AB123456']"
>
>
> Charles Guo wrote:
>
> > Hello,
> >
> > I have encountered a problem that the xpath_query dose NOT take the
> > attribute with LETTERS but takes ONLY NUMBERS.
> > Is this a bug?  Is there any way to get arround it?  Thanks for help.
> >
> > For example:
> >
> > -------------- Following does NOT work ---------------
> >
> > <?xml version="1.0"?>
> > <product id="AB123456">
> >         <description> test </description>
> > </product>
> >
> > >xindice xpath_query -c /../..  -q "/product[@id="AB123456"]"
> > ----------------------------------------------------------
> >
> > -------------- Following (control) works  ---------------
> >
> > <?xml version="1.0"?>
> > <product id="123456">
> >         <description> test </description>
> > </product>
> >
> > >xindice xpath_query -c /../..  -q "/product[@id="123456"]"
> >
> > ------------------------------------------------------------
> >
> > === === === === System Info === === === ===
> > SW:             Xindice Server (xml-xindice-1.0)
> > Computer:       PC
> > OS:             Windows 2000 Pro
> >                 Red Hat Linux 7.1
> >
> > Charles
>
> --
> Mark J Stang
> System Architect
> Cybershop Systems
>
>
>


Re: XPath_attribute

Posted by Jeff Greif <jg...@alumni.princeton.edu>.
You've forgotten to quote the value of @id --- should be @id="123456" or
@id='123456'.  I'm surprised any of the queries worked if they are
transcribed correctly below.

On Linux,  '*' needs to be inside single quotes to prevent interpretation as
a file wildcard by the shell.  On Windows (using the Windows command prompt)
/ needs to be inside double quotes to prevent interpretation as a command
switch.  So on Linux, single quotes are needed on the outside of the query,
with double quotes on the inner values (e.g. attribute values).  On Windows,
it needs to be the other way around.

Jeff
----- Original Message -----
From: "Charles Guo" <ch...@rescentris.com>
To: <xi...@xml.apache.org>
Sent: Tuesday, January 14, 2003 7:37 AM
Subject: RE: XPath_attribute


> Hi  Mark
>
> The single quotes do work on Linux. Thanks for you suggestion.
>
> Still, both single and double quotes have failed on Windows.
>
>
> By the way, do you or anyone else have any idea that why the * does not
work
> on Linux, which is independent of the quote issue?
>
>
>   Following NOT Work Following Works
> ----------------------     --------------------------
>
> -q //*[@id=123456] -q //product[@id=123456]
>
> -q '//*[@id=123456]' -q '//product[@id=123456]'
>
> -q "//*[@id=123456]" -q "//product[@id=123456]"
>
> This is an important query for retrieving selected element(s).  I need
help
> badly.
>
>
> Charles
>
> -----Original Message-----
> From: Mark J. Stang [mailto:markstang@earthlink.net]
> Sent: Monday, January 13, 2003 6:31 PM
> To: xindice-users@xml.apache.org
> Subject: Re: XPath_attribute
>
>
> Use single quotes.
>
> >xindice xpath_query -c /../..  -q "/product[@id='AB123456']"
>
>
> Charles Guo wrote:
>
> > Hello,
> >
> > I have encountered a problem that the xpath_query dose NOT take the
> > attribute with LETTERS but takes ONLY NUMBERS.
> > Is this a bug?  Is there any way to get arround it?  Thanks for help.
> >
> > For example:
> >
> > -------------- Following does NOT work ---------------
> >
> > <?xml version="1.0"?>
> > <product id="AB123456">
> >         <description> test </description>
> > </product>
> >
> > >xindice xpath_query -c /../..  -q "/product[@id="AB123456"]"
> > ----------------------------------------------------------
> >
> > -------------- Following (control) works  ---------------
> >
> > <?xml version="1.0"?>
> > <product id="123456">
> >         <description> test </description>
> > </product>
> >
> > >xindice xpath_query -c /../..  -q "/product[@id="123456"]"
> >
> > ------------------------------------------------------------
> >
> > === === === === System Info === === === ===
> > SW:             Xindice Server (xml-xindice-1.0)
> > Computer:       PC
> > OS:             Windows 2000 Pro
> >                 Red Hat Linux 7.1
> >
> > Charles
>
> --
> Mark J Stang
> System Architect
> Cybershop Systems
>
>
>


RE: XPath_attribute

Posted by Charles Guo <ch...@rescentris.com>.
Hi  Mark

The single quotes do work on Linux. Thanks for you suggestion.

Still, both single and double quotes have failed on Windows.


By the way, do you or anyone else have any idea that why the * does not work
on Linux, which is independent of the quote issue?


	  Following NOT Work			Following Works
	----------------------     	--------------------------

	-q //*[@id=123456]		-q //product[@id=123456]

	-q '//*[@id=123456]'		-q '//product[@id=123456]'

	-q "//*[@id=123456]"		-q "//product[@id=123456]"

This is an important query for retrieving selected element(s).  I need help
badly.


Charles

-----Original Message-----
From: Mark J. Stang [mailto:markstang@earthlink.net]
Sent: Monday, January 13, 2003 6:31 PM
To: xindice-users@xml.apache.org
Subject: Re: XPath_attribute


Use single quotes.

>xindice xpath_query -c /../..  -q "/product[@id='AB123456']"


Charles Guo wrote:

> Hello,
>
> I have encountered a problem that the xpath_query dose NOT take the
> attribute with LETTERS but takes ONLY NUMBERS.
> Is this a bug?  Is there any way to get arround it?  Thanks for help.
>
> For example:
>
> -------------- Following does NOT work ---------------
>
> <?xml version="1.0"?>
> <product id="AB123456">
>         <description> test </description>
> </product>
>
> >xindice xpath_query -c /../..  -q "/product[@id="AB123456"]"
> ----------------------------------------------------------
>
> -------------- Following (control) works  ---------------
>
> <?xml version="1.0"?>
> <product id="123456">
>         <description> test </description>
> </product>
>
> >xindice xpath_query -c /../..  -q "/product[@id="123456"]"
>
> ------------------------------------------------------------
>
> === === === === System Info === === === ===
> SW:             Xindice Server (xml-xindice-1.0)
> Computer:       PC
> OS:             Windows 2000 Pro
>                 Red Hat Linux 7.1
>
> Charles

--
Mark J Stang
System Architect
Cybershop Systems



Re: XPath_attribute

Posted by "Mark J. Stang" <ma...@earthlink.net>.
Use single quotes.

>xindice xpath_query -c /../..  -q "/product[@id='AB123456']"


Charles Guo wrote:

> Hello,
>
> I have encountered a problem that the xpath_query dose NOT take the
> attribute with LETTERS but takes ONLY NUMBERS.
> Is this a bug?  Is there any way to get arround it?  Thanks for help.
>
> For example:
>
> -------------- Following does NOT work ---------------
>
> <?xml version="1.0"?>
> <product id="AB123456">
>         <description> test </description>
> </product>
>
> >xindice xpath_query -c /../..  -q "/product[@id="AB123456"]"
> ----------------------------------------------------------
>
> -------------- Following (control) works  ---------------
>
> <?xml version="1.0"?>
> <product id="123456">
>         <description> test </description>
> </product>
>
> >xindice xpath_query -c /../..  -q "/product[@id="123456"]"
>
> ------------------------------------------------------------
>
> === === === === System Info === === === ===
> SW:             Xindice Server (xml-xindice-1.0)
> Computer:       PC
> OS:             Windows 2000 Pro
>                 Red Hat Linux 7.1
>
> Charles

--
Mark J Stang
System Architect
Cybershop Systems