Examples of XPathQueryService


Examples of org.xmldb.api.modules.XPathQueryService

    private void queryToSAX(ContentHandler handler, Collection collection, String resource) throws SAXException {

        AttributesImpl attributes = new AttributesImpl();

        try {
            XPathQueryService service =
                (XPathQueryService) collection.getService("XPathQueryService", "1.0");
            ResourceSet resultSet = (resource == null) ?
                    service.query(query) : service.queryResource(resource, query);

            attributes.addAttribute("", QUERY_ATTR, QUERY_ATTR, "CDATA", query);
            attributes.addAttribute("", RESULTS_COUNT_ATTR,
                    RESULTS_COUNT_ATTR, "CDATA", Long.toString(resultSet.getSize()));
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

           
           
            String colstring = normalizeCollectionURI( (String)table.get(XMLTools.COLLECTION),
                                                       (String) table.get(XMLTools.LOCAL) );
            String querystring = (String)table.get(XMLTools.QUERY);
            XPathQueryService service = null;
            ResourceIterator results = null;

            col = DatabaseManager.getCollection( colstring );
           
            if ( col == null ) {
               System.out.println("ERROR : Collection not found!");
               return false;
            }
           
            service = (XPathQueryService)col.getService("XPathQueryService","1.0");
            addNamespaces(service, (String)table.get("namespaces"));
           
            ResourceSet resultSet = service.query(querystring);
            results = resultSet.getIterator();
           
            while (results.hasMoreResources() ) {
                XMLResource resource = (XMLResource)results.nextResource();
                String documentstr = (String)resource.getContent();
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

      if ( col.isOpen() )
      {

        try
        {
          XPathQueryService service = (XPathQueryService) col.getService("XPathQueryService", "1.0");

          rs = service.query(query);
          ResourceIterator results = rs.getIterator();

          if (results.hasMoreResources() == false)
          {
              getLogger ().debug ("DBXMLAUTH: auth failed");
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

    private void queryToSAX(ContentHandler handler, Collection collection, String resource) throws SAXException {

        AttributesImpl attributes = new AttributesImpl();

        try {
            XPathQueryService service =
                (XPathQueryService) collection.getService("XPathQueryService", "1.0");
            ResourceSet resultSet = (resource == null) ?
                    service.query(query) : service.queryResource(resource, query);

            attributes.addAttribute("", QUERY_ATTR, QUERY_ATTR, "CDATA", query);
            attributes.addAttribute("", RESULTS_COUNT_ATTR,
                    RESULTS_COUNT_ATTR, "CDATA", Long.toString(resultSet.getSize()));
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

                return false;
            }

            String colstring = normalizeCollectionURI((String) table.get(XMLTools.COLLECTION), (String) table.get(XMLTools.LOCAL));
            String querystring = (String) table.get(XMLTools.QUERY);
            XPathQueryService service = null;
            ResourceIterator results = null;

            col = DatabaseManager.getCollection(colstring);

            if (col == null) {
                System.out.println("ERROR : Collection not found!");
                return false;
            }

            service = (XPathQueryService) col.getService("XPathQueryService", "1.0");
            addNamespaces(service, (String) table.get("namespaces"));

            ResourceSet resultSet = service.query(querystring);
            results = resultSet.getIterator();

            while (results.hasMoreResources()) {
                XMLResource resource = (XMLResource) results.nextResource();
                String documentstr = (String) resource.getContent();
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

    try {

      collection = getCollection("xmldb:xindice:///db/addressbook");

      String xpath = "//person[fname='John']";
      XPathQueryService service = (XPathQueryService) collection.getService("XPathQueryService", "1.0");
      ResourceSet resourceSet = service.query(xpath);
      ResourceIterator resourceIterator = resourceSet.getIterator();

      while (resourceIterator.hasMoreResources()) {
        Resource resource = resourceIterator.nextResource();
        System.out.println((String) resource.getContent());
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

  public void testSimpleQuery() throws Exception
  {
    String query = "//person[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(2, res.size());
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

  public void testSimpleAndQuery() 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

  public void testSimpleOrQuery() throws Exception
  {
    String query = "//person[first='John' or 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(2, res.size());
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService

  public void testMultipleOrQuery() throws Exception
  {
    String query = "//person[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
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.