Package org.apache.xindice.xml.dom

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


    }

    public SAXEventGenerator(Document doc) {
        try {
            if (doc instanceof CompressedDocument) {
                CompressedDocument cDoc = new DocumentImpl(doc);
                symbols = cDoc.getSymbols();
                data = cDoc.getDataBytes();
                pos = cDoc.getDataPos();
                len = cDoc.getDataLen();
            } else {
                symbols = new SymbolTable();
                data = DOMCompressor.Compress(doc, symbols);
                pos = 0;
                len = data.length;
View Full Code Here


          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

                    continue;
                }

                Key key = rec.getKey();
                // FIXME: What about inline metadata???
                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.isWarnEnabled()) {
                        log.warn("ignored exception", e);
View Full Code Here

                if (colName.equals("")) {
                    System.out.println("Cannot create a NULL collection");
                    return false;
                }

                Document doc = new DocumentImpl();

                Element colEle = doc.createElement("collection");
                colEle.setAttribute("compressed", "true");
                colEle.setAttribute("name", colName);

                doc.appendChild(colEle);

                Element filEle = doc.createElement("filer");
                filEle.setAttribute("class", "org.apache.xindice.core.filer.BTreeFiler");
                //filEle.setAttribute("gzip", "true");
                if (table.containsKey(XMLTools.PAGE_SIZE)) {
                    filEle.setAttribute("pagesize", (String) table.get(XMLTools.PAGE_SIZE));
                }
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

            return (Document) v;
        } else if (v instanceof byte[]) {
            try {
                SymbolTable s = col.getSymbols();
                NodeSource ns = new NodeSource(col, key);
                return new DocumentImpl((byte[]) v, s, ns);
            } catch (Exception e) {
                if (log.isWarnEnabled()) {
                    log.warn("ignored exception", e);
                }
            }
View Full Code Here

                    }
                } 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();
                }
                throw new ProcessingException("Error executing XUpdate query", e);
View Full Code Here

        }
        return parser.getDocument();
    }

    public Document newDocument() {
        return new DocumentImpl();
    }
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

            if (id != null) {
                params.put(RPCDefaultMessage.NAME, id);
            }
            params.put(RPCDefaultMessage.COMPRESSED, "true");

            Document doc = new DocumentImpl();
            doc.appendChild(meta.streamToXML(doc, true));
            params.put(RPCDefaultMessage.META, TextWriter.toString(doc));

            // Object result =
            runRemoteCommand(id == null ? "SetCollectionMeta" : "SetDocumentMeta", params);
            // Document metaDoc = DOMParser.toDocument(result.toString());
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.