Package org.apache.xindice.xml.dom

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


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


         doc = (Document)v;
      else if ( v instanceof byte[] ) {
         try {
            SymbolTable s = col.getSymbols();
            NodeSource ns = new NodeSource(col, key);
            doc = new DocumentImpl((byte[])v, s, ns);
         }
         catch ( Exception e ) {
         }
      }
      return doc;
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

                    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 {
                    resource = new XMLResourceImpl(null, documentId, collection,
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

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

     * @exception XMLDBException
     */
    public Node getContentAsDOM() throws XMLDBException {
        try {
            if (bytes != null) {
                return new DocumentImpl(bytes, symbols, null);
            } else {
                return DOMParser.toDocument(content);
            }
        } catch (Exception e) {
            throw FaultCodes.createXMLDBException(e);
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

        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

                if (log.isTraceEnabled()) {
                    log.trace(localDebugHeader + "length=" + documentBytes.length);
                }

                // Why must it be re-created?
                document = new DocumentImpl(documentBytes, symbols, new NodeSource(this, key));
                if (log.isTraceEnabled()) {
                    log.trace(localDebugHeader + "packedDocument: length=" + documentBytes.length +
                              " document=<" + TextWriter.toString(document) + ">");
                }
            } catch (Exception e) {
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.