Package org.apache.xindice.xml.dom

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


                documentId = ((Element) n).getAttributeNS(NodeSource.SOURCE_NS, NodeSource.SOURCE_KEY);
            }

            XMLResource resource;
            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 {
                resource = new XMLResourceImpl(null, documentId, collection, TextWriter.toString(n));
            }
View Full Code Here


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

            }
        }
        // Otherwise we need to build the configuration from the name and pattern.
        else {
            // FIXME Use default config defined somewhere 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

     * @param buffer The Hashtable
     * @return The Document
     */
    public Document convertToDocument(Hashtable buffer) {
        SymbolTable s = getSymbols(buffer);
        return new DocumentImpl((byte[]) buffer.get("document"), s, null);
    }
View Full Code Here

     */
    public SymbolTable getSymbols(Hashtable buffer) {
        //if ( ((Long) buffer.get("timestamp")).longValue() != lastMod ) {
        // lastMod = ((Long) buffer.get("timestamp")).longValue();

        Document doc = new DocumentImpl((byte[]) buffer.get("symbols"), hcSyms, null);

        if (syms == null) {
            syms = new SymbolTable();
        }

        synchronized (syms) {
            syms.streamFromXML(doc.getDocumentElement());
        }
        // }
        return syms;
    }
View Full Code Here

            }

            if (inlineMetaService == null || metaMap.get("type").equals(ResourceTypeReader.XML)) {
                Document document;
                if (compressed) {
                    document = new DocumentImpl(value.getData(), symbols, new NodeSource(this, key));
                    flushSymbolTable();
                    if (log.isTraceEnabled()) {
                        log.trace(localDebugHeader +
                                  "Compressed XML document=<" + TextWriter.toString(document) + ">");
                    }
View Full Code Here

            }

            // Create xindice document with just compressed bytes.
            // Passed in document might not necessarily be xindice document,
            // but we should be passing only our documents to index manager.
            document = new DocumentImpl(documentBytes, symbols, new NodeSource(this, key));

            if (log.isTraceEnabled()) {
                log.trace(localDebugHeader + "packedDocument: length=" + documentBytes.length +
                          " document=<" + TextWriter.toString(document) + ">");
            }
View Full Code Here

    private void putObject(Key key, XMLSerializable obj) throws DBException {
        if (log.isTraceEnabled()) {
            log.trace(debugHeader() + "putObject: key=<" + key + "> class=<" + obj.getClass().getName() + ">");
        }

        Document doc = new DocumentImpl();
        ProcessingInstruction pi = doc.createProcessingInstruction(CLASSNAME, obj.getClass().getName());
        doc.appendChild(pi);
        Element elem = obj.streamToXML(doc);
        doc.appendChild(elem);
        putDocument(key, doc /*, create */);
    }
View Full Code Here

                try {
                    symbols = getSystemCollection().loadSymbols(this);
                    if (log.isDebugEnabled()) {
                        log.debug(localDebugHeader + "Loaded symbols=<" +
                                  TextWriter.toString(symbols.streamToXML(new DocumentImpl())) + ">");
                    }
                } catch (Exception e) {
                    if (log.isWarnEnabled()) {
                        log.warn(localDebugHeader + "Error building symbol table from system collection", e);
                    }
View Full Code Here

     * @return The Content value
     * @exception XMLDBException
     */
    public Object getContent() throws XMLDBException {
        if (bytes != null) {
            DocumentImpl doc = new DocumentImpl(bytes, symbols, null);
            return TextWriter.toString(doc);
        } else {
            return content;
        }
    }
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.