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 Dominic Gamble <do...@advancen.com> on 2003/05/16 09:20:09 UTC

HELP?: Long xpath queries dont work!

I have some code which generates some long xpath queries - longer than
1024 characaters, and they return null results.

Is this the actual limit? Is there any way around this? Why is it so?
Xupdate queries are fine and they are longer than 1024 characters.

If anyone can help here it would be much appreciated.

I'm using xindice 1.0

Regards,
Dominic Gamble.



Re: HELP?: Long xpath queries dont work!

Posted by Dominic Gamble <do...@advancen.com>.
[I've posted this to dev also so someone can check whether this is a bug
and needs fixing]

Well, I know no-one responded so I delved into the source code and found
that its not a limit on the number of characters, but a limit on the
number of keys

eg.

"/Item[@id='1' or @id='1' or @id='1' {..etc...}]

will fail once you add enough keys (@id='1') to it.

I found another solution. The following xpath query will return the same
results, but seems not to have a restriction on the number of keys:

"/Item[contains('p1p1p1p1p1p',concat('p',@id,'p'))]

note that p is used as a delimiter here, you could choose to use
anything.

I hope this helps someone!

Dominic Gamble.

On Fri, 2003-05-16 at 17:20, Dominic Gamble wrote:
> I have some code which generates some long xpath queries - longer than
> 1024 characaters, and they return null results.
> 
> Is this the actual limit? Is there any way around this? Why is it so?
> Xupdate queries are fine and they are longer than 1024 characters.
> 
> If anyone can help here it would be much appreciated.
> 
> I'm using xindice 1.0
> 
> Regards,
> Dominic Gamble.
> 
> 



Re: HELP?: Long xpath queries dont work!

Posted by Dominic Gamble <do...@advancen.com>.
[I've posted this to dev also so someone can check whether this is a bug
and needs fixing]

Well, I know no-one responded so I delved into the source code and found
that its not a limit on the number of characters, but a limit on the
number of keys

eg.

"/Item[@id='1' or @id='1' or @id='1' {..etc...}]

will fail once you add enough keys (@id='1') to it.

I found another solution. The following xpath query will return the same
results, but seems not to have a restriction on the number of keys:

"/Item[contains('p1p1p1p1p1p',concat('p',@id,'p'))]

note that p is used as a delimiter here, you could choose to use
anything.

I hope this helps someone!

Dominic Gamble.

On Fri, 2003-05-16 at 17:20, Dominic Gamble wrote:
> I have some code which generates some long xpath queries - longer than
> 1024 characaters, and they return null results.
> 
> Is this the actual limit? Is there any way around this? Why is it so?
> Xupdate queries are fine and they are longer than 1024 characters.
> 
> If anyone can help here it would be much appreciated.
> 
> I'm using xindice 1.0
> 
> Regards,
> Dominic Gamble.
> 
>