You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Tobias Wahlström <to...@pricerunner.se> on 2000/08/01 13:11:08 UTC

Building XPath expressions - again

Hello again!

I previusly posted the message below.
Since I didn't got any responce I guess that there is no code that does what
I want or even is close to do it. Since I really need something like it I
wonder if anyone has any idea on how this could be done (without using an
NP-complete algorithm)?


Best regards,
Tobias

> Is there anyone that have written something that build XPath 
> expressions given a sample DOM tree and all nodes in that 
> tree that should be matched? Is there anything like that for 
> building select expressions?
> 
> The second best is if there is something that takes a XPath 
> expression and a sample DOM tree and create an optimized 
> expression for that sample tree.
> 
> If you don't know of anything that does what I want, do you 
> know of something that is even close that would help me to 
> build such a thing?
> 
> 
> Best regards,
> Tobias Wahlström

Re: Building XPath expressions - again

Posted by Aseem Bajaj <as...@intersolutions.stpn.soft.net>.
no i think what Tobias means is that for the given XML stream.... ( take the
example cited )

 /*/*[0]
 /animals/dog
 /animals/*[Animals which chase cats, determined by using a document()
function on some knowledge base]
 /animals/*[starts-with(local-name(),'d')]

should be optimised to
/animals/dogs


we can take it a bit further...
/animals/dogs[position()=1] should be optimised to /animals/dogs given the
schema/dtd which says that there would be only one occurange of <dog> in
<animals>


aseem


----- Original Message -----
From: Ed Staub <es...@mediaone.net>
To: <xa...@xml.apache.org>
Sent: Tuesday, August 01, 2000 6:35 PM
Subject: RE: Building XPath expressions - again


> Tobias,
> This is impossible to do in many cases.
> Filters are especially difficult.
> For instance, if I have input
>
> <animals>
> <dog/>
> <cat/>
> <squirrel/>
> </animals>
>
> and emit output
>
> <dog/>
>
> was I emitting:
>
> /*/*[0]
> /animals/dog
> /animals/*[Animals which chase cats, determined by using a document()
> function on some knowledge base]
> /animals/*[starts-with(local-name(),'d')]
> etc...
>
> -Ed
>
>
> -----Original Message-----
> From: Tobias Wahlström [mailto:tobias.wahlstrom@pricerunner.se]
> Sent: Tuesday, August 01, 2000 7:11 AM
> To: 'xalan-dev@xml.apache.org'
> Subject: Building XPath expressions - again
>
>
> Hello again!
>
> I previusly posted the message below.
> Since I didn't got any responce I guess that there is no code that does
what
> I want or even is close to do it. Since I really need something like it I
> wonder if anyone has any idea on how this could be done (without using an
> NP-complete algorithm)?
>
>
> Best regards,
> Tobias
>
> > Is there anyone that have written something that build XPath
> > expressions given a sample DOM tree and all nodes in that
> > tree that should be matched? Is there anything like that for
> > building select expressions?
> >
> > The second best is if there is something that takes a XPath
> > expression and a sample DOM tree and create an optimized
> > expression for that sample tree.
> >
> > If you don't know of anything that does what I want, do you
> > know of something that is even close that would help me to
> > build such a thing?
> >
> >
> > Best regards,
> > Tobias Wahlström
>


RE: Building XPath expressions - again

Posted by Ed Staub <es...@mediaone.net>.
Tobias,
This is impossible to do in many cases.
Filters are especially difficult.
For instance, if I have input

<animals>
	<dog/>
	<cat/>
	<squirrel/>
</animals>

and emit output

<dog/>

was I emitting:

	/*/*[0]
	/animals/dog
	/animals/*[Animals which chase cats, determined by using a document()
function on some knowledge base]
	/animals/*[starts-with(local-name(),'d')]
	etc...

-Ed


-----Original Message-----
From: Tobias Wahlström [mailto:tobias.wahlstrom@pricerunner.se]
Sent: Tuesday, August 01, 2000 7:11 AM
To: 'xalan-dev@xml.apache.org'
Subject: Building XPath expressions - again


Hello again!

I previusly posted the message below.
Since I didn't got any responce I guess that there is no code that does what
I want or even is close to do it. Since I really need something like it I
wonder if anyone has any idea on how this could be done (without using an
NP-complete algorithm)?


Best regards,
Tobias

> Is there anyone that have written something that build XPath
> expressions given a sample DOM tree and all nodes in that
> tree that should be matched? Is there anything like that for
> building select expressions?
>
> The second best is if there is something that takes a XPath
> expression and a sample DOM tree and create an optimized
> expression for that sample tree.
>
> If you don't know of anything that does what I want, do you
> know of something that is even close that would help me to
> build such a thing?
>
>
> Best regards,
> Tobias Wahlström