xml-xindice-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jcplerm" <jcpl...@ameritech.net>
Subject How to get rid of namespace? (Xindice 1.1b2)
Date Sun, 03 Aug 2003 03:12:26 GMT
I was able to run a query against a collection using the CollectionImpl class.

I get each and every element in the result set tagged with a namespace, like:

                <elem1 id="k2" xmlns:src="http://xml.apache.org/xindice/Query">
                        <type xmlns:src="http://xml.apache.org/xindice/Query">AK</type>
                        <elem2 xmlns:src="http://xml.apache.org/xindice/Query">
                                <elem3 id="c" xmlns:src="http://xml.apache.org/xindice/Query">
                                        <elem4 xmlns:src="http://xml.apache.org/xindice/Query">A</elem4>
                                <elem3 id="b" xmlns:src="http://xml.apache.org/xindice/Query">
                                        <elem4 xmlns:src="http://xml.apache.org/xindice/Query">D</elem4>

I actually made another version of CollectionImpl.query(), which returns the content from
the server without building a resource set as in:

      public String queryAsString(String name, String queryLang, String query, Hashtable nsMap)
throws XMLDBException {

          try {

              Hashtable params = new Hashtable();
              params.put(RPCDefaultMessage.COLLECTION, collPath);
              params.put(RPCDefaultMessage.TYPE, queryLang);
              params.put(RPCDefaultMessage.NAMESPACES, nsMap);
              params.put(RPCDefaultMessage.QUERY, query);

              if (name != null) {

                  params.put(RPCDefaultMessage.NAME, name);

              String result = (String) runRemoteCommand("Query", params);
              return result;
          } catch (Exception e) {

              throw FaultCodes.createXMLDBException(FaultCodes.QRY_PROCESSING_ERROR, "Query
error", e);
I then invoke it like:

   String rs=null;
   try {
    rs = coll.queryAsString(null,"XPath","/entity",new Hashtable());
    System.out.println("RESULT===>>> " + rs);
   catch (XMLDBException e) {
    System.out.println("XMLRPCTest.main(): query() failed: " + e.getMessage());
Any ideas?


View raw message