Examples of XPathQueryService


Examples of org.xmldb.api.modules.XPathQueryService

  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
      assertEquals(2L, resultSet.getSize());
      assertEquals("true", resultSet.getResource(1L).getContent());
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

  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());
    }
    catch (XMLDBException e)
    {
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

  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());
    }
    catch (XMLDBException e)
    {
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

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

    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

    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

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

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

    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

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

    try
    {
      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

         *
         * @return a Result containing the query result (ResourceSet) and elapsed time
         */
        public Result runQuery() throws Exception {
            Collection col = IndexedSearchTest.this.client.getCollection(IndexedSearchTest.INDEXED_SEARCH_TEST_COLLECTION_PATH);
            XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");

            org.apache.xindice.Stopwatch aStopwatch = new org.apache.xindice.Stopwatch("Non-indexed starts-with query", true);
            ResourceSet resultSet = xpathservice.query(itsTestQuery);
            aStopwatch.stop();
            return new Result(resultSet, aStopwatch.elapsed());
        }
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

         HttpSession session = request.getSession(true);
  
         // Get a collection instance
         col = getCollection(request,response);
  
         XPathQueryService service = (XPathQueryService)col.getService("XPathQueryService",XMLDBAPIVERSION);
        
         // Get the seach parameters from the form
         String searchtype = request.getParameter("SEARCHTYPE");
         String searchstring = request.getParameter("SEARCHSTRING");
        
         // Setup xpath string depending on search type
         if ( searchtype.equals("fname") || searchtype.equals("lname") ) {
            xpath = "/person[" + searchtype + "='" + searchstring + "']";
         } else if ( searchtype.equals("workphone")) {
            xpath = "/person[phone/@type='work' and phone/text() = '" + searchstring + "' ]" ;
         } else if ( searchtype.equals("homephone")) {
            xpath = "/person[phone/@type='home' and phone/text() = '" + searchstring + "' ]" ;
         } else if ( searchtype.equals("cellphone")) {
            xpath = "/person[phone/@type='cell' and phone/text() = '" + searchstring + "' ]" ;
         } else if ( searchtype.equals("homeemail")) {
            xpath = "/person[email/@type='home' and email/text() = '" + searchstring + "' ]" ;
         } else if ( searchtype.equals("workemail")) {
            xpath = "/person[email/@type='work' and email/text() = '" + searchstring + "' ]" ;
         } else if ( searchtype.equals("homeaddress")) {
            xpath = "/person[address/@type='home' and address/text() = '" + searchstring + "' ]" ;
         } else if ( searchtype.equals("workaddress")) {
            xpath = "/person[address/@type='work' and address/text() = '" + searchstring + "' ]" ;
         }
        
         ResourceSet resultSet = service.query(xpath);
         ResourceIterator results = resultSet.getIterator();
        
         Group group = (Group)session.getAttribute("group");
        
         // Clear out group object...
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

         HttpSession session = request.getSession(true);
  
         // Get a collection instance
         col = getCollection(request,response);
  
         XPathQueryService service = (XPathQueryService)col.getService("XPathQueryService",XMLDBAPIVERSION);
        
         // Get the seach parameters from the form
         String searchstring = request.getParameter("SEARCHSTRING");
        
         ResourceSet resultSet = service.query(searchstring);
         ResourceIterator results = resultSet.getIterator();
        
         Group group = (Group)session.getAttribute("group");
        
         // Clear out group object...
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.