Examples of XPathQueryService


Examples of org.xmldb.api.modules.XPathQueryService

  public void testAndOrQuery() throws Exception
  {
    String query = "//person[last='Smith' and (first='John' or first='Sally')]";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = xpathservice.query(query);

    ResourceIterator results = resultSet.getIterator();

    List res = asList(results);
    assertEquals(2, res.size());
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

  {
    // search all records whose last name contains 'Smi'
    String query = "//person[contains(last, 'Smi')]";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = xpathservice.query(query);

    ResourceIterator results = resultSet.getIterator();
    List res = asList(results);
    assertEquals(2, res.size());
  }
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

    // search all records whose last name begins with 'Smi'
    String query = "//person[(string-length(//person/last) >= 3) and (substring(//person/last, 1, 3)='Smi')]";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = xpathservice.query(query);

    ResourceIterator results = resultSet.getIterator();
    List res = asList(results);
    assertEquals(2, res.size());
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

  {
    // search all records whose last name begins with 'ith'
    String query = "//person[(string-length(//person/last) >= 4) and (substring(//person/last, 2)='mith')]";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = xpathservice.query(query);

    ResourceIterator results = resultSet.getIterator();
    List res = asList(results);
    assertEquals(2, res.size());
  }
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

  public void testGreaterSearchQuery() throws Exception
  {
    String query = "//person[age > 25]";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = xpathservice.query(query);

    ResourceIterator results = resultSet.getIterator();
    List res = asList(results);
    assertEquals(1, res.size());
  }
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

  public void testGetSingleTextNode() throws Exception
  {
    String query = "//person[first='John' and last='Smith']/first/text()";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = xpathservice.query(query);

    assertEquals(1L, resultSet.getSize());
    assertEquals("John", resultSet.getResource(0).getContent());
  }
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

  public void testGetMultipleTextNodes() throws Exception
  {
    String query = "//person/first/text()";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = xpathservice.query(query);

    ResourceIterator results = resultSet.getIterator();

    List res = asList(results);
    assertEquals(2, res.size());
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

    this.client.insertDocument(TEST_COLLECTION_PATH, "doc3", document3);

    String query = "//h:person[h:first='Sally' and h:last='Smith']/h:first";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    xpathservice.setNamespace("h", "http://example.net/person");

    ResourceSet resultSet = xpathservice.query(query);

    ResourceIterator results = resultSet.getIterator();
    List res = asList(results);
    assertEquals(1, res.size());
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

    client.insertDocument(TEST_COLLECTION_PATH, "doc3", document3);

    String query = "//@bar";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");

    ResourceSet resultSet = null;
    try
    {
      resultSet = xpathservice.query(query);
    }
    catch (Exception e)
    {
      fail(e.getMessage());
    }
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

    client.insertDocument(TEST_COLLECTION_PATH, "doc3", document3);

    String query = "//foo/@bar";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");

    ResourceSet resultSet = null;
    try
    {
      resultSet = xpathservice.query(query);
    }
    catch (Exception e)
    {
      fail(e.getMessage());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.