RE: xquery against xmlerror

2008-06-17 Thread Costello, Robert
For the sake of others who find the same problem, I have figured this
one out.  What held me back was that the XmlCursor obtained from the
XmlError could not move above the offending element.  In the example
below, it would be the description element.  A toParent call would not
ascend to foo.  I tried removing the reference to
noNameSpaceSchemaLocation, but it still would not work.  Then I put a
namespace in both the schema and the input xml doc and it worked.  So,
for anyone else who tries to use an XmlError object to relate back to
the XmlObject from the parse, it can be done, but you need to have a
namespace in order to traverse the XmlCursor.  

 

Snippets here:

 

   XmlCursor xmlCursor = error.getCursorLocation();

  while (xmlCursor.toParent()) {

  if
(xmlCursor.getDomNode().getNodeName().equalsIgnoreCase(foo))

  { dosomething }

 

 

xs:schema

   xmlns:xs=http://www.w3.org/2001/XMLSchema;

   xmlns:md=mydoc

   targetNamespace=mydoc

   elementFormDefault=qualified

 

Robert Costello

 

 

-Original Message-
From: Costello, Robert 
Sent: Friday, June 13, 2008 1:04 PM
To: user@xmlbeans.apache.org
Subject: xquery against xmlerror

 

First, I want to commend this group for the general helpfulness given to
new users.  Many groups will dismiss questions from newbies as
bothersome.  This group seems to be above that. 

 

Now that I've greased my way in...

 

Here's a problem I'm trying to solve.  I have a service that takes an
xml file in.  I validate it against the schema.  The data has a few
errors.  I want to send only the good data along for more processing.
All I need to do is delete the bad elements.  Sounds easy.  My trouble
is knowing how to relate the error with the original file. 

 

I have an XmlObject from parsing, and an XmlError object from
validating.  The data looks something like this:

 

?xml version=1.0 encoding=UTF-8? 

somedoc xmlns:xsi=com.somewhere.somedoc 

xsi:noNamespaceSchemaLocation='somedoc.xsd' 

fileId1234/fileId

userIdjoeuser/userId

foobars

foo

somekey123/somekey 

someotherkey456/someotherkey

someflagY/someflag

somedatasomething/somedata

descriptions

   descriptiondesc 1/description

   descriptiondesc 2/description

/descriptions

/foo

foo

somekey789/somekey 

someotherkey101112/someotherkey

someflagY/someflag


 
somedatathisfieldistoolong/somedata

descriptions

   descriptiondesc 1/description

   descriptiondesc 2/description

/descriptions

/foo

/foobars

/somedoc

 

I need to delete the foo element (and it's underlying children) since I
have one field with errors (somedatathisfieldistoolong/somedata)

If I knew the index of foo that would be easy.  I don't see how I can
get that from the XmlError.  

 

Does anyone have an idea on this?

 

Thanks in advance,

 

Robert Costello

 

 

 



RE: XQuery

2008-05-01 Thread Radu Preotiuc-Pietro
Gustavo,
 
XMLBeans 2.3.0 is designed to work with Saxon 8.8 (Saxon 8.6.1 also
works, but not as well, as I remember). Support for Saxon 9.0 has only
recently been added to the SVN repository.
 
The fact that Saxon APIs change so much from one revision of Saxon to
the next makes it too difficult at present to reliably support more than
one version of Saxon per version of XMLBeans.
 
Radu




From: Gustavo Aquino [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 01, 2008 12:54 PM
To: user@xmlbeans.apache.org
Subject: Re: XQuery


Hi Radu, 

Yes im using xmlbeans 2.3.0, but not saxon 8.8 combo, im using
saxon 9.0.0.4 combo.

yes, i confirm scoreDoc = ScoreDocument.Factory.parse(new
File(score.xml)) 



i tried with saxon 8.6.1 and now works fine. xmlbeans doest
support saxon9 ?


Regards

On Thu, Apr 24, 2008 at 9:52 PM, Radu Preotiuc-Pietro
[EMAIL PROTECTED] wrote:


Ah ok, sorry for not looking closer at your original
example.
 
However, I have just tried your exact code (and input
document) and it works for me... Are you using the XMLBeans 2.3.0/Saxon
8.8 combo? Can you confirm that scoreDoc = XmlObject.Factory.parse(new
File(score.xml)) ?
 
Radu





From: Gustavo Aquino
[mailto:[EMAIL PROTECTED] 

Sent: Sunday, April 20, 2008 1:41 PM 

To: user@xmlbeans.apache.org

Subject: Re: XQuery


Hi Radu, 

The xquery with doc element, is used only in
XMLSpy test, you can see in block CODE i change the doc... per $this.

the same query using saxon run all right but in
xmlbeans this didn't work.

Gustavo


On Thu, Apr 17, 2008 at 5:29 PM, Radu
Preotiuc-Pietro [EMAIL PROTECTED] wrote:


Query looks good. But when I see the
doc(score.xml) call with a relative path in it, I'm thinking that is
something that can cause problems. Also, please note that the free
version of Saxon that XMLBeans uses doesn't support typed XQuery so you
need to try XMLSpy without the Schema for a meaningful comparison.
 
Radu




From: Gustavo Aquino
[mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 16, 2008 2:17 PM
To: user@xmlbeans.apache.org
Subject: XQuery


Hi,
 
I'm trying to use XQuery in XMLBeans.
 
Well using samples in XMLBeans package,
all work fine, but when i write my XQuery it is not work.
 
I wrote my XQuery and validate in XML
Spy and all work fines, but when i put my xquery in XMLBeans this not
return nothing.
 
 


--
XQUERY -
declare

namespace
n1='http://x.com.br/score/probability';
for $x in
doc(score.xml)/n1:scores/score
  let $s := $x/name 
  where $s = 'Score1' 
return $x


--
XML -
?xml version=1.0 encoding=UTF-8?


n1:scores
xsi:schemaLocation=http://x.com.br/score/probability
score_probability.xsd xmlns:n1=http://x.com.br/score/probability;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
score
class0/class
ratingString/rating
probabilityString/probability
initial_score0/initial_score
end_score0/end_score
nameScore1/name
/score

Re: XQuery

2008-05-01 Thread Gustavo Aquino
Radu,
Where i can download saxon 8.8 ? i find only saxonb 9, 8.1.1 and 8.6.1.

Kind Regards.

Gustavo

On Thu, May 1, 2008 at 8:19 PM, Radu Preotiuc-Pietro [EMAIL PROTECTED] wrote:

  Gustavo,

 XMLBeans 2.3.0 is designed to work with Saxon 8.8 (Saxon 8.6.1 also works,
 but not as well, as I remember). Support for Saxon 9.0 has only recently
 been added to the SVN repository.

 The fact that Saxon APIs change so much from one revision of Saxon to the
 next makes it too difficult at present to reliably support more than one
 version of Saxon per version of XMLBeans.

 Radu

  --
 *From:* Gustavo Aquino [mailto:[EMAIL PROTECTED]
 *Sent:* Thursday, May 01, 2008 12:54 PM

 *To:* user@xmlbeans.apache.org
 *Subject:* Re: XQuery

 Hi Radu,
 Yes im using xmlbeans 2.3.0, but not saxon 8.8 combo, im using saxon
 9.0.0.4 combo.

 yes, i confirm scoreDoc = ScoreDocument.Factory.parse(new
 File(score.xml))


 i tried with saxon 8.6.1 and now works fine. xmlbeans doest support saxon9
 ?


 Regards

 On Thu, Apr 24, 2008 at 9:52 PM, Radu Preotiuc-Pietro [EMAIL PROTECTED]
 wrote:

   Ah ok, sorry for not looking closer at your original example.
 
  However, I have just tried your exact code (and input document) and it
  works for me... Are you using the XMLBeans 2.3.0/Saxon 8.8 combo? Can you
  confirm that scoreDoc = XmlObject.Factory.parse(new File(score.xml)) ?
 
  Radu
 
   --
   *From:* Gustavo Aquino [mailto:[EMAIL PROTECTED]
  *Sent:* Sunday, April 20, 2008 1:41 PM
  *To:* user@xmlbeans.apache.org
  *Subject:* Re: XQuery
 
Hi Radu,
  The xquery with doc element, is used only in XMLSpy test, you can see in
  block CODE i change the doc... per $this.
 
  the same query using saxon run all right but in xmlbeans
  this didn't work.
 
  Gustavo
 
 
  On Thu, Apr 17, 2008 at 5:29 PM, Radu Preotiuc-Pietro [EMAIL PROTECTED]
  wrote:
 
Query looks good. But when I see the doc(score.xml) call with a
   relative path in it, I'm thinking that is something that can cause 
   problems.
   Also, please note that the free version of Saxon that XMLBeans uses 
   doesn't
   support typed XQuery so you need to try XMLSpy without the Schema for a
   meaningful comparison.
  
   Radu
  
--
   *From:* Gustavo Aquino [mailto:[EMAIL PROTECTED]
   *Sent:* Wednesday, April 16, 2008 2:17 PM
   *To:* user@xmlbeans.apache.org
   *Subject:* XQuery
  
 Hi,
  
   I'm trying to use XQuery in XMLBeans.
  
   Well using samples in XMLBeans package, all work fine, but when i
   write my XQuery it is not work.
  
   I wrote my XQuery and validate in XML Spy and all work fines, but when
   i put my xquery in XMLBeans this not return nothing.
  
  
   --
   XQUERY -
  
   declare
   namespace n1='http://x.com.br/score/probability';
   for $x in doc(score.xml)/n1:scores/score
 let $s := $x/name
 where $s = 'Score1'
   return $x
   --
   XML -
  
   ?xml version=1.0 encoding=UTF-8?
   n1:scores 
   xsi:schemaLocation=http://x.com.br/score/probabilityscore_probability.xsd
xmlns:n1=http://x.com.br/score/probability; xmlns:xsi=
   http://www.w3.org/2001/XMLSchema-instance;
   score
   class0/class
   ratingString/rating
   probabilityString/probability
   initial_score0/initial_score
   end_score0/end_score
   nameScore1/name
   /score
   score
   class0/class
   ratingString/rating
   probabilityString/probability
   initial_score0/initial_score
   end_score0/end_score
   nameScore2/name
   /score
   score
   class0/class
   ratingString/rating
   probabilityString/probability
   initial_score0/initial_score
   end_score0/end_score
   nameScore3/name
   /score
   /n1:scores
   --
   RETURN  XML Spry-
score xmlns:n1=http://x.com.br/score/probability xmlns:xsi=
   http://www.w3.org/2001/XMLSchema-instance;class0/classrating
   String/ratingprobabilityString/probabilityinitial_score0/
   initial_scoreend_score0/end_scorenameScore1/name/score
  
   --
   CODE -
  
  
  
   String newQuery=
   declare namespace n1='http://x.com.br/score/probability'; +
   for $x in $this/n1:scores/score +
   let $s := $x/name +
   where $s = 'Score1' +
   return $x;
  
   XmlCursor scoreCursor =
   scoreDoc.newCursor();
   scoreCursor.toNextToken();
   XmlCursor resultCursor = scoreCursor.execQuery(newQuery);
   System.*out*.println(The query results : );
   System.*out*.println

RE: XQuery

2008-04-24 Thread Radu Preotiuc-Pietro
Ah ok, sorry for not looking closer at your original example.
 
However, I have just tried your exact code (and input document) and it
works for me... Are you using the XMLBeans 2.3.0/Saxon 8.8 combo? Can
you confirm that scoreDoc = XmlObject.Factory.parse(new
File(score.xml)) ?
 
Radu




From: Gustavo Aquino [mailto:[EMAIL PROTECTED] 
Sent: Sunday, April 20, 2008 1:41 PM
To: user@xmlbeans.apache.org
Subject: Re: XQuery


Hi Radu, 

The xquery with doc element, is used only in XMLSpy test, you
can see in block CODE i change the doc... per $this.

the same query using saxon run all right but in xmlbeans this
didn't work.

Gustavo


On Thu, Apr 17, 2008 at 5:29 PM, Radu Preotiuc-Pietro
[EMAIL PROTECTED] wrote:


Query looks good. But when I see the doc(score.xml)
call with a relative path in it, I'm thinking that is something that can
cause problems. Also, please note that the free version of Saxon that
XMLBeans uses doesn't support typed XQuery so you need to try XMLSpy
without the Schema for a meaningful comparison.
 
Radu




From: Gustavo Aquino
[mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 16, 2008 2:17 PM
To: user@xmlbeans.apache.org
Subject: XQuery


Hi,
 
I'm trying to use XQuery in XMLBeans.
 
Well using samples in XMLBeans package, all work
fine, but when i write my XQuery it is not work.
 
I wrote my XQuery and validate in XML Spy and
all work fines, but when i put my xquery in XMLBeans this not return
nothing.
 
 


--
XQUERY -
declare

namespace
n1='http://x.com.br/score/probability';
for $x in doc(score.xml)/n1:scores/score
  let $s := $x/name 
  where $s = 'Score1' 
return $x


--
XML -
?xml version=1.0 encoding=UTF-8?


n1:scores
xsi:schemaLocation=http://x.com.br/score/probability
score_probability.xsd xmlns:n1=http://x.com.br/score/probability;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
score
class0/class
ratingString/rating
probabilityString/probability
initial_score0/initial_score
end_score0/end_score
nameScore1/name
/score
score
class0/class
ratingString/rating
probabilityString/probability
initial_score0/initial_score
end_score0/end_score
nameScore2/name
/score
score
class0/class
ratingString/rating
probabilityString/probability
initial_score0/initial_score
end_score0/end_score
nameScore3/name
/score
/n1:scores


--
RETURN  XML Spry-
 score
xmlns:n1=http://x.com.br/score/probability
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;class0/classr
atingString/ratingprobabilityString/probabilityinitial_score0/
initial_scoreend_score0/end_scorenameScore1/name/score
 


--
CODE -
 
  

String newQuery=

declare namespace
n1='http://x.com.br/score/probability'; +
for $x in $this/n1:scores/score +
let $s := $x/name +
where $s = 'Score1' +
return $x

Re: XQuery

2008-04-20 Thread Gustavo Aquino
Hi Radu,
The xquery with doc element, is used only in XMLSpy test, you can see in
block CODE i change the doc... per $this.

the same query using saxon run all right but in xmlbeans this didn't work.

Gustavo


On Thu, Apr 17, 2008 at 5:29 PM, Radu Preotiuc-Pietro [EMAIL PROTECTED] wrote:

  Query looks good. But when I see the doc(score.xml) call with a
 relative path in it, I'm thinking that is something that can cause problems.
 Also, please note that the free version of Saxon that XMLBeans uses doesn't
 support typed XQuery so you need to try XMLSpy without the Schema for a
 meaningful comparison.

 Radu

  --
 *From:* Gustavo Aquino [mailto:[EMAIL PROTECTED]
 *Sent:* Wednesday, April 16, 2008 2:17 PM
 *To:* user@xmlbeans.apache.org
 *Subject:* XQuery

  Hi,

 I'm trying to use XQuery in XMLBeans.

 Well using samples in XMLBeans package, all work fine, but when i write my
 XQuery it is not work.

 I wrote my XQuery and validate in XML Spy and all work fines, but when i
 put my xquery in XMLBeans this not return nothing.


 --
 XQUERY -

 declare
 namespace n1='http://x.com.br/score/probability';
 for $x in doc(score.xml)/n1:scores/score
   let $s := $x/name
   where $s = 'Score1'
 return $x
 --
 XML -

 ?xml version=1.0 encoding=UTF-8?
 n1:scores 
 xsi:schemaLocation=http://x.com.br/score/probabilityscore_probability.xsd
  xmlns:n1=http://x.com.br/score/probability; xmlns:xsi=
 http://www.w3.org/2001/XMLSchema-instance;
 score
 class0/class
 ratingString/rating
 probabilityString/probability
 initial_score0/initial_score
 end_score0/end_score
 nameScore1/name
 /score
 score
 class0/class
 ratingString/rating
 probabilityString/probability
 initial_score0/initial_score
 end_score0/end_score
 nameScore2/name
 /score
 score
 class0/class
 ratingString/rating
 probabilityString/probability
 initial_score0/initial_score
 end_score0/end_score
 nameScore3/name
 /score
 /n1:scores
 --
 RETURN  XML Spry-
  score xmlns:n1=http://x.com.br/score/probability xmlns:xsi=
 http://www.w3.org/2001/XMLSchema-instance;class0/classratingString
 /ratingprobabilityString/probabilityinitial_score0/initial_score
 end_score0/end_scorenameScore1/name/score

 --
 CODE -



 String newQuery=
 declare namespace n1='http://x.com.br/score/probability'; +
 for $x in $this/n1:scores/score +
 let $s := $x/name +
 where $s = 'Score1' +
 return $x;

 XmlCursor scoreCursor =
 scoreDoc.newCursor();
 scoreCursor.toNextToken();
 XmlCursor resultCursor = scoreCursor.execQuery(newQuery);
 System.*out*.println(The query results : );
 System.*out*.println(resultCursor.getObject().toString() + \n);
 --
 RETURN  PROGRAM-


 The query results :

 xml-fragment/





 Thanks for any help.

 Gustavo




 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.


Re: XQuery Order by support in xmlbeans

2005-11-01 Thread Vineet Bhatia

(1) execQuery() and sort by - no exception, XML is empty

CustAssAccDataDataSet//DataParameters/Meta//CustAssAcc

(2) execQuery() and no sort by - Same as (1)

The xquery works when I tested it with saxon parser.

- vineet

On 10/31/05 1:53 PM, Mike Carey [EMAIL PROTECTED] wrote:

 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: user@xmlbeans.apache.org
 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: user@xmlbeans.apache.org
 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

Re: XQuery Order by support in xmlbeans

2005-10-31 Thread Till Westmann

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: user@xmlbeans.apache.org
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]



Re: XQuery Order by support in xmlbeans

2005-10-27 Thread Till Westmann
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: user@xmlbeans.apache.org
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]