Very interesting - that should be an illegal selectPath query, shouldn't
it.
(I wonder why it's not properly noticed and blocked.  Good catch, let's
see
what happens now.)

-----Original Message-----
From: Till Westmann 
Sent: Monday, October 31, 2005 10:51 AM
To: [email protected]
Subject: Re: XQuery Order by support in xmlbeans

Hi Vineet,

I'm not sure what the problem is, but there are some things I'd like  
you to try:

1) From the stack trace it seems that you are using  
XmlObject.selectPath to run the query.
Could you try running it using execQuery?

2) What happens if you run the exact same query without the sort by  
expressions?
Does everything work fine?

Cheers/thanks,
Till

On Oct 28, 2005, at 6:55 AM, Vineet Bhatia wrote:

> Hi Till,
>
> Thanks for the response.
>
> "sort by(Name)" didn't work. I get a IllegalStateException -  
> Illegal path
> [ELEMENT [CustAssAcc], [EMAIL PROTECTED]://www.w3.org/2001/XMLSchema],  ]
>
> Here is the complete xQuery -
> <CustAssAcc>
> <ErrorSet>
> {
> for $e in $this//ErrorSet
> return $e
> }
> </ErrorSet>
> <Data>
> <DataSet>
> {
> for $a in ($this//DataItem sort by(AssignedAccount))
> return
> <DataItem>
> {$a/*}
> </DataItem>
> sort by(AssignedAccount)
> }
> </DataSet>
> </Data>
> <Parameters>
> {
> for $p in $this//Parameters
> return $p
> }
> </Parameters>
> <Meta>
> {
> for $m in $this//Meta
> return $m
> }
> </Meta>
> </CustAssAcc>
>
> I tried the "sort by" in two places - (1) after the return (2) part  
> of the
> for in clause. Both gave me IllegalStateException. Here is the  
> stacktrace -
> java.lang.IllegalStateException: Illegal path [ELEMENT [CustAssAcc],
> [EMAIL PROTECTED]://www.w3.org/2001/XMLSchema],  ]
>  at
> com.bea.xbean.store.XqrlImpl.doNext(Lcom.bea.xbean.store.Cursor 
> $Selections;)
> Z(XqrlImpl.java:199)
>  at
> com.bea.xbean.store.XqrlImpl.next(Lcom.bea.xbean.store.Cursor 
> $Selections;)Z(
> XqrlImpl.java:66)
>  at
> com.bea.xbean.store.Cursor$Selections.setCursor 
> (Lcom.bea.xbean.store.Cursor;
> I)Z(Cursor.java:3260)
>  at
> com.bea.xbean.store.Cursor.selectPath 
> (Ljava.lang.String;Lcom.bea.xml.XmlOpti
> ons;)V(Cursor.java:2903)
>  at
> com.bea.xbean.values.XmlObjectBase.selectPath 
> (Ljava.lang.String;Lcom.bea.xml
> .XmlOptions;)[Lcom.bea.xml.XmlObject;(XmlObjectBase.java:395)
>  at
> com.bea.xbean.values.XmlObjectBase.selectPath(Ljava.lang.String;) 
> [Lcom.bea.x
> ml.XmlObject;(XmlObjectBase.java:379)
>  at
> portlets.CustAssignAccnt.CustAssignAccntController.reloadPage 
> (Lportlets.Cust
> AssignAccnt.CustAssignAccntController$BeginForm;)V 
> (CustAssignAccntController
> .jpf:207)
>  at
> portlets.CustAssignAccnt.CustAssignAccntController.begin 
> (Lportlets.CustAssig
> nAccnt.CustAssignAccntController$BeginForm;) 
> Lcom.bea.wlw.netui.pageflow.Forw
> ard;(CustAssignAccntController.jpf:97)
>  at
> jrockit.reflect.NativeMethodInvoker.invoke0 
> (Ljava.lang.Object;ILjava.lang.Ob
> ject;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
>  at
> jrockit.reflect.NativeMethodInvoker.invoke(Ljava.lang.Object; 
> [Ljava.lang.Obj
> ect;)Ljava.lang.Object;(Unknown Source)
>  at
> jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object; 
> [Ljava.l
> ang.Object;)Ljava.lang.Object;(Unknown Source)
>  at
> java.lang.reflect.Method.invoke(Ljava.lang.Object; 
> [Ljava.lang.Object;I)Ljava
> .lang.Object;(Unknown Source)
>
>
> Seems like I am missing something trivial?
>
> - vineet
>
>
> On 10/28/05 1:31 AM, "Till Westmann" <[EMAIL PROTECTED]> wrote:
>
>> The XQuery engine in WebLogic 8.1 supports the August 2002 version of
>> the XQuery spec.
>> The "order by" clause was introduced in the November 2002 version.
>> In the August 2002 version sorting is done using the "sort by"
>> expression.
>> (http://www.w3.org/TR/2002/WD-xquery-20020816/#id-sort-expressions)
>>
>> So this query should produce the desired result:
>>
>> <DataSet> {
>>      for $a in $this//DataItem
>>      return
>>          <DataItem> {
>>              $a/*
>>          } </DataItem>
>>      sort by (Name)
>> } </DataSet>
>>
>> Cheers,
>> Till
>>
>> -----Original Message-----
>> From: Vineet Bhatia [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, October 27, 2005 9:23 AM
>> To: [email protected]
>> Subject: XQuery Order by support in xmlbeans
>>
>> Is this supported in XMLBeans weblogic 8.1 sp4?
>>
>>      <DataSet>
>>      {
>>      for $a in //DataItem
>>      order by $a/Name
>>      return
>>      <DataItem>
>>          {$a/*}
>>      </DataItem>
>>      }
>>      </DataSet>
>>
>> I didn't get any help from BEA's xmlbeans forum.
>> I want to sort the xmlbean by $a/Name.
>> This works on saxon's xquery implementation.
>>
>> Thanks in advance.
>> - vineet
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to