Package org.apache.xindice.xml.dom

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


        if (!col.isMetaEnabled()) {
            // meta information is not enabled !
            throw new Exception(MISSING_META_CONFIGURATION);
        }
        MetaData meta = col.getCollectionMeta();
        Document doc = new DocumentImpl();
        doc.appendChild(meta.streamToXML(doc, true));

        result.put(RESULT, TextWriter.toString(doc));
        return result;
    }
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

        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();
        doc.appendChild(meta.streamToXML(doc, true));

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

public final class NamespaceMap extends HashMap {
    private Element elem = null;

    public Node getContextNode() {
        if (elem == null) {
            Document d = new DocumentImpl();
            elem = d.createElement("nsmap");
            d.appendChild(elem);
            Iterator i = keySet().iterator();
            while (i.hasNext()) {
                String pfx = (String) i.next();
                if (pfx.equals("")) {
                    elem.setAttribute("xmlns", (String) get(pfx));
View Full Code Here

        // FIXME: There is a copy of this same code in org.apache.xindice.client.xmldb.embed.CollectionImpl#nodesetToDocument
        //        It should be refactored into some common place. May be, NodeSetUtil?
        //

        // 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()) {
            final Object element = ns.getNextNode();
            if (element instanceof Node)
            {
                Node n = (Node) element;
   
                if (n.getNodeType() == Node.DOCUMENT_NODE) {
                    n = ((Document) n).getDocumentElement();
                }
   
                if (n instanceof DBNode) {
                    ((DBNode) n).expandSource();
                }
   
                root.appendChild(doc.importNode(n, true));
            }
            else if (element instanceof Boolean || element instanceof Double)
            {
                root.appendChild(doc.createTextNode(element.toString()));
            }
            else if (element instanceof String)
            {
                root.appendChild(doc.createTextNode((String) element));
            }
            else
            {
                throw new XindiceRuntimeException("Unknown result type (" + element.getClass().getName() + ") in nodeset");
            }
View Full Code Here

                Key key = rec.getKey();
                Value val = rec.getValue();
                if (val.getData() != null) {
                    try {
                        if (compressed) {
                            Document doc = new DocumentImpl(val.getData(), symbols, new NodeSource(Collection.this, key));
                            return new ColContainer(key, doc);
                        } else {
                            return new ColContainer(key, DOMParser.toDocument(val));
                        }
                    } catch (Exception e) {
View Full Code Here

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

        }

        this.custom = null;
        Document doc = meta.getCustomDocument();
        if (null != doc) {
            this.custom = new DocumentImpl();
            this.custom.appendChild(
                    this.custom.importNode(doc.getDocumentElement(), true));
        }
        this.dirty = false;
    }
View Full Code Here

                        this.attrs = new Hashtable();
                    }
                    this.attrs.put(attrName, e.getAttribute(A_VALUE));
                }
            } else if (customElemName.equals(elementName)) {
                this.custom = new DocumentImpl();
                Node custdoc = this.custom.importNode(element, true);

                /* if you want really verbose debugging try this */
                if (log.isTraceEnabled()) {
                    log.trace("Appending custom element " + elementName
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.