Java Code Examples for com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet

The following examples show how to use com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: openjdk-8   Author: bpupadhyaya   File: CurrentNodeListIterator.java    License: GNU General Public License v2.0 6 votes vote down vote up
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

        if (_filter.test(nodeIndex, position, last, currNode, translet,
                         this)) {
            lastPosition++;
        }
    }
    return lastPosition;
}
 
Example #2
Source Project: openjdk-8   Author: bpupadhyaya   File: LoadDocument.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a DTMAxisIterator for the newdom. This is currently only
 * used to create an iterator for the cached stylesheet DOM.
 *
 * @param newdom the cached stylesheet DOM
 * @param translet the translet
 * @param the main dom (should be a MultiDOM)
 * @return a DTMAxisIterator from the document root
 */
private static DTMAxisIterator document(DOM newdom,
                                        AbstractTranslet translet,
                                        DOM dom)
    throws Exception
{
    DTMManager dtmManager = ((MultiDOM)dom).getDTMManager();
    // Need to migrate the cached DTM to the new DTMManager
    if (dtmManager != null && newdom instanceof DTM) {
        ((DTM)newdom).migrateTo(dtmManager);
    }

    translet.prepassDocument(newdom);

    // Wrap the DOM object in a DOM adapter and add to multiplexer
    final DOMAdapter domAdapter = translet.makeDOMAdapter(newdom);
    ((MultiDOM)dom).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);
}
 
Example #3
Source Project: openjdk-8-source   Author: keerath   File: NodeSortRecord.java    License: GNU General Public License v2.0 6 votes vote down vote up
private final Double numericValue(int level) {
    // Get value from our vector if possible
    if (_scanned <= level) {
        AbstractTranslet translet = _settings.getTranslet();

        // Get value from DOM if accessed for the first time
        final String str = extractValueFromDOM(_dom, _node, level,
                                               translet, _last);
        Double num;
        try {
            num = new Double(str);
        }
        // Treat number as NaN if it cannot be parsed as a double
        catch (NumberFormatException e) {
            num = new Double(Double.NEGATIVE_INFINITY);
        }
        _values[_scanned++] = num;
        return(num);
    }
    return((Double)_values[level]);
}
 
Example #4
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: CurrentNodeListIterator.java    License: GNU General Public License v2.0 6 votes vote down vote up
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

        if (_filter.test(node, position, last, currentNode, translet,
                         this)) {
            _currentIndex = index;
            return returnNode(node);
        }
    }
    return END;
}
 
Example #5
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: LoadDocument.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static DTMAxisIterator document(DTMAxisIterator arg1,
                                        String baseURI,
                                        AbstractTranslet translet, DOM dom)
throws Exception
{
    UnionIterator union = new UnionIterator(dom);
    int node = DTM.NULL;

    while ((node = arg1.next()) != DTM.NULL) {
        String uri = dom.getStringValueX(node);
        //document(node-set) if true;  document(node-set,node-set) if false
        if (baseURI  == null) {
           baseURI = dom.getDocumentURI(node);
           if (!SystemIDResolver.isAbsoluteURI(baseURI))
                baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
        }
        union.addIterator(document(uri, baseURI, translet, dom));
    }
    return(union);
}
 
Example #6
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: CurrentNodeListIterator.java    License: Apache License 2.0 6 votes vote down vote up
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

        if (_filter.test(node, position, last, currentNode, translet,
                         this)) {
            _currentIndex = index;
            return returnNode(node);
        }
    }
    return END;
}
 
Example #7
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: TransformerImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
protected TransformerImpl(Translet translet, Properties outputProperties,
    int indentNumber, TransformerFactoryImpl tfactory)
{
    _translet = (AbstractTranslet) translet;
    _properties = createOutputProperties(outputProperties);
    _propertiesClone = (Properties) _properties.clone();
    _indentNumber = indentNumber;
    _tfactory = tfactory;
    _overrideDefaultParser = _tfactory.overrideDefaultParser();
    _accessExternalDTD = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_DTD);
    _securityManager = (XMLSecurityManager)_tfactory.getAttribute(XalanConstants.SECURITY_MANAGER);
    _readerManager = XMLReaderManager.getInstance(_overrideDefaultParser);
    _readerManager.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
    _readerManager.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _isSecureProcessing);
    _readerManager.setProperty(XalanConstants.SECURITY_MANAGER, _securityManager);
    //_isIncremental = tfactory._incremental;
}
 
Example #8
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: LoadDocument.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static DTMAxisIterator document(DTMAxisIterator arg1,
                                        String baseURI,
                                        AbstractTranslet translet, DOM dom)
throws Exception
{
    UnionIterator union = new UnionIterator(dom);
    int node = DTM.NULL;

    while ((node = arg1.next()) != DTM.NULL) {
        String uri = dom.getStringValueX(node);
        //document(node-set) if true;  document(node-set,node-set) if false
        if (baseURI  == null) {
           baseURI = dom.getDocumentURI(node);
           if (!SystemIDResolver.isAbsoluteURI(baseURI))
                baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
        }
        union.addIterator(document(uri, baseURI, translet, dom));
    }
    return(union);
}
 
Example #9
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: LoadDocument.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Create a DTMAxisIterator for the newdom. This is currently only
 * used to create an iterator for the cached stylesheet DOM.
 *
 * @param newdom the cached stylesheet DOM
 * @param translet the translet
 * @param the main dom (should be a MultiDOM)
 * @return a DTMAxisIterator from the document root
 */
private static DTMAxisIterator document(DOM newdom,
                                        AbstractTranslet translet,
                                        DOM dom)
    throws Exception
{
    DTMManager dtmManager = ((MultiDOM)dom).getDTMManager();
    // Need to migrate the cached DTM to the new DTMManager
    if (dtmManager != null && newdom instanceof DTM) {
        ((DTM)newdom).migrateTo(dtmManager);
    }

    translet.prepassDocument(newdom);

    // Wrap the DOM object in a DOM adapter and add to multiplexer
    final DOMAdapter domAdapter = translet.makeDOMAdapter(newdom);
    ((MultiDOM)dom).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);
}
 
Example #10
Source Project: openjdk-8-source   Author: keerath   File: TransformerImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
protected TransformerImpl(Translet translet, Properties outputProperties,
    int indentNumber, TransformerFactoryImpl tfactory)
{
    _translet = (AbstractTranslet) translet;
    _properties = createOutputProperties(outputProperties);
    _propertiesClone = (Properties) _properties.clone();
    _indentNumber = indentNumber;
    _tfactory = tfactory;
    _useServicesMechanism = _tfactory.useServicesMechnism();
    _accessExternalStylesheet = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET);
    _accessExternalDTD = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_DTD);
    _securityManager = (XMLSecurityManager)_tfactory.getAttribute(XalanConstants.SECURITY_MANAGER);
    _readerManager = XMLReaderManager.getInstance(_useServicesMechanism);
    _readerManager.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
    _readerManager.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _isSecureProcessing);
    _readerManager.setProperty(XalanConstants.SECURITY_MANAGER, _securityManager);
    //_isIncremental = tfactory._incremental;
}
 
Example #11
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: LoadDocument.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a DTMAxisIterator for the newdom. This is currently only
 * used to create an iterator for the cached stylesheet DOM.
 *
 * @param newdom the cached stylesheet DOM
 * @param translet the translet
 * @param the main dom (should be a MultiDOM)
 * @return a DTMAxisIterator from the document root
 */
private static DTMAxisIterator document(DOM newdom,
                                        AbstractTranslet translet,
                                        DOM dom)
    throws Exception
{
    DTMManager dtmManager = ((MultiDOM)dom).getDTMManager();
    // Need to migrate the cached DTM to the new DTMManager
    if (dtmManager != null && newdom instanceof DTM) {
        ((DTM)newdom).migrateTo(dtmManager);
    }

    translet.prepassDocument(newdom);

    // Wrap the DOM object in a DOM adapter and add to multiplexer
    final DOMAdapter domAdapter = translet.makeDOMAdapter(newdom);
    ((MultiDOM)dom).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);
}
 
Example #12
Source Project: openjdk-8   Author: bpupadhyaya   File: LoadDocument.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static DTMAxisIterator document(DTMAxisIterator arg1,
                                        String baseURI,
                                        AbstractTranslet translet, DOM dom)
throws Exception
{
    UnionIterator union = new UnionIterator(dom);
    int node = DTM.NULL;

    while ((node = arg1.next()) != DTM.NULL) {
        String uri = dom.getStringValueX(node);
        //document(node-set) if true;  document(node-set,node-set) if false
        if (baseURI  == null) {
           baseURI = dom.getDocumentURI(node);
           if (!SystemIDResolver.isAbsoluteURI(baseURI))
                baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
        }
        union.addIterator(document(uri, baseURI, translet, dom));
    }
    return(union);
}
 
Example #13
Source Project: hottub   Author: dsrg-uoft   File: CurrentNodeListIterator.java    License: GNU General Public License v2.0 6 votes vote down vote up
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

        if (_filter.test(node, position, last, currentNode, translet,
                         this)) {
            _currentIndex = index;
            return returnNode(node);
        }
    }
    return END;
}
 
Example #14
Source Project: jdk8u60   Author: chenghanpeng   File: NodeSortRecord.java    License: GNU General Public License v2.0 6 votes vote down vote up
private final Double numericValue(int level) {
    // Get value from our vector if possible
    if (_scanned <= level) {
        AbstractTranslet translet = _settings.getTranslet();

        // Get value from DOM if accessed for the first time
        final String str = extractValueFromDOM(_dom, _node, level,
                                               translet, _last);
        Double num;
        try {
            num = new Double(str);
        }
        // Treat number as NaN if it cannot be parsed as a double
        catch (NumberFormatException e) {
            num = new Double(Double.NEGATIVE_INFINITY);
        }
        _values[_scanned++] = num;
        return(num);
    }
    return((Double)_values[level]);
}
 
Example #15
Source Project: hottub   Author: dsrg-uoft   File: CurrentNodeListIterator.java    License: GNU General Public License v2.0 6 votes vote down vote up
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

        if (_filter.test(nodeIndex, position, last, currNode, translet,
                         this)) {
            lastPosition++;
        }
    }
    return lastPosition;
}
 
Example #16
Source Project: jdk8u60   Author: chenghanpeng   File: CurrentNodeListIterator.java    License: GNU General Public License v2.0 6 votes vote down vote up
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

        if (_filter.test(node, position, last, currentNode, translet,
                         this)) {
            _currentIndex = index;
            return returnNode(node);
        }
    }
    return END;
}
 
Example #17
Source Project: jdk8u60   Author: chenghanpeng   File: CurrentNodeListIterator.java    License: GNU General Public License v2.0 6 votes vote down vote up
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

        if (_filter.test(nodeIndex, position, last, currNode, translet,
                         this)) {
            lastPosition++;
        }
    }
    return lastPosition;
}
 
Example #18
Source Project: openjdk-8   Author: bpupadhyaya   File: CurrentNodeListIterator.java    License: GNU General Public License v2.0 6 votes vote down vote up
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

        if (_filter.test(node, position, last, currentNode, translet,
                         this)) {
            _currentIndex = index;
            return returnNode(node);
        }
    }
    return END;
}
 
Example #19
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: NodeSortRecord.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
   * Get the string or numeric value of a specific level key for this sort
   * element. The value is extracted from the DOM if it is not already in
   * our sort key vector.
   */
  private final Comparable stringValue(int level) {
      // Get value from our array if possible
      if (_scanned <= level) {
          AbstractTranslet translet = _settings.getTranslet();
          Locale[] locales = _settings.getLocales();
          String[] caseOrder = _settings.getCaseOrders();

          // Get value from DOM if accessed for the first time
          final String str = extractValueFromDOM(_dom, _node, level,
                                                 translet, _last);
          final Comparable key =
              StringComparable.getComparator(str, locales[level],
                                             _collators[level],
                                             caseOrder[level]);
          _values[_scanned++] = key;
          return(key);
      }
      return((Comparable)_values[level]);
}
 
Example #20
Source Project: jdk8u60   Author: chenghanpeng   File: LoadDocument.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a DTMAxisIterator for the newdom. This is currently only
 * used to create an iterator for the cached stylesheet DOM.
 *
 * @param newdom the cached stylesheet DOM
 * @param translet the translet
 * @param the main dom (should be a MultiDOM)
 * @return a DTMAxisIterator from the document root
 */
private static DTMAxisIterator document(DOM newdom,
                                        AbstractTranslet translet,
                                        DOM dom)
    throws Exception
{
    DTMManager dtmManager = ((MultiDOM)dom).getDTMManager();
    // Need to migrate the cached DTM to the new DTMManager
    if (dtmManager != null && newdom instanceof DTM) {
        ((DTM)newdom).migrateTo(dtmManager);
    }

    translet.prepassDocument(newdom);

    // Wrap the DOM object in a DOM adapter and add to multiplexer
    final DOMAdapter domAdapter = translet.makeDOMAdapter(newdom);
    ((MultiDOM)dom).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);
}
 
Example #21
Source Project: hottub   Author: dsrg-uoft   File: LoadDocument.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static DTMAxisIterator document(DTMAxisIterator arg1,
                                        String baseURI,
                                        AbstractTranslet translet, DOM dom)
throws Exception
{
    UnionIterator union = new UnionIterator(dom);
    int node = DTM.NULL;

    while ((node = arg1.next()) != DTM.NULL) {
        String uri = dom.getStringValueX(node);
        //document(node-set) if true;  document(node-set,node-set) if false
        if (baseURI  == null) {
           baseURI = dom.getDocumentURI(node);
           if (!SystemIDResolver.isAbsoluteURI(baseURI))
                baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
        }
        union.addIterator(document(uri, baseURI, translet, dom));
    }
    return(union);
}
 
Example #22
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: CurrentNodeListIterator.java    License: GNU General Public License v2.0 6 votes vote down vote up
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

        if (_filter.test(nodeIndex, position, last, currNode, translet,
                         this)) {
            lastPosition++;
        }
    }
    return lastPosition;
}
 
Example #23
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: NodeSortRecord.java    License: GNU General Public License v2.0 6 votes vote down vote up
private final Double numericValue(int level) {
    // Get value from our vector if possible
    if (_scanned <= level) {
        AbstractTranslet translet = _settings.getTranslet();

        // Get value from DOM if accessed for the first time
        final String str = extractValueFromDOM(_dom, _node, level,
                                               translet, _last);
        Double num;
        try {
            num = new Double(str);
        }
        // Treat number as NaN if it cannot be parsed as a double
        catch (NumberFormatException e) {
            num = new Double(Double.NEGATIVE_INFINITY);
        }
        _values[_scanned++] = num;
        return(num);
    }
    return((Double)_values[level]);
}
 
Example #24
Source Project: JDKSourceCode1.8   Author: wupeixuan   File: NodeSortRecord.java    License: MIT License 6 votes vote down vote up
/**
   * Get the string or numeric value of a specific level key for this sort
   * element. The value is extracted from the DOM if it is not already in
   * our sort key vector.
   */
  private final Comparable stringValue(int level) {
      // Get value from our array if possible
      if (_scanned <= level) {
          AbstractTranslet translet = _settings.getTranslet();
          Locale[] locales = _settings.getLocales();
          String[] caseOrder = _settings.getCaseOrders();

          // Get value from DOM if accessed for the first time
          final String str = extractValueFromDOM(_dom, _node, level,
                                                 translet, _last);
          final Comparable key =
              StringComparable.getComparator(str, locales[level],
                                             _collators[level],
                                             caseOrder[level]);
          _values[_scanned++] = key;
          return(key);
      }
      return((Comparable)_values[level]);
}
 
Example #25
Source Project: openjdk-8   Author: bpupadhyaya   File: NodeSortRecord.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
   * Get the string or numeric value of a specific level key for this sort
   * element. The value is extracted from the DOM if it is not already in
   * our sort key vector.
   */
  private final Comparable stringValue(int level) {
      // Get value from our array if possible
      if (_scanned <= level) {
          AbstractTranslet translet = _settings.getTranslet();
          Locale[] locales = _settings.getLocales();
          String[] caseOrder = _settings.getCaseOrders();

          // Get value from DOM if accessed for the first time
          final String str = extractValueFromDOM(_dom, _node, level,
                                                 translet, _last);
          final Comparable key =
              StringComparable.getComparator(str, locales[level],
                                             _collators[level],
                                             caseOrder[level]);
          _values[_scanned++] = key;
          return(key);
      }
      return((Comparable)_values[level]);
}
 
Example #26
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: LoadDocument.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Interprets the arguments passed from the document() function (see
 * com/sun/org/apache/xalan/internal/xsltc/compiler/DocumentCall.java) and returns an
 * iterator containing the requested nodes. Builds a union-iterator if
 * several documents are requested.
 * 2 arguments arg1 and arg2.  document(Obj, node-set) call
 */
public static DTMAxisIterator documentF(Object arg1, DTMAxisIterator arg2,
                        String xslURI, AbstractTranslet translet, DOM dom)
throws TransletException {
    String baseURI = null;
    final int arg2FirstNode = arg2.next();
    if (arg2FirstNode == DTMAxisIterator.END) {
        //  the second argument node-set is empty
        return EmptyIterator.getInstance();
    } else {
        //System.err.println("arg2FirstNode name: "
        //                   + dom.getNodeName(arg2FirstNode )+"["
        //                   +Integer.toHexString(arg2FirstNode )+"]");
        baseURI = dom.getDocumentURI(arg2FirstNode);
        if (!SystemIDResolver.isAbsoluteURI(baseURI))
           baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
    }

    try {
        if (arg1 instanceof String) {
            if (((String)arg1).length() == 0) {
                return document(xslURI, "", translet, dom);
            } else {
                return document((String)arg1, baseURI, translet, dom);
            }
        } else if (arg1 instanceof DTMAxisIterator) {
            return document((DTMAxisIterator)arg1, baseURI, translet, dom);
        } else {
            final String err = "document("+arg1.toString()+")";
            throw new IllegalArgumentException(err);
        }
    } catch (Exception e) {
        throw new TransletException(e);
    }
}
 
Example #27
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: LoadDocument.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Interprets the arguments passed from the document() function (see
 * com/sun/org/apache/xalan/internal/xsltc/compiler/DocumentCall.java) and returns an
 * iterator containing the requested nodes. Builds a union-iterator if
 * several documents are requested.
 * 2 arguments arg1 and arg2.  document(Obj, node-set) call
 */
public static DTMAxisIterator documentF(Object arg1, DTMAxisIterator arg2,
                        String xslURI, AbstractTranslet translet, DOM dom)
throws TransletException {
    String baseURI = null;
    final int arg2FirstNode = arg2.next();
    if (arg2FirstNode == DTMAxisIterator.END) {
        //  the second argument node-set is empty
        return EmptyIterator.getInstance();
    } else {
        //System.err.println("arg2FirstNode name: "
        //                   + dom.getNodeName(arg2FirstNode )+"["
        //                   +Integer.toHexString(arg2FirstNode )+"]");
        baseURI = dom.getDocumentURI(arg2FirstNode);
        if (!SystemIDResolver.isAbsoluteURI(baseURI))
           baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
    }

    try {
        if (arg1 instanceof String) {
            if (((String)arg1).length() == 0) {
                return document(xslURI, "", translet, dom);
            } else {
                return document((String)arg1, baseURI, translet, dom);
            }
        } else if (arg1 instanceof DTMAxisIterator) {
            return document((DTMAxisIterator)arg1, baseURI, translet, dom);
        } else {
            final String err = "document("+arg1.toString()+")";
            throw new IllegalArgumentException(err);
        }
    } catch (Exception e) {
        throw new TransletException(e);
    }
}
 
Example #28
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: CurrentNodeListIterator.java    License: GNU General Public License v2.0 5 votes vote down vote up
public CurrentNodeListIterator(DTMAxisIterator source, boolean docOrder,
                               CurrentNodeListFilter filter,
                               int currentNode,
                               AbstractTranslet translet)
{
    _source = source;
    _filter = filter;
    _translet = translet;
    _docOrder = docOrder;
    _currentNode = currentNode;
}
 
Example #29
Source Project: hottub   Author: dsrg-uoft   File: LoadDocument.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Interprets the arguments passed from the document() function (see
 * com/sun/org/apache/xalan/internal/xsltc/compiler/DocumentCall.java) and returns an
 * iterator containing the requested nodes. Builds a union-iterator if
 * several documents are requested.
 * 2 arguments arg1 and arg2.  document(Obj, node-set) call
 */
public static DTMAxisIterator documentF(Object arg1, DTMAxisIterator arg2,
                        String xslURI, AbstractTranslet translet, DOM dom)
throws TransletException {
    String baseURI = null;
    final int arg2FirstNode = arg2.next();
    if (arg2FirstNode == DTMAxisIterator.END) {
        //  the second argument node-set is empty
        return EmptyIterator.getInstance();
    } else {
        //System.err.println("arg2FirstNode name: "
        //                   + dom.getNodeName(arg2FirstNode )+"["
        //                   +Integer.toHexString(arg2FirstNode )+"]");
        baseURI = dom.getDocumentURI(arg2FirstNode);
        if (!SystemIDResolver.isAbsoluteURI(baseURI))
           baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
    }

    try {
        if (arg1 instanceof String) {
            if (((String)arg1).length() == 0) {
                return document(xslURI, "", translet, dom);
            } else {
                return document((String)arg1, baseURI, translet, dom);
            }
        } else if (arg1 instanceof DTMAxisIterator) {
            return document((DTMAxisIterator)arg1, baseURI, translet, dom);
        } else {
            final String err = "document("+arg1.toString()+")";
            throw new IllegalArgumentException(err);
        }
    } catch (Exception e) {
        throw new TransletException(e);
    }
}
 
Example #30
Source Project: JDKSourceCode1.8   Author: wupeixuan   File: LoadDocument.java    License: MIT License 5 votes vote down vote up
/**
 * Interprets the arguments passed from the document() function (see
 * com/sun/org/apache/xalan/internal/xsltc/compiler/DocumentCall.java) and returns an
 * iterator containing the requested nodes. Builds a union-iterator if
 * several documents are requested.
 * 2 arguments arg1 and arg2.  document(Obj, node-set) call
 */
public static DTMAxisIterator documentF(Object arg1, DTMAxisIterator arg2,
                        String xslURI, AbstractTranslet translet, DOM dom)
throws TransletException {
    String baseURI = null;
    final int arg2FirstNode = arg2.next();
    if (arg2FirstNode == DTMAxisIterator.END) {
        //  the second argument node-set is empty
        return EmptyIterator.getInstance();
    } else {
        //System.err.println("arg2FirstNode name: "
        //                   + dom.getNodeName(arg2FirstNode )+"["
        //                   +Integer.toHexString(arg2FirstNode )+"]");
        baseURI = dom.getDocumentURI(arg2FirstNode);
        if (!SystemIDResolver.isAbsoluteURI(baseURI))
           baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
    }

    try {
        if (arg1 instanceof String) {
            if (((String)arg1).length() == 0) {
                return document(xslURI, "", translet, dom);
            } else {
                return document((String)arg1, baseURI, translet, dom);
            }
        } else if (arg1 instanceof DTMAxisIterator) {
            return document((DTMAxisIterator)arg1, baseURI, translet, dom);
        } else {
            final String err = "document("+arg1.toString()+")";
            throw new IllegalArgumentException(err);
        }
    } catch (Exception e) {
        throw new TransletException(e);
    }
}