You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Boris Rousseau <br...@tssg.org> on 2003/09/25 16:10:33 UTC

Use cases

Hi all,

I have tried using this XPath search on my XML collection

String xpath = "/movie/title='Gladiator'";
XPathQueryService service =
   (XPathQueryService) collection.getService("XPathQueryService", "1.0");
ResourceSet resultSet = service.query(xpath);
ResourceIterator results = resultSet.getIterator();
while (results.hasMoreResources()) {
   XMLResource resource = 
      (XMLResource) results.nextResource();
   Node result = resource.getContentAsDOM();
}

However, I get several nodes back as the result from the query and only the last one gets in the Node structure, the rest is discarded.
Is there a way around to get all the results in the Node or in a DOM document (maybe using a string)?

Regards,
Boris

Re: Use cases

Posted by Boris Rousseau <br...@tssg.org>.
No, I am just using another xpath based on this use case.
  ----- Original Message ----- 
  From: jcplerm 
  To: xindice-users@xml.apache.org ; Boris Rousseau 
  Sent: Thursday, September 25, 2003 3:14 PM
  Subject: Re: Use cases


  Shouldn't the query be like:?

  "/movie/title[.='Gladiator']
    ----- Original Message ----- 
    From: Boris Rousseau 
    To: xindice-users@xml.apache.org 
    Sent: Thursday, September 25, 2003 9:10 AM
    Subject: Use cases


    Hi all,

    I have tried using this XPath search on my XML collection

    String xpath = "/movie/title='Gladiator'";
    XPathQueryService service =
       (XPathQueryService) collection.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = service.query(xpath);
    ResourceIterator results = resultSet.getIterator();
    while (results.hasMoreResources()) {
       XMLResource resource = 
          (XMLResource) results.nextResource();
       Node result = resource.getContentAsDOM();
    }

    However, I get several nodes back as the result from the query and only the last one gets in the Node structure, the rest is discarded.
    Is there a way around to get all the results in the Node or in a DOM document (maybe using a string)?

    Regards,
    Boris

RE: Use cases

Posted by Robert Koberg <ro...@koberg.com>.
Actually, it should be:

 

"normalize-space(/movie/title)='Gladiator'"

 

Or perhaps:

 

"contains(/movie/title, 'Gladiator')"

 

Best,

-Rob

 

  _____  

From: jcplerm [mailto:jcplerm@ameritech.net] 
Sent: Thursday, September 25, 2003 7:15 AM
To: xindice-users@xml.apache.org; Boris Rousseau

 

Shouldn't the query be like:?

 

"/movie/title[.='Gladiator']

----- Original Message ----- 

From: Boris Rousseau <ma...@tssg.org>  

To: xindice-users@xml.apache.org 

Sent: Thursday, September 25, 2003 9:10 AM

Subject: Use cases

 

Hi all,

 

I have tried using this XPath search on my XML collection

 

String xpath = "/movie/title='Gladiator'";
XPathQueryService service =
   (XPathQueryService) collection.getService("XPathQueryService", "1.0");
ResourceSet resultSet = service.query(xpath);
ResourceIterator results = resultSet.getIterator();
while (results.hasMoreResources()) {
   XMLResource resource = 
      (XMLResource) results.nextResource();
   Node result = resource.getContentAsDOM();
}

 

However, I get several nodes back as the result from the query and only the
last one gets in the Node structure, the rest is discarded.

Is there a way around to get all the results in the Node or in a DOM
document (maybe using a string)?

 

Regards,

Boris


Re: Use cases

Posted by jcplerm <jc...@ameritech.net>.
Shouldn't the query be like:?

"/movie/title[.='Gladiator']
  ----- Original Message ----- 
  From: Boris Rousseau 
  To: xindice-users@xml.apache.org 
  Sent: Thursday, September 25, 2003 9:10 AM
  Subject: Use cases


  Hi all,

  I have tried using this XPath search on my XML collection

  String xpath = "/movie/title='Gladiator'";
  XPathQueryService service =
     (XPathQueryService) collection.getService("XPathQueryService", "1.0");
  ResourceSet resultSet = service.query(xpath);
  ResourceIterator results = resultSet.getIterator();
  while (results.hasMoreResources()) {
     XMLResource resource = 
        (XMLResource) results.nextResource();
     Node result = resource.getContentAsDOM();
  }

  However, I get several nodes back as the result from the query and only the last one gets in the Node structure, the rest is discarded.
  Is there a way around to get all the results in the Node or in a DOM document (maybe using a string)?

  Regards,
  Boris