Examples of XPathQueryService


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

         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

Examples of org.xmldb.api.modules.XPathQueryService

         Group group = (Group)session.getAttribute("group");
  
         // Get a collection instance
         col = getCollection(request,response);
  
         XPathQueryService service = (XPathQueryService)col.getService("XPathQueryService",XMLDBAPIVERSION);
  
         // Get all Person elements from the database
         ResourceSet resultSet = service.query("/person");
         ResourceIterator results = resultSet.getIterator();
        
         // Clear out group object...
         group.removeAll();
        
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

      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, XMLDBException {

        AttributesImpl attributes = new AttributesImpl();

        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

      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
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.