List Info

Thread: selectPath with FilterExpression using $this




selectPath with FilterExpression using $this
user name
2006-03-29 21:48:57
Siggi,
yes, I did mean that you could use execQuery() to run the
XQuery.
Sorry, but I don't have anything else useful to tell you.
- Wing Yew

-----Original Message-----
From: Siegfried Baiz [mailto:baizsulzer.de] 
Sent: Wednesday, March 29, 2006 12:09 PM
To: userxmlbeans.apache.org
Subject: Re: selectPath with FilterExpression using $this

Wing Yew,

I've tried the following function-call
    XmlBeans.selectPath("let $cur := . return //*[idfRef=$cur/id]);
and got the following Error:
    net.sf.saxon.xpath.StaticError: XPath syntax error at
char 1 in { 
let $}:     'let' is not supported in XPath

Maybe you've been thinking about using
XmlBeans.execQuery(...)
My Problem with this approach would be that
XmlBeans.execQuery(...)
just delivers copies of the requested Nodes, isn't it?
Unfortunately that wouldn't fit my needs.

I can hardly believe, that I'am the only one,
who needs to select all nodes refering
to a given XmlBean (by IDREF-ID-Relation).

Thanks for your help, anyway!

Do you have any idea,
where I could get some further Information rsp.
who could give me some help about that matter?

- Siggi


Wing Yew Poon wrote:

>Siggi,
>I have very limited knowledge of XPath/XQuery.
>I don't know why your selectPath() call doesn't work.
It seems right.
>Can you say what version of XMLBeans you are using (2.0?
2.1? latest
>svn?)
>and also what version of Saxon?
>I believe that $this works as advertised with the BEA
XQuery engine,
>but I'm not sure about Saxon.
>Again, I know very little XQuery, but maybe you could
try something
>along
>the lines of
>
>let $cur := .
>return //*[idfRef=$cur/id]
>
>if $this is not working.
>- Wing Yew
>
>________________________________
>
>From: Siegfried Baiz [mailto:baizsulzer.de] 
>Sent: Thursday, March 16, 2006 12:29 AM
>To: userxmlbeans.apache.org
>Subject: Re: selectPath with FilterExpression using
$this
>
>
>Hello Wing Yew,
>
>yes, that's what I'm looking for. Do you have any
idea, why 
>
> xo.selectPath("//*[idRef=$this/id]")
>
>doesn't work (for my XmlObject xo with ID-Attribute
'id')?
>
>Or is there some better why to receive all nodes 
>(with idRef-Attribute) refering to my node xo?
>
> - thanks for your help - Siggi
>
>
>
>Wing Yew Poon wrote: 
>
>	Siggi,
>	I think you're right. I guess what you need is a
variable bound
>	to the node represented by the XmlObject that you're
executing
>the 
>	selectPath() from. "$this" is supposed to
be that.
>	- Wing Yew
>	
>	-----Original Message-----
>	From: Siegfried Baiz [mailto:baizsulzer.de] 
>	Sent: Wednesday, March 15, 2006 3:09 AM
>	To: userxmlbeans.apache.org
>	Subject: Re: selectPath with FilterExpression using
$this
>	
>	For the Expression  xo.selectPath("//*[idRef=./id]"
><mailto://*[idRef=./id]> ) I get an empty 
>	result-array.
>	
>	Doesn't the left- and the right-hand-side of that
>filter-expression
>	always refer to the same node, which would mean,
>	that the xpath-engine tries to select any nodes with
>	the two attributes idRef & id having
the same value?
>	
>	- Siggi -
>	
>	  
>
>		Siggi,
>		can you try
>		
>		   xo.selectPath("//*[idRef=./id]"
><mailto://*[idRef=./id]> );
>		
>		and see if that works?
>		- Wing Yew
>		
>		-----Original Message-----
>		From: Siegfried Baiz [mailto:baizsulzer.de] 
>		Sent: Tuesday, March 14, 2006 10:11 AM
>		To: userxmlbeans.apache.org
>		Subject: selectPath with FilterExpression using $this
>		
>		Hello,
>		
>		for a given XmlObject xo with an ID-Attribute 'id',
>		I've tried to launch the following xpath-expression:
>		
>		   xo.selectPath("//*[idRef=$this/id]")
>		
>		in order to get all nodes (with idRef-Attribute)
>refering to my node
>		    
>
>	xo.
>	  
>
>		Unfortunatlly this expression seems not to work. I
>always get an
>		java.lang.ArrayIndexOutOfBoundsException from the
>underlying
>	
>net.sf.saxon.expr.XPathContextMajor.setLocalVariable(XPa
thContextMajor.
>		    
>
>	j
>	  
>
>		ava:213)
>		
>		At
>	
>http://xmlbeans.apache.org/docs/2.0.0/gui
de/conSelectingXMLwithXQueryPa
>		    
>
>	t
>	  
>
>		hXPath.html
>		I found the following notice:
>			"Notice in the query expression that the
>variable $this
>		represents
>			 the current context node (the XmlObject that
>you are querying
>		from).
>			 In this example you are querying from the
>document level
>		XmlObject."
>		
>		After reading that sentence I've been thinking, that
>$this is somehow
>		similar to "curent()" in XSLT, but maybe a
got the
>meaning wrong.
>		
>		Does anyone know whats the problem here rsp.
>		is there a better way to accomplish the same thing?
>		
>		Thanks a lot,
>		
>		Siggi
>		
>		
>		
>	
>--------------------------------------------------------
-------------
>		To unsubscribe, e-mail:
>user-unsubscribexmlbeans.apache.org
>		For additional commands, e-mail:
>user-helpxmlbeans.apache.org
>		
>	
>________________________________________________________
_______________
>		Notice:  This email message, together with any
>attachments, may contain
>		information  of  BEA Systems,  Inc.,  its subsidiaries
>and  affiliated
>		entities,  that may be confidential,  proprietary,
>copyrighted  and/or
>		legally privileged, and is intended solely for the use
>of the
>		    
>
>	individual
>	  
>
>		or entity named in this message. If you are not the
>intended recipient,
>		and have received this message in error, please
>immediately return this
>		by email and then delete it.
>		
>	
>--------------------------------------------------------
-------------
>		To unsubscribe, e-mail:
>user-unsubscribexmlbeans.apache.org
>		For additional commands, e-mail:
>user-helpxmlbeans.apache.org
>		
>		
>		 
>		
>		    
>
>	
>	
>--------------------------------------------------------
-------------
>	To unsubscribe, e-mail: user-unsubscribexmlbeans.apache.org
>	For additional commands, e-mail: user-helpxmlbeans.apache.org
>	
>	
>________________________________________________________
_______________
>	Notice:  This email message, together with any
attachments, may
>contain
>	information  of  BEA Systems,  Inc.,  its subsidiaries 
and
>affiliated
>	entities,  that may be confidential,  proprietary, 
copyrighted
>and/or
>	legally privileged, and is intended solely for the use
of the
>individual
>	or entity named in this message. If you are not the
intended
>recipient,
>	and have received this message in error, please
immediately
>return this
>	by email and then delete it.
>	
>	
>--------------------------------------------------------
-------------
>	To unsubscribe, e-mail: user-unsubscribexmlbeans.apache.org
>	For additional commands, e-mail: user-helpxmlbeans.apache.org
>	
>	
>	  
>
>________________________________________________________
_______________
>Notice:  This email message, together with any
attachments, may contain
>information  of  BEA Systems,  Inc.,  its subsidiaries 
and  affiliated
>entities,  that may be confidential,  proprietary, 
copyrighted  and/or
>legally privileged, and is intended solely for the use
of the
individual
>or entity named in this message. If you are not the
intended recipient,
>and have received this message in error, please
immediately return this
>by email and then delete it.
>
>--------------------------------------------------------
-------------
>To unsubscribe, e-mail: user-unsubscribexmlbeans.apache.org
>For additional commands, e-mail: user-helpxmlbeans.apache.org
>
>
>  
>

------------------------------------------------------------
---------
To unsubscribe, e-mail: user-unsubscribexmlbeans.apache.org
For additional commands, e-mail: user-helpxmlbeans.apache.org

____________________________________________________________
___________
Notice:  This email message, together with any attachments,
may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and 
affiliated
entities,  that may be confidential,  proprietary, 
copyrighted  and/or
legally privileged, and is intended solely for the use of
the individual
or entity named in this message. If you are not the intended
recipient,
and have received this message in error, please immediately
return this
by email and then delete it.

------------------------------------------------------------
---------
To unsubscribe, e-mail: user-unsubscribexmlbeans.apache.org
For additional commands, e-mail: user-helpxmlbeans.apache.org

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )