Package com.sun.org.apache.xalan.internal.xsltc

Examples of com.sun.org.apache.xalan.internal.xsltc.DOM


                    href = "";
                    // %OPT% Optimization to cache the stylesheet DOM.
                    // The stylesheet DOM is built once and cached
                    // in the Templates object.
                    TemplatesImpl templates = (TemplatesImpl)translet.getTemplates();
                    DOM sdom = null;
                    if (templates != null) {
                        sdom = templates.getStylesheetDOM();
                    }

                    // If the cached dom exists, we need to migrate it
View Full Code Here


        }

        // Check if this DOM has already been added to the multiplexer
        int mask = multiplexer.getDocumentMask(uri);
        if (mask != -1) {
            DOM newDom = ((DOMAdapter)multiplexer.getDOMAdapter(uri))
                                       .getDOMImpl();
            if (newDom instanceof DOMEnhancedForDTM) {
                return new SingletonIterator(((DOMEnhancedForDTM)newDom)
                                                               .getDocument(),
                                             true);
            }
        }

        // Check if we can get the DOM from a DOMCache
        DOMCache cache = translet.getDOMCache();
        DOM newdom;

        mask = multiplexer.nextMask(); // peek

        if (cache != null) {
            newdom = cache.retrieveDocument(base, originalUri, translet);
            if (newdom == null) {
                final Exception e = new FileNotFoundException(originalUri);
                throw new TransletException(e);
            }
        } else {
            String accessError = SecuritySupport.checkAccess(uri, translet.getAllowedProtocols(), XalanConstants.ACCESS_EXTERNAL_ALL);
            if (accessError != null) {
                ErrorMsg msg = new ErrorMsg(ErrorMsg.ACCESSING_XSLT_TARGET_ERR,
                        SecuritySupport.sanitizePath(uri), accessError);
                throw new Exception(msg.toString());
            }

            // Parse the input document and construct DOM object
            // Trust the DTMManager to pick the right parser and
            // set up the DOM correctly.
            XSLTCDTMManager dtmManager = (XSLTCDTMManager)multiplexer
                                                              .getDTMManager();
            DOMEnhancedForDTM enhancedDOM =
                    (DOMEnhancedForDTM) dtmManager.getDTM(new StreamSource(uri),
                                            false, null, true, false,
                                            translet.hasIdCall(), cacheDOM);
            newdom = enhancedDOM;

            // Cache the stylesheet DOM in the Templates object
            if (cacheDOM) {
                TemplatesImpl templates = (TemplatesImpl)translet.getTemplates();
                if (templates != null) {
                    templates.setStylesheetDOM(enhancedDOM);
                }
            }

            translet.prepassDocument(enhancedDOM);
            enhancedDOM.setDocumentURI(uri);
        }

        // Wrap the DOM object in a DOM adapter and add to multiplexer
        final DOMAdapter domAdapter = translet.makeDOMAdapter(newdom);
        multiplexer.addDOMAdapter(domAdapter);

        // Create index for any key elements
        translet.buildKeys(domAdapter, null, null, newdom.getDocument());

        // Return a singleton iterator containing the root node
        return new SingletonIterator(newdom.getDocument(), true);
        } catch (Exception e) {
            throw e;
        }
    }
View Full Code Here

        if (dom instanceof DOMEnhancedForDTM) {
            _enhancedDOM = (DOMEnhancedForDTM)dom;
        }
        else if (dom instanceof DOMAdapter) {
            DOM idom = ((DOMAdapter)dom).getDOMImpl();
            if (idom instanceof DOMEnhancedForDTM) {
                _enhancedDOM = (DOMEnhancedForDTM)idom;
            }
        }
    }
View Full Code Here

     * Implements the nodeset() extension function.
     */
    public static DTMAxisIterator nodesetF(Object obj) {
        if (obj instanceof DOM) {
           //final DOMAdapter adapter = (DOMAdapter) obj;
           final DOM dom = (DOM)obj;
           return new SingletonIterator(dom.getDocument(), true);
        }
        else if (obj instanceof DTMAxisIterator) {
           return (DTMAxisIterator) obj;
        }
        else {
View Full Code Here

        // w3cDOM -> DTM -> DOMImpl
        DTMAxisIterator iter = null, childIter = null, attrIter = null;
        if (doc != null) {
            final MultiDOM multiDOM = (MultiDOM) dom;
            DOM idom = (DOM)dtmManager.getDTM(new DOMSource(doc), false,
                                              null, true, false);
            // Create DOMAdapter and register with MultiDOM
            DOMAdapter domAdapter = new DOMAdapter(idom,
                translet.getNamesArray(),
                translet.getUrisArray(),
                translet.getTypesArray(),
                translet.getNamespaceArray());
            multiDOM.addDOMAdapter(domAdapter);

            DTMAxisIterator iter1 = idom.getAxisIterator(Axis.CHILD);
            DTMAxisIterator iter2 = idom.getAxisIterator(Axis.CHILD);
            iter = new AbsoluteIterator(
                new StepIterator(iter1, iter2));

            iter.setStartNode(DTMDefaultBase.ROOTNODE);

            childIter = idom.getAxisIterator(Axis.CHILD);
            attrIter = idom.getAxisIterator(Axis.ATTRIBUTE);
        }

        // Second pass: find DTM handles for every node in the list.
        int[] dtmHandles = new int[n];
        n = 0;
View Full Code Here

            else if (obj instanceof Node) {
                dom.copy(((Node) obj).node, handler);
            }
            else if (obj instanceof DOM) {
                //((DOM)obj).copy(((com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase)((DOMAdapter)obj).getDOMImpl()).getDocument(), handler);
                DOM newDom = (DOM)obj;
                newDom.copy(newDom.getDocument(), handler);
            }
            else {
                String string = obj.toString();         // or call stringF()
                final int length = string.length();
                if (length > _characterArray.length)
View Full Code Here

     * Implements the nodeset() extension function.
     */
    public static DTMAxisIterator nodesetF(Object obj) {
  if (obj instanceof DOM) {
     //final DOMAdapter adapter = (DOMAdapter) obj;
     final DOM dom = (DOM)obj;
     return new SingletonIterator(dom.getDocument(), true);
  }
        else if (obj instanceof DTMAxisIterator) {
     return (DTMAxisIterator) obj;
        }
        else {
View Full Code Here

            final MultiDOM multiDOM = (MultiDOM) dom;

      DTMDefaultBase dtm = (DTMDefaultBase)((DOMAdapter)multiDOM.getMain()).getDOMImpl();
      DTMManager dtmManager = dtm.getManager();
     
      DOM idom = (DOM)dtmManager.getDTM(new DOMSource(doc), false,
                null, true, false);
      // Create DOMAdapter and register with MultiDOM
      DOMAdapter domAdapter = new DOMAdapter(idom,
                translet.getNamesArray(),
                translet.getUrisArray(),
                translet.getTypesArray(),
    translet.getNamespaceArray());
            multiDOM.addDOMAdapter(domAdapter);

      DTMAxisIterator iter1 = idom.getAxisIterator(Axis.CHILD);
      DTMAxisIterator iter2 = idom.getAxisIterator(Axis.CHILD);
            DTMAxisIterator iter = new AbsoluteIterator(
                new StepIterator(iter1, iter2));

       iter.setStartNode(DTMDefaultBase.ROOTNODE);
      return iter;
View Full Code Here

      else if (obj instanceof Node) {
    dom.copy(((Node) obj).node, handler);
      }
      else if (obj instanceof DOM) {
    //((DOM)obj).copy(((com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase)((DOMAdapter)obj).getDOMImpl()).getDocument(), handler);
    DOM newDom = (DOM)obj;
    newDom.copy(newDom.getDocument(), handler);
      }
      else {
    String string = obj.toString();    // or call stringF()
    final int length = string.length();
    if (length > _characterArray.length)
View Full Code Here

                    href = "";
                    // %OPT% Optimization to cache the stylesheet DOM.
                    // The stylesheet DOM is built once and cached
                    // in the Templates object.
                    TemplatesImpl templates = (TemplatesImpl)translet.getTemplates();
                    DOM sdom = null;
                    if (templates != null) {
                        sdom = templates.getStylesheetDOM();
                    }
                   
                    // If the cached dom exists, we need to migrate it
View Full Code Here

TOP

Related Classes of com.sun.org.apache.xalan.internal.xsltc.DOM

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.