Examples of DocumentImpl


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

            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

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

            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

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

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

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

      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

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

         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

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

            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

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

    */
   public Resource getMembersAsResource() throws XMLDBException {
      // This impl works but it would be nice if we just got the result set from
      // the server in this format instead of having to build it. Right now it's
      // pretty innefficient
      Document doc = new DocumentImpl();

      Element set = doc.createElementNS(RESOURCE_SET_NS, "xapi:resourceSet");
      set.setAttributeNS(RESOURCE_SET_NS, "xapi:collectionURI",
         "xmldb:xindice://" + ((XindiceCollection) collection).getCanonicalName());
      set.setAttribute("xmlns:xapi", RESOURCE_SET_NS);
      doc.appendChild(set);

      int i = 0;
      while ( i < resources.size() ) {
         XMLResource res = (XMLResource) resources.get(i);
         Element resource = doc.createElementNS(RESOURCE_SET_NS,
            "xapi:resource");
         resource.setAttributeNS(RESOURCE_SET_NS, "xapi:documentID",
            res.getDocumentId());

         resource.appendChild(doc.importNode(
            ((Document) res.getContentAsDOM()).getDocumentElement(), true));

         set.appendChild(resource);

         i++;
View Full Code Here

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

            }
            else {
               xu.execute(context);
            }

            DocumentImpl doc = new DocumentImpl();
            Element elem = doc.createElementNS(NodeSource.SOURCE_NS, "src:"+NodeSource.SOURCE_MODIFIED);
            elem.setAttribute(NodeImpl.XMLNS_PREFIX+":src", NodeSource.SOURCE_NS);
            doc.appendChild(elem);
            Text count = doc.createTextNode(Integer.toString(xu.getModifiedCount()));
            elem.appendChild(count);
           
            return new NodeListSet(doc.getChildNodes());
         }
         catch ( Exception e ) {
            if( e instanceof QueryException ) {
               throw (QueryException) e.fillInStackTrace();
            }
View Full Code Here

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

    } catch (Exception e) {
      fail("Can't parse xml document! "+e.getMessage());
    }
    MetaData meta = new MetaData();
    meta.streamFromXML(doc.getDocumentElement(), true);
    Document doc2 = new DocumentImpl();
    meta.streamToXML(doc2, true);
    assertEquals(TextWriter.toString(doc), TextWriter.toString(doc2));
  }
View Full Code Here

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

      try {
         doc = DOMParser.toDocument(xml);

         // Have to move it to Xindice DOM for XMLObject AutoLinking
         byte[] b = DOMCompressor.Compress(doc, symbols);
         doc = new DocumentImpl(b, symbols, new NodeSource(this, key));

         if ( documentCache != null )
            documentCache.putDocument(this, key, b);
      }
      catch ( Exception e ) {
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.