Package org.apache.xalan.xsltc.runtime

Examples of org.apache.xalan.xsltc.runtime.AbstractTranslet


    }

    public int next() {
  final int last = _nodes.cardinality();
  final int currentNode = _currentNode;
  final AbstractTranslet translet = _translet;

  for (int index = _currentIndex; index < last; ) {
      final int position = _docOrder ? index + 1 : last - index;
      final int node = _nodes.at(index++);   // note increment
View Full Code Here


    }

    private int computePositionOfLast() {
        final int last = _nodes.cardinality();
        final int currNode = _currentNode;
  final AbstractTranslet translet = _translet;

  int lastPosition = _position;
  for (int index = _currentIndex; index < last; ) {
      final int position = _docOrder ? index + 1 : last - index;
            int nodeIndex = _nodes.at(index++);   // note increment
View Full Code Here

  // non-existing document
  if (dom == null) return null;

  doc.incAccessCount(); // For statistics

  final AbstractTranslet translet = (AbstractTranslet)trs;

  // Set minimum needed size for key/id indices in the translet
  translet.setIndexSize(dom.getSize());
  // Create index for any ID attributes defined in the document DTD
  dtd.buildIdIndex(dom, mask, translet);
  // Pass all unparsed entities to the translet
  translet.setUnparsedEntityURIs(dtd.getUnparsedEntityURIs());

  return(doc.getDocument());
    }
View Full Code Here

  // non-existing document
  if (dom == null) return null;

  doc.incAccessCount(); // For statistics

  final AbstractTranslet translet = (AbstractTranslet)trs;

  // Give the translet an early opportunity to extract any
        // information from the DOM object that it would like.
  translet.prepassDocument(dom);

  return(doc.getDocument());
    }
View Full Code Here

    // Get a refenrence to the translet class
    final Class tc = Class.forName(transletName);

    // Instanciate and initialise the tranlet object
    AbstractTranslet translet = (AbstractTranslet)tc.newInstance();
    ((AbstractTranslet)translet).setMessageHandler(msgHandler);

    // Create output handler
    TransletOutputHandlerFactory tohFactory =
        TransletOutputHandlerFactory.newInstance();
    tohFactory.setOutputType(TransletOutputHandlerFactory.STREAM);
    tohFactory.setEncoding(translet._encoding);
    tohFactory.setOutputMethod(translet._method);
    tohFactory.setWriter(out);

    getDOM(documentUrl);

    final long start = System.currentTimeMillis();

    // Set size of key/id indices
    translet.setIndexSize(_dom.getSize());
    // If there are any elements with ID attributes, build an index

    _dtdMonitor.buildIdIndex(_dom, 0, translet);
    // Pass unparsed entities to translet
    translet.setUnparsedEntityURIs(_dtdMonitor.
                 getUnparsedEntityURIs());
    // Do the actual transformation
    translet.transform(_dom, tohFactory.getTransletOutputHandler());

    final long done = System.currentTimeMillis() - start;
    out.println("<!-- transformed by XSLTC in "+done+"msecs -->");
      }
      // Now close up the sink, and return the HTML output in the
View Full Code Here

    out.println(nullErrorMsg);
      }
      else {
    // Instanciate a translet object (inherits AbstractTranslet)
          Class tc = Class.forName(transletName);
    AbstractTranslet translet = (AbstractTranslet)tc.newInstance();

    // Read input document from the DOM cache
    DOMImpl dom = getDOM(document, translet);

    // Create output handler
    TransletOutputHandlerFactory tohFactory =
        TransletOutputHandlerFactory.newInstance();
    tohFactory.setOutputType(TransletOutputHandlerFactory.STREAM);
    tohFactory.setEncoding(translet._encoding);
    tohFactory.setOutputMethod(translet._method);
    tohFactory.setWriter(out);

    // Start the transformation
    final long start = System.currentTimeMillis();
    translet.transform(dom, tohFactory.getTransletOutputHandler());
    final long done = System.currentTimeMillis() - start;
    out.println("<!-- transformed by XSLTC in "+done+"msecs -->");
      }
  }
View Full Code Here

      }
      else {
    // Get a reference to the translet class
          Class transletClass = Class.forName(transletName);
    // Instanciate the translet object (inherits AbstractTranslet)
    AbstractTranslet translet =
        (AbstractTranslet)transletClass.newInstance();
    translet.setDOMCache(cache);

    // Get the DOM from the DOM cache
    DOMImpl dom = cache.retrieveDocument(document, 0, translet);

    if (dom == null) {
        errorMessage("Could not locate: \"<b>"+document+"\"</b>");
    }
    else {
        // Create output handler
        TransletOutputHandlerFactory tohFactory =
      TransletOutputHandlerFactory.newInstance();
        tohFactory.setOutputType(TransletOutputHandlerFactory.STREAM);
        tohFactory.setEncoding(translet._encoding);
        tohFactory.setOutputMethod(translet._method);
        tohFactory.setWriter(_out);

        // Do the actual transformation
        final long start = System.currentTimeMillis();
        translet.transform(dom, tohFactory.getTransletOutputHandler());
        final long done = System.currentTimeMillis() - start;
        _out.println("<!-- transformed by XSLTC in "+done+"ms -->");
    }
      }
  }
View Full Code Here

      }
      else {
    // Get a reference to the translet class (not object yet)
          Class tc = Class.forName(className);
    // Instanciate a translet object (inherits AbstractTranslet)
    AbstractTranslet translet = (AbstractTranslet)tc.newInstance();

    // Set the document cache for the translet. This is needed in
    // case the translet uses the document() function.
    translet.setDOMCache(cache);

    // Read input document from the DOM cache
    DOMImpl dom = cache.retrieveDocument(documentURI, 0, translet);

    // Create output handler
    TransletOutputHandlerFactory tohFactory =
        TransletOutputHandlerFactory.newInstance();
    tohFactory.setOutputType(TransletOutputHandlerFactory.STREAM);
    tohFactory.setEncoding(translet._encoding);
    tohFactory.setOutputMethod(translet._method);
    tohFactory.setWriter(out);

    // Start the transformation
    final long start = System.currentTimeMillis();
    translet.transform(dom, tohFactory.getTransletOutputHandler());
    final long done = System.currentTimeMillis() - start;
    out.println("<!-- transformed by XSLTC in "+done+"msecs -->");
      }
  }
  catch (IOException e) {
View Full Code Here

    // quitely ignored
      }
     
      // Create a DTD monitor and pass it to the XMLReader object
      final DTDMonitor dtdMonitor = new DTDMonitor(reader);
      AbstractTranslet _translet = (AbstractTranslet)translet;
      dom.setDocumentURI(_fileName);
      if (_uri)
    reader.parse(_fileName);
      else
    reader.parse(new File(_fileName).toURL().toExternalForm());

      builder = null;

      // If there are any elements with ID attributes, build an index
      dtdMonitor.buildIdIndex(dom, 0, _translet);
      // Pass unparsed entity descriptions to the translet
      _translet.setDTDMonitor(dtdMonitor);

      // Pass global parameters
      int n = _params.size();
      for (int i = 0; i < n; i++) {
    Parameter param = (Parameter) _params.elementAt(i);
View Full Code Here

    }

    public int next() {
  final int last = _nodes.cardinality();
  final int currentNode = _currentNode;
  final AbstractTranslet translet = _translet;

  for (int index = _currentIndex; index < last; ) {
      final int position = _docOrder ? index + 1 : last - index;
      final int node = _nodes.at(index++);   // note increment
View Full Code Here

TOP

Related Classes of org.apache.xalan.xsltc.runtime.AbstractTranslet

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.