Hi, 
 
I think the problem you're having is that your cursor get "reseted" at your 
second executeQuery statement.
I had a similar problem, and I solved it by creating new cursors at the point 
where I wanted to continue the search.
  Instead of:
XmlCursor newCursor = cursor.execQuery("//PhysicalLocation"); 
 
I think you should try:
XmlCursor newCursor = cursor.newCursor();
newCursor.execQuery("//PhysicalLocation"); 
 
Here is my example, hope it helps:
 
cursor = body.newCursor();
   
   cursor.toFirstChild();
   cursor.push();
   
   
   cursor.selectPath( queryExpression  + "$this//xq:t");
   XmlCursor cursor_toc_start = cursor.newCursor();
   XmlCursor cursor_toc_end = cursor.newCursor();
   
   cursor_toc_start.selectPath( queryExpression  + "$this//xq:t[contains(., 
'Contents')]");
   cursor_toc_end.selectPath( queryExpression + "$this//xq:t[contains(., 
'Income statement CIB PRUs total')]");
   cursor_toc_start.toNextSelection();
   cursor_toc_end.toNextSelection();
   
   bookmarks = new HashMap();
  
   bookmarks.put( "toc_start" , cursor_toc_start.getObject() );
   bookmarks.put( "toc_end", cursor_toc_end.getObject() );

 
 

Connecta 

Box 3216, Mäster Samuelsgatan 60, SE-103 64 Stockholm
Tel +46 (0) 8 635 80 00
Dir/Mob +46 (0) 8 635 81 08
Fax +46 (0) 8 635 80 02
www.connecta.se

________________________________

Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Skickat: fr 2006-06-30 00:52
Till: [email protected]
Ämne: Need help with XmlCursor




I'm having a bit of trouble getting my queries to work correctly. I have a
rather complex XML schema that is deep. I want to perform a query to get
all of the CustomerInformation elements throughout the document. This I
accomplish very easily:



custInfoCursor = cursor.execQuery("//CustomerInformation");



The custInfoCursor now contains a document fragment that contains all of
the CustomerInformation structures that were within the original document.
These structures are defined as complex datatypes because they have some
depth to them as well. My problem here is how do I iterate through the
CustomerInformation elements so I can perform additional queries against
each CustomerInformation element? I've been running into a great deal of
difficulty with this one as there are no concise examples.



I've tried:



for (cursor.toFirstContentToken() ; cursor.hasNextToken() ;
cursor.toNextToken()) {

    // Here I want to run a query against the cursor but only in regards to
the current nodes context.

      XmlCursor newCursor = cursor.execQuery("//PhysicalLocation"); // But
this doesn't work. It retrieves all nodes within the original document

}



Any help is greatly appreciated at this point. Even a link to an example so
I can see what I am doing wrong.



Thanks...



Chris Mathrusse

[EMAIL PROTECTED]

(925) 236-5553



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



<<winmail.dat>>

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

Reply via email to