Package org.xmldb.api.base

Examples of org.xmldb.api.base.Collection


  public void testEndsWithSearchQuery() throws Exception
  {
    // 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


  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

  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

  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);
View Full Code Here

        + "</p:person>";
    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();
View Full Code Here

    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);
View Full Code Here

    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);
View Full Code Here

  public void testFetchBoolean() throws Exception
  {
    String query = "boolean(//person)";

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

      // when we do support it the following tests will be run
View Full Code Here

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

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

      assertEquals(2L, resultSet.getSize());
View Full Code Here

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

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

      assertEquals(2L, resultSet.getSize());
View Full Code Here

TOP

Related Classes of org.xmldb.api.base.Collection

Copyright © 2018 www.massapicom. 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.