Package org.apache.xindice.xml.dom

Examples of org.apache.xindice.xml.dom.DocumentImpl


      if(!message.containsKey(NAME)) {
         throw new Exception(MISSING_NAME_PARAM);
      }
      String docname = (String)message.get(NAME);
      MetaData meta = col.getDocumentMeta(docname);
      Document doc = new DocumentImpl();
      meta.streamToXML(doc, true);

      result.put( RESULT, TextWriter.toString( doc ) );
      return result;
   }
View Full Code Here


    * @return the result set as an XML document
    * @exception Exception
    */
   private String queryWrapper( NodeSet ns ) throws Exception {
      // Turn the NodeSet into a document.
      DocumentImpl doc = new DocumentImpl();

      Element root = doc.createElement( "result" );
      doc.appendChild( root );
      int count = 0;
      while ( ns != null && ns.hasMoreNodes() ) {
         Node n = ns.getNextNode();

         if ( n.getNodeType() == Node.DOCUMENT_NODE ) {
            n = ( ( Document ) n ).getDocumentElement();
         }

         if ( n instanceof DBNode ) {
            ( ( DBNode ) n ).expandSource();
         }

         root.appendChild( doc.importNode( n, true ) );
         count++;
      }

      root.setAttribute( "count", Integer.toString( count ) );

View Full Code Here

         String name = doc.getDocumentElement().getAttribute("name");
         message.put(NAME, name);
      }
      // Otherwise we need to build the configuration from the name and pattern.
      else {
         doc = new DocumentImpl();

         // Create the index element to hold attributes
         Element index = doc.createElement("index");

         index.setAttribute("class", "org.apache.xindice.core.indexer.ValueIndexer");
View Full Code Here

            Indexer idx = context.getIndexManager().getBestIndexer(Indexer.STYLE_NODEVALUE, pattern);
            if ( idx != null )
               return new NamedKeys(nk.name, nk.attribute, QueryEngine.getUniqueKeys(idx.queryMatches(iq)));
            else if ( autoIndex ) {
               // TODO: This has to *not* be hardcoded
               Element e = new DocumentImpl().createElement("index");
               e.setAttribute("class", "org.apache.xindice.core.indexer.ValueIndexer");
               e.setAttribute("name", "xp_"+ps);
               e.setAttribute("pattern", ps);

               // Set the type for the index
View Full Code Here

            if ( rec == null )
               continue;
           
            Key key = rec.getKey();
            Document doc = new DocumentImpl(rec.getValue().getData(), symbols, new NodeSource(collection, key));
            try {
               new SAXHandler(key, doc, ACTION_CREATE, list);
            }
            catch ( Exception e ) {
               if (log.isDebugEnabled()) {
View Full Code Here

            throw new Exception( "Unable to parse Collection configuration" );
         }
      }
      // Otherwise we need to build the configuration from the name and pattern.
      else {
         doc = new DocumentImpl();

         Element colEle = doc.createElement("collection");
         colEle.setAttribute("compressed", "true");
         colEle.setAttribute("name", (String) message.get(NAME));
         doc.appendChild(colEle);
View Full Code Here

                // Create a collection manager instance for the collection
                CollectionManager colman = (CollectionManager)col.getService("CollectionManager",XMLDBAPIVERSION);
   
                if (table.get(XMLTools.NAME_OF) != null && table.get(XMLTools.PATTERN) != null ) {
               
                    Document doc = new DocumentImpl();

                    // Create the index element to hold attributes
                    Element idxEle = doc.createElement("index");
                    idxEle.setAttribute("class", XINDICE_VAL_INDEXER);
                    idxEle.setAttribute("name", (String)table.get(XMLTools.NAME_OF));
                    idxEle.setAttribute("pattern", (String)table.get(XMLTools.PATTERN) );


                    // Setup optional index attributes
                    if ( table.containsKey(XMLTools.TYPE) ) {
                        String t = (String)table.get(XMLTools.TYPE);
                        if ( t.equalsIgnoreCase("name") )
                           idxEle.setAttribute("class", XINDICE_NAME_INDEXER);
                        else
                           idxEle.setAttribute("type", (String)table.get(XMLTools.TYPE));
                    }

                    if ( table.containsKey(XMLTools.PAGE_SIZE) ) {
                        idxEle.setAttribute("pagesize", (String)table.get(XMLTools.PAGE_SIZE));
                    }

                    if (table.containsKey(XMLTools.MAX_KEY_SIZE) ) {
                        idxEle.setAttribute("maxkeysize", (String)table.get(XMLTools.MAX_KEY_SIZE) );
                    }

                    // Add Element to the document
                    doc.appendChild(idxEle);
                       
                    //If in verbose mode, show....
                    if ( (String)table.get(XMLTools.VERBOSE) == "true" ) {
                        String indexstr = TextWriter.toString(doc);
                        System.out.println("Index node element = ");
View Full Code Here

      Document doc = DOMParser.toDocument( metaxml );
      meta.streamFromXML(doc.getDocumentElement());
      col.setCollectionMeta(meta);

    MetaData ret_meta = col.getCollectionMeta();
      Document ret_doc = new DocumentImpl();
      ret_meta.streamToXML(ret_doc, true);
   
      result.put( RESULT, TextWriter.toString( ret_doc ) );
      return result;
   }
View Full Code Here

         SymbolTable symbols, byte[] bytes) throws XMLDBException {
      this.collection = collection;
      this.symbols = symbols;
      this.bytes = bytes;

      initResources(new DocumentImpl(bytes, symbols, null));
   }
View Full Code Here

            Node n = nodes.item(i);
            String documentId = ((Element) n).getAttributeNS(
               NodeSource.SOURCE_NS, "key");

            if ( bytes != null ) {
               DocumentImpl doc = new DocumentImpl();
               doc.setSymbols(symbols);
               doc.importNode(n, true);
               doc.appendChild(n);
               byte[] b = DOMCompressor.Compress(doc, symbols);
               resource = new XMLResourceImpl(null, documentId, collection,
                  symbols, b);
            }
            else {
View Full Code Here

TOP

Related Classes of org.apache.xindice.xml.dom.DocumentImpl

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.