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 B George <mr...@bigfoot.com> on 2002/10/25 21:18:15 UTC

Xpath again

Hello all,
XPath query under windows XP from command prompt.
 
Using all the syntax variations I can think of I am trying to search
based on matching the value of an attribute, but all return to command
prompt without returning any results. 
 
I get same results when trying to query from a Java program.
 
Syntax(s) used (want to retrive all <spp> nodes where the name attrib is
'bonariensis':
            Xindice xpath -c /db/sppdata -q //spp[@="bonariensis"]
            Xindice xpath -c /db/sppdata -q "//spp[@='bonariensis']"
<-- throws error about '==' not expected
            Xindice xpath -c /db/sppdata -q //spp[@='bonariensis']
 
I can however search for all instances of the <spp> node which returns
successfully the correct data.
 
I am using xindice v1.0 and JDK 1.4
 
Any help/suggestions much appreciated
Ben


Re: Xpath again

Posted by "Mark J. Stang" <ma...@earthlink.net>.
Try this, if you haven't:

I believe that v1.4 includes the "crimson" parser.  you can specify the location
of *.jar to use before the system libs with:

        -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%"

where JAVA_ENDORSED_DIRS is the location of Xerces, Xalan, etc.

Jeff Greif wrote:

> If you're running JDK 1.4, then you might have more than one XML parser and
> XSLT or XPath processor in your class path (one coming built in to JDK 1.4).
> I think Xindice only works with an older parser like Xerces 1.4.4.  Check
> the archives of this mailing list to see how to handle this problem.
> Jeff
> ----- Original Message -----
> From: "B George" <mr...@bigfoot.com>
> To: <xi...@xml.apache.org>
> Sent: Monday, October 28, 2002 12:54 AM
> Subject: RE: Xpath again
>
> > Having created the document as outlined in Jeff's message below I get
> > the following output :
> >
> > C:\Xindice>xindice xpath -c /db/test -q "//spp[@name='bonariensis']"
> > ='bonariensis']""=="" was unexpected at this time.
> >
> > C:\Xindice>xindice xpath -c /db/test -q //spp[@name='bonariensis']
> > C:\Xindice>
> >
> > I know this document exists, only thing left to explore is errors in my
> > config. Atm the config has not been changed from the v1.0 install. Using
> > JDK/JRE 1.4, any compatability issues?
> >
> > Thanks
> > Ben
> >
> >
> > -----Original Message-----
> > From: Jeff Greif [mailto:jgreif@alumni.princeton.edu]
> > Sent: 26 October 2002 18:12
> > To: xindice-users@xml.apache.org; mrteacherman@bigfoot.com
> > Subject: Re: Xpath again
> >
> > With this document:
> >
> > <?xml version="1.0" ?>
> > <plant>
> >   <genus>xyz</genus>
> >   <spp name='bonariensis'/>
> > </plant>
> >
> > entered in the collection /db/junk, I get:
> >
> > $  xindice ad -c /db/junk -f c:/cygwin/home/jgreif/expt/sppdata.xml -n
> > plant123
> > Added document /db/junk/plant123
> >
> > $  xindice xpath -c /db/junk -q "//spp[@name='bonariensis']"
> > <?xml version="1.0"?>
> > <spp name="bonariensis" xmlns:src="http://xml.apache.org/xindice/Query"
> > src:col="/db/junk" src:key="plant123" />
> >
> > This works using a modified version of the supplied xindice scripts in
> > order
> > to run in a cygwin bash shell on windows, or using the regular version
> > of
> > xindice.bat to run in a Windows command shell.
> >
> > Jeff
> >
> >
> > ----- Original Message -----
> > From: "B George" <mr...@bigfoot.com>
> > To: <xi...@xml.apache.org>
> > Sent: Saturday, October 26, 2002 9:27 AM
> > Subject: RE: Xpath again
> >
> >
> > > Thanks for feedback.
> > > The query syntax you show is what was generating the following
> > error...
> > >
> > > C:\Xindice>Xindice xpath -c /db/sppdata -q
> > > //spp[@name='bonariensis']"
> > > ='bonariensis']""=="" was unexpected at this time.
> > >
> > > What does this mean? I recall someone else mentioning this in passing
> > in
> > > the (xindice-users@xml.apache.org) archives but no apparent
> > explanation.
> > >
> > > Ben
> > >
> > > -----Original Message-----
> > > From: Jeff Greif [mailto:jgreif@alumni.princeton.edu]
> > > Sent: 26 October 2002 02:12
> > > To: xindice-users@xml.apache.org; mrteacherman@bigfoot.com
> > > Subject: Re: Xpath again
> > >
> > > If the name of the attribute were 'foo', this should work
> > > Xindice xpath -c /db/sppdata -q "//spp[@foo='bonariensis']"
> > > to find the spp element in
> > >     <x><y><z><spp foo='bonariensis'/></z></y/</x>
> >
> >
> >

--
Mark J Stang
System Architect
Cybershop Systems


Re: Xpath again

Posted by Jeff Greif <jg...@alumni.princeton.edu>.
If you're running JDK 1.4, then you might have more than one XML parser and
XSLT or XPath processor in your class path (one coming built in to JDK 1.4).
I think Xindice only works with an older parser like Xerces 1.4.4.  Check
the archives of this mailing list to see how to handle this problem.
Jeff
----- Original Message -----
From: "B George" <mr...@bigfoot.com>
To: <xi...@xml.apache.org>
Sent: Monday, October 28, 2002 12:54 AM
Subject: RE: Xpath again


> Having created the document as outlined in Jeff's message below I get
> the following output :
>
> C:\Xindice>xindice xpath -c /db/test -q "//spp[@name='bonariensis']"
> ='bonariensis']""=="" was unexpected at this time.
>
> C:\Xindice>xindice xpath -c /db/test -q //spp[@name='bonariensis']
> C:\Xindice>
>
> I know this document exists, only thing left to explore is errors in my
> config. Atm the config has not been changed from the v1.0 install. Using
> JDK/JRE 1.4, any compatability issues?
>
> Thanks
> Ben
>
>
> -----Original Message-----
> From: Jeff Greif [mailto:jgreif@alumni.princeton.edu]
> Sent: 26 October 2002 18:12
> To: xindice-users@xml.apache.org; mrteacherman@bigfoot.com
> Subject: Re: Xpath again
>
> With this document:
>
> <?xml version="1.0" ?>
> <plant>
>   <genus>xyz</genus>
>   <spp name='bonariensis'/>
> </plant>
>
> entered in the collection /db/junk, I get:
>
> $  xindice ad -c /db/junk -f c:/cygwin/home/jgreif/expt/sppdata.xml -n
> plant123
> Added document /db/junk/plant123
>
> $  xindice xpath -c /db/junk -q "//spp[@name='bonariensis']"
> <?xml version="1.0"?>
> <spp name="bonariensis" xmlns:src="http://xml.apache.org/xindice/Query"
> src:col="/db/junk" src:key="plant123" />
>
> This works using a modified version of the supplied xindice scripts in
> order
> to run in a cygwin bash shell on windows, or using the regular version
> of
> xindice.bat to run in a Windows command shell.
>
> Jeff
>
>
> ----- Original Message -----
> From: "B George" <mr...@bigfoot.com>
> To: <xi...@xml.apache.org>
> Sent: Saturday, October 26, 2002 9:27 AM
> Subject: RE: Xpath again
>
>
> > Thanks for feedback.
> > The query syntax you show is what was generating the following
> error...
> >
> > C:\Xindice>Xindice xpath -c /db/sppdata -q
> > //spp[@name='bonariensis']"
> > ='bonariensis']""=="" was unexpected at this time.
> >
> > What does this mean? I recall someone else mentioning this in passing
> in
> > the (xindice-users@xml.apache.org) archives but no apparent
> explanation.
> >
> > Ben
> >
> > -----Original Message-----
> > From: Jeff Greif [mailto:jgreif@alumni.princeton.edu]
> > Sent: 26 October 2002 02:12
> > To: xindice-users@xml.apache.org; mrteacherman@bigfoot.com
> > Subject: Re: Xpath again
> >
> > If the name of the attribute were 'foo', this should work
> > Xindice xpath -c /db/sppdata -q "//spp[@foo='bonariensis']"
> > to find the spp element in
> >     <x><y><z><spp foo='bonariensis'/></z></y/</x>
>
>
>


RE: Xpath again

Posted by B George <mr...@bigfoot.com>.
Having created the document as outlined in Jeff's message below I get
the following output :

C:\Xindice>xindice xpath -c /db/test -q "//spp[@name='bonariensis']"
='bonariensis']""=="" was unexpected at this time.

C:\Xindice>xindice xpath -c /db/test -q //spp[@name='bonariensis']
C:\Xindice>

I know this document exists, only thing left to explore is errors in my
config. Atm the config has not been changed from the v1.0 install. Using
JDK/JRE 1.4, any compatability issues?

Thanks
Ben


-----Original Message-----
From: Jeff Greif [mailto:jgreif@alumni.princeton.edu] 
Sent: 26 October 2002 18:12
To: xindice-users@xml.apache.org; mrteacherman@bigfoot.com
Subject: Re: Xpath again

With this document:

<?xml version="1.0" ?>
<plant>
  <genus>xyz</genus>
  <spp name='bonariensis'/>
</plant>

entered in the collection /db/junk, I get:

$  xindice ad -c /db/junk -f c:/cygwin/home/jgreif/expt/sppdata.xml -n
plant123
Added document /db/junk/plant123

$  xindice xpath -c /db/junk -q "//spp[@name='bonariensis']"
<?xml version="1.0"?>
<spp name="bonariensis" xmlns:src="http://xml.apache.org/xindice/Query"
src:col="/db/junk" src:key="plant123" />

This works using a modified version of the supplied xindice scripts in
order
to run in a cygwin bash shell on windows, or using the regular version
of
xindice.bat to run in a Windows command shell.

Jeff


----- Original Message -----
From: "B George" <mr...@bigfoot.com>
To: <xi...@xml.apache.org>
Sent: Saturday, October 26, 2002 9:27 AM
Subject: RE: Xpath again


> Thanks for feedback.
> The query syntax you show is what was generating the following
error...
>
> C:\Xindice>Xindice xpath -c /db/sppdata -q
> //spp[@name='bonariensis']"
> ='bonariensis']""=="" was unexpected at this time.
>
> What does this mean? I recall someone else mentioning this in passing
in
> the (xindice-users@xml.apache.org) archives but no apparent
explanation.
>
> Ben
>
> -----Original Message-----
> From: Jeff Greif [mailto:jgreif@alumni.princeton.edu]
> Sent: 26 October 2002 02:12
> To: xindice-users@xml.apache.org; mrteacherman@bigfoot.com
> Subject: Re: Xpath again
>
> If the name of the attribute were 'foo', this should work
> Xindice xpath -c /db/sppdata -q "//spp[@foo='bonariensis']"
> to find the spp element in
>     <x><y><z><spp foo='bonariensis'/></z></y/</x>


Re: Xpath again

Posted by Jeff Greif <jg...@alumni.princeton.edu>.
With this document:

<?xml version="1.0" ?>
<plant>
  <genus>xyz</genus>
  <spp name='bonariensis'/>
</plant>

entered in the collection /db/junk, I get:

$  xindice ad -c /db/junk -f c:/cygwin/home/jgreif/expt/sppdata.xml -n
plant123
Added document /db/junk/plant123

$  xindice xpath -c /db/junk -q "//spp[@name='bonariensis']"
<?xml version="1.0"?>
<spp name="bonariensis" xmlns:src="http://xml.apache.org/xindice/Query"
src:col="/db/junk" src:key="plant123" />

This works using a modified version of the supplied xindice scripts in order
to run in a cygwin bash shell on windows, or using the regular version of
xindice.bat to run in a Windows command shell.

Jeff


----- Original Message -----
From: "B George" <mr...@bigfoot.com>
To: <xi...@xml.apache.org>
Sent: Saturday, October 26, 2002 9:27 AM
Subject: RE: Xpath again


> Thanks for feedback.
> The query syntax you show is what was generating the following error...
>
> C:\Xindice>Xindice xpath -c /db/sppdata -q
> //spp[@name='bonariensis']"
> ='bonariensis']""=="" was unexpected at this time.
>
> What does this mean? I recall someone else mentioning this in passing in
> the (xindice-users@xml.apache.org) archives but no apparent explanation.
>
> Ben
>
> -----Original Message-----
> From: Jeff Greif [mailto:jgreif@alumni.princeton.edu]
> Sent: 26 October 2002 02:12
> To: xindice-users@xml.apache.org; mrteacherman@bigfoot.com
> Subject: Re: Xpath again
>
> If the name of the attribute were 'foo', this should work
> Xindice xpath -c /db/sppdata -q "//spp[@foo='bonariensis']"
> to find the spp element in
>     <x><y><z><spp foo='bonariensis'/></z></y/</x>


Re: Xpath again

Posted by Matthew Van Horn <ho...@accesstech.com>.
I think you may have to escape the quotes (for your shell) if entering 
this query from the command line.


On Sunday, October 27, 2002, at 01:27 AM, B George wrote:

> Thanks for feedback.
> The query syntax you show is what was generating the following error...
>
> 	C:\Xindice>Xindice xpath -c /db/sppdata -q
> //spp[@name='bonariensis']"
> 	='bonariensis']""=="" was unexpected at this time.
>
> What does this mean? I recall someone else mentioning this in passing 
> in
> the (xindice-users@xml.apache.org) archives but no apparent 
> explanation.
>
> Ben
>
> -----Original Message-----
> From: Jeff Greif [mailto:jgreif@alumni.princeton.edu]
> Sent: 26 October 2002 02:12
> To: xindice-users@xml.apache.org; mrteacherman@bigfoot.com
> Subject: Re: Xpath again
>
> If the name of the attribute were 'foo', this should work
> Xindice xpath -c /db/sppdata -q "//spp[@foo='bonariensis']"
> to find the spp element in
>     <x><y><z><spp foo='bonariensis'/></z></y/</x>
>
> Jeff
>
> ----- Original Message -----
> From: "B George" <mr...@bigfoot.com>
> To: <xi...@xml.apache.org>
> Sent: Friday, October 25, 2002 12:18 PM
> Subject: Xpath again
>
>
>> Hello all,
>> XPath query under windows XP from command prompt.
>>
>> Using all the syntax variations I can think of I am trying to search
>> based on matching the value of an attribute, but all return to command
>> prompt without returning any results.
>>
>> I get same results when trying to query from a Java program.
>>
>> Syntax(s) used (want to retrive all <spp> nodes where the name attrib
> is
>> 'bonariensis':
>>             Xindice xpath -c /db/sppdata -q //spp[@="bonariensis"]
>>             Xindice xpath -c /db/sppdata -q "//spp[@='bonariensis']"
>> <-- throws error about '==' not expected
>>             Xindice xpath -c /db/sppdata -q //spp[@='bonariensis']
>>
>> I can however search for all instances of the <spp> node which returns
>> successfully the correct data.
>>
>> I am using xindice v1.0 and JDK 1.4
>>
>> Any help/suggestions much appreciated
>> Ben
>>
>>
>>
>


RE: Xpath again

Posted by B George <mr...@bigfoot.com>.
Thanks for feedback.
The query syntax you show is what was generating the following error...

	C:\Xindice>Xindice xpath -c /db/sppdata -q
//spp[@name='bonariensis']"
	='bonariensis']""=="" was unexpected at this time.

What does this mean? I recall someone else mentioning this in passing in
the (xindice-users@xml.apache.org) archives but no apparent explanation.

Ben

-----Original Message-----
From: Jeff Greif [mailto:jgreif@alumni.princeton.edu] 
Sent: 26 October 2002 02:12
To: xindice-users@xml.apache.org; mrteacherman@bigfoot.com
Subject: Re: Xpath again

If the name of the attribute were 'foo', this should work
Xindice xpath -c /db/sppdata -q "//spp[@foo='bonariensis']"
to find the spp element in 
    <x><y><z><spp foo='bonariensis'/></z></y/</x>

Jeff

----- Original Message ----- 
From: "B George" <mr...@bigfoot.com>
To: <xi...@xml.apache.org>
Sent: Friday, October 25, 2002 12:18 PM
Subject: Xpath again


> Hello all,
> XPath query under windows XP from command prompt.
>  
> Using all the syntax variations I can think of I am trying to search
> based on matching the value of an attribute, but all return to command
> prompt without returning any results. 
>  
> I get same results when trying to query from a Java program.
>  
> Syntax(s) used (want to retrive all <spp> nodes where the name attrib
is
> 'bonariensis':
>             Xindice xpath -c /db/sppdata -q //spp[@="bonariensis"]
>             Xindice xpath -c /db/sppdata -q "//spp[@='bonariensis']"
> <-- throws error about '==' not expected
>             Xindice xpath -c /db/sppdata -q //spp[@='bonariensis']
>  
> I can however search for all instances of the <spp> node which returns
> successfully the correct data.
>  
> I am using xindice v1.0 and JDK 1.4
>  
> Any help/suggestions much appreciated
> Ben
> 
> 
> 


Re: Xpath again

Posted by Jeff Greif <jg...@alumni.princeton.edu>.
If the name of the attribute were 'foo', this should work
Xindice xpath -c /db/sppdata -q "//spp[@foo='bonariensis']"
to find the spp element in 
    <x><y><z><spp foo='bonariensis'/></z></y/</x>

Jeff

----- Original Message ----- 
From: "B George" <mr...@bigfoot.com>
To: <xi...@xml.apache.org>
Sent: Friday, October 25, 2002 12:18 PM
Subject: Xpath again


> Hello all,
> XPath query under windows XP from command prompt.
>  
> Using all the syntax variations I can think of I am trying to search
> based on matching the value of an attribute, but all return to command
> prompt without returning any results. 
>  
> I get same results when trying to query from a Java program.
>  
> Syntax(s) used (want to retrive all <spp> nodes where the name attrib is
> 'bonariensis':
>             Xindice xpath -c /db/sppdata -q //spp[@="bonariensis"]
>             Xindice xpath -c /db/sppdata -q "//spp[@='bonariensis']"
> <-- throws error about '==' not expected
>             Xindice xpath -c /db/sppdata -q //spp[@='bonariensis']
>  
> I can however search for all instances of the <spp> node which returns
> successfully the correct data.
>  
> I am using xindice v1.0 and JDK 1.4
>  
> Any help/suggestions much appreciated
> Ben
> 
> 
>