com.sun.org.apache.xalan.internal.xsltc.TransletException Java Examples

The following examples show how to use com.sun.org.apache.xalan.internal.xsltc.TransletException. 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 File: SAXImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Lookup a namespace URI from a prefix starting at node. This method
 * is used in the execution of xsl:element when the prefix is not known
 * at compile time.
 */
public String lookupNamespace(int node, String prefix)
    throws TransletException
{
    int anode, nsnode;
    final AncestorIterator ancestors = new AncestorIterator();

    if (isElement(node)) {
        ancestors.includeSelf();
    }

    ancestors.setStartNode(node);
    while ((anode = ancestors.next()) != DTM.NULL) {
        final NamespaceIterator namespaces = new NamespaceIterator();

        namespaces.setStartNode(anode);
        while ((nsnode = namespaces.next()) != DTM.NULL) {
            if (getLocalName(nsnode).equals(prefix)) {
                return getNodeValue(nsnode);
            }
        }
    }

    BasisLibrary.runTimeError(BasisLibrary.NAMESPACE_PREFIX_ERR, prefix);
    return null;
}
 
Example #2
Source File: SAXImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Lookup a namespace URI from a prefix starting at node. This method
 * is used in the execution of xsl:element when the prefix is not known
 * at compile time.
 */
public String lookupNamespace(int node, String prefix)
    throws TransletException
{
    int anode, nsnode;
    final AncestorIterator ancestors = new AncestorIterator();

    if (isElement(node)) {
        ancestors.includeSelf();
    }

    ancestors.setStartNode(node);
    while ((anode = ancestors.next()) != DTM.NULL) {
        final NamespaceIterator namespaces = new NamespaceIterator();

        namespaces.setStartNode(anode);
        while ((nsnode = namespaces.next()) != DTM.NULL) {
            if (getLocalName(nsnode).equals(prefix)) {
                return getNodeValue(nsnode);
            }
        }
    }

    BasisLibrary.runTimeError(BasisLibrary.NAMESPACE_PREFIX_ERR, prefix);
    return null;
}
 
Example #3
Source File: SimpleResultTreeImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Dispatch the character content of a node to an output handler.
 *
 * The escape setting should be taken care of when outputting to
 * a handler.
 */
public void characters(final int node, SerializationHandler handler)
    throws TransletException
{
    int nodeID = getNodeIdent(node);
    if (nodeID == RTF_ROOT || nodeID == RTF_TEXT) {
        boolean escapeBit = false;
        boolean oldEscapeSetting = false;

        try {
            for (int i = 0; i < _size; i++) {

                if (_dontEscape != null) {
                    escapeBit = _dontEscape.getBit(i);
                    if (escapeBit) {
                        oldEscapeSetting = handler.setEscaping(false);
                    }
                }

                handler.characters(_textArray[i]);

                if (escapeBit) {
                    handler.setEscaping(oldEscapeSetting);
                }
            }
        } catch (SAXException e) {
            throw new TransletException(e);
        }
    }
}
 
Example #4
Source File: AdaptiveResultTreeImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void copy(final int node, SerializationHandler handler)
    throws TransletException
{
    if (_dom != null) {
        _dom.copy(node, handler);
    }
    else {
        super.copy(node, handler);
    }
}
 
Example #5
Source File: DOMAdapter.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public void characters(final int textNode, SerializationHandler handler)
  throws TransletException
{
    if (_enhancedDOM != null) {
        _enhancedDOM.characters(textNode, handler);
    }
    else {
        _dom.characters(textNode, handler);
    }
}
 
Example #6
Source File: AdaptiveResultTreeImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public void copy(final int node, SerializationHandler handler)
    throws TransletException
{
    if (_dom != null) {
        _dom.copy(node, handler);
    }
    else {
        super.copy(node, handler);
    }
}
 
Example #7
Source File: MultiDOM.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void copy(final int node, SerializationHandler handler)
    throws TransletException
{
    if (node != DTM.NULL) {
        _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].copy(node, handler);
    }
}
 
Example #8
Source File: AdaptiveResultTreeImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public void copy(DTMAxisIterator nodes, SerializationHandler handler)
    throws TransletException
{
    if (_dom != null) {
        _dom.copy(nodes, handler);
    }
    else {
        super.copy(nodes, handler);
    }
}
 
Example #9
Source File: MultiDOM.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public void copy(DTMAxisIterator nodes, SerializationHandler handler)
        throws TransletException
{
    int node;
    while ((node = nodes.next()) != DTM.NULL) {
        _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].copy(node, handler);
    }
}
 
Example #10
Source File: SAXImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Copies a processing instruction node to an output handler
 */
private void copyPI(final int node, SerializationHandler handler)
    throws TransletException
{
    final String target = getNodeName(node);
    final String value = getStringValueX(node);

    try {
        handler.processingInstruction(target, value);
    } catch (Exception e) {
        throw new TransletException(e);
    }
}
 
Example #11
Source File: SAXImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Copy the string value of a node directly to an output handler
 */
public void characters(final int node, SerializationHandler handler)
    throws TransletException
{
    if (node != DTM.NULL) {
        try {
            dispatchCharactersEvents(node, handler, false);
        } catch (SAXException e) {
            throw new TransletException(e);
        }
    }
}
 
Example #12
Source File: DOMAdapter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void characters(final int textNode, SerializationHandler handler)
  throws TransletException
{
    if (_enhancedDOM != null) {
        _enhancedDOM.characters(textNode, handler);
    }
    else {
        _dom.characters(textNode, handler);
    }
}
 
Example #13
Source File: MultiDOM.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public void copy(final int node, SerializationHandler handler)
    throws TransletException
{
    if (node != DTM.NULL) {
        _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].copy(node, handler);
    }
}
 
Example #14
Source File: MultiDOM.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public void copy(DTMAxisIterator nodes, SerializationHandler handler)
        throws TransletException
{
    int node;
    while ((node = nodes.next()) != DTM.NULL) {
        _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].copy(node, handler);
    }
}
 
Example #15
Source File: AdaptiveResultTreeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void copy(final int node, SerializationHandler handler)
    throws TransletException
{
    if (_dom != null) {
        _dom.copy(node, handler);
    }
    else {
        super.copy(node, handler);
    }
}
 
Example #16
Source File: MultiDOM.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void characters(final int textNode, SerializationHandler handler)
             throws TransletException
{
    if (textNode != DTM.NULL) {
        _adapters[textNode >>> DTMManager.IDENT_DTM_NODE_BITS].characters(textNode, handler);
    }
}
 
Example #17
Source File: SAXImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Copy a node-set to an output handler
 */
public void copy(DTMAxisIterator nodes, SerializationHandler handler)
    throws TransletException
{
    int node;
    while ((node = nodes.next()) != DTM.NULL) {
        copy(node, handler);
    }
}
 
Example #18
Source File: MultiDOM.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public String shallowCopy(final int node, SerializationHandler handler)
        throws TransletException
{
    if (node == DTM.NULL) {
        return "";
    }
    return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].shallowCopy(node, handler);
}
 
Example #19
Source File: DOMAdapter.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public void characters(final int textNode, SerializationHandler handler)
  throws TransletException
{
    if (_enhancedDOM != null) {
        _enhancedDOM.characters(textNode, handler);
    }
    else {
        _dom.characters(textNode, handler);
    }
}
 
Example #20
Source File: MultiDOM.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void copy(final int node, SerializationHandler handler)
    throws TransletException
{
    if (node != DTM.NULL) {
        _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].copy(node, handler);
    }
}
 
Example #21
Source File: SimpleResultTreeImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public void copy(DTMAxisIterator nodes, SerializationHandler handler)
    throws TransletException
{
    int node;
    while ((node = nodes.next()) != DTM.NULL)
    {
        copy(node, handler);
    }
}
 
Example #22
Source File: AbstractTranslet.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/************************************************************************
 * Multiple output document extension.
 * See compiler/TransletOutput for actual implementation.
 ************************************************************************/

public SerializationHandler openOutputHandler(String filename, boolean append)
    throws TransletException
{
    try {
        final TransletOutputHandlerFactory factory
            = TransletOutputHandlerFactory.newInstance();

        String dirStr = new File(filename).getParent();
        if ((null != dirStr) && (dirStr.length() > 0)) {
           File dir = new File(dirStr);
           dir.mkdirs();
        }

        factory.setEncoding(_encoding);
        factory.setOutputMethod(_method);
        factory.setOutputStream(new BufferedOutputStream(new FileOutputStream(filename, append)));
        factory.setOutputType(TransletOutputHandlerFactory.STREAM);

        final SerializationHandler handler
            = factory.getSerializationHandler();

        transferOutputSettings(handler);
        handler.startDocument();
        return handler;
    }
    catch (Exception e) {
        throw new TransletException(e);
    }
}
 
Example #23
Source File: MultiDOM.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void characters(final int textNode, SerializationHandler handler)
             throws TransletException
{
    if (textNode != DTM.NULL) {
        _adapters[textNode >>> DTMManager.IDENT_DTM_NODE_BITS].characters(textNode, handler);
    }
}
 
Example #24
Source File: MultiDOM.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public String shallowCopy(final int node, SerializationHandler handler)
        throws TransletException
{
    if (node == DTM.NULL) {
        return "";
    }
    return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].shallowCopy(node, handler);
}
 
Example #25
Source File: SimpleResultTreeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void copy(DTMAxisIterator nodes, SerializationHandler handler)
    throws TransletException
{
    int node;
    while ((node = nodes.next()) != DTM.NULL)
    {
        copy(node, handler);
    }
}
 
Example #26
Source File: AbstractTranslet.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Used by some compiled code as a shortcut for passing strings to the
 * output handler
 */
public final void characters(final String string,
                             SerializationHandler handler)
    throws TransletException {
    if (string != null) {
       //final int length = string.length();
       try {
           handler.characters(string);
       } catch (Exception e) {
           throw new TransletException(e);
       }
    }
}
 
Example #27
Source File: DOMAdapter.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public String shallowCopy(final int node, SerializationHandler handler)
    throws TransletException
{
    if (_enhancedDOM != null) {
        return _enhancedDOM.shallowCopy(node, handler);
    }
    else {
        return _dom.shallowCopy(node, handler);
    }
}
 
Example #28
Source File: MultiDOM.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public String shallowCopy(final int node, SerializationHandler handler)
        throws TransletException
{
    if (node == DTM.NULL) {
        return "";
    }
    return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].shallowCopy(node, handler);
}
 
Example #29
Source File: AdaptiveResultTreeImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public String lookupNamespace(int node, String prefix)
    throws TransletException
{
    if (_dom != null) {
        return _dom.lookupNamespace(node, prefix);
    }
    else {
        return super.lookupNamespace(node, prefix);
    }
}
 
Example #30
Source File: AdaptiveResultTreeImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Dispatch the character content of a node to an output handler.
 *
 * The escape setting should be taken care of when outputting to
 * a handler.
 */
public void characters(final int node, SerializationHandler handler)
    throws TransletException
{
    if (_dom != null) {
        _dom.characters(node, handler);
    }
    else {
        super.characters(node, handler);
    }
}