Java Code Examples for com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet#addCdataElement()

The following examples show how to use com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet#addCdataElement() . 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: TransformerImpl.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Internal method to pass any properties to the translet prior to
 * initiating the transformation
 */
private void transferOutputProperties(AbstractTranslet translet)
{
    // Return right now if no properties are set
    if (_properties == null) return;

    // Get a list of all the defined properties
    Enumeration names = _properties.propertyNames();
    while (names.hasMoreElements()) {
        // Note the use of get() instead of getProperty()
        String name  = (String) names.nextElement();
        String value = (String) _properties.get(name);

        // Ignore default properties
        if (value == null) continue;

        // Pass property value to translet - override previous setting
        if (name.equals(OutputKeys.ENCODING)) {
            translet._encoding = value;
        }
        else if (name.equals(OutputKeys.METHOD)) {
            translet._method = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_PUBLIC)) {
            translet._doctypePublic = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_SYSTEM)) {
            translet._doctypeSystem = value;
        }
        else if (name.equals(OutputKeys.MEDIA_TYPE)) {
            translet._mediaType = value;
        }
        else if (name.equals(OutputKeys.STANDALONE)) {
            translet._standalone = value;
        }
        else if (name.equals(OutputKeys.VERSION)) {
            translet._version = value;
        }
        else if (name.equals(OutputKeys.OMIT_XML_DECLARATION)) {
            translet._omitHeader =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputKeys.INDENT)) {
            translet._indent =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) {
            if (value != null) {
                translet._cdata = null; // clear previous setting
                StringTokenizer e = new StringTokenizer(value);
                while (e.hasMoreTokens()) {
                    translet.addCdataElement(e.nextToken());
                }
            }
        }
        else if (name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE)) {
             if (value != null && value.equals("yes")) {
                 translet._isStandalone = true;
             }
        }
    }
}
 
Example 2
Source File: TransformerImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Internal method to pass any properties to the translet prior to
 * initiating the transformation
 */
private void transferOutputProperties(AbstractTranslet translet)
{
    // Return right now if no properties are set
    if (_properties == null) return;

    // Get a list of all the defined properties
    Enumeration names = _properties.propertyNames();
    while (names.hasMoreElements()) {
        // Note the use of get() instead of getProperty()
        String name  = (String) names.nextElement();
        String value = (String) _properties.get(name);

        // Ignore default properties
        if (value == null) continue;

        // Pass property value to translet - override previous setting
        if (name.equals(OutputKeys.ENCODING)) {
            translet._encoding = value;
        }
        else if (name.equals(OutputKeys.METHOD)) {
            translet._method = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_PUBLIC)) {
            translet._doctypePublic = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_SYSTEM)) {
            translet._doctypeSystem = value;
        }
        else if (name.equals(OutputKeys.MEDIA_TYPE)) {
            translet._mediaType = value;
        }
        else if (name.equals(OutputKeys.STANDALONE)) {
            translet._standalone = value;
        }
        else if (name.equals(OutputKeys.VERSION)) {
            translet._version = value;
        }
        else if (name.equals(OutputKeys.OMIT_XML_DECLARATION)) {
            translet._omitHeader =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputKeys.INDENT)) {
            translet._indent =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) {
            if (value != null) {
                translet._cdata = null; // clear previous setting
                StringTokenizer e = new StringTokenizer(value);
                while (e.hasMoreTokens()) {
                    translet.addCdataElement(e.nextToken());
                }
            }
        }
        else if (name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE)) {
             if (value != null && value.equals("yes")) {
                 translet._isStandalone = true;
             }
        }
    }
}
 
Example 3
Source File: TransformerImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Internal method to pass any properties to the translet prior to
 * initiating the transformation
 */
private void transferOutputProperties(AbstractTranslet translet)
{
    // Return right now if no properties are set
    if (_properties == null) return;

    // Get a list of all the defined properties
    Enumeration names = _properties.propertyNames();
    while (names.hasMoreElements()) {
        // Note the use of get() instead of getProperty()
        String name  = (String) names.nextElement();
        String value = (String) _properties.get(name);

        // Ignore default properties
        if (value == null) continue;

        // Pass property value to translet - override previous setting
        if (name.equals(OutputKeys.ENCODING)) {
            translet._encoding = value;
        }
        else if (name.equals(OutputKeys.METHOD)) {
            translet._method = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_PUBLIC)) {
            translet._doctypePublic = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_SYSTEM)) {
            translet._doctypeSystem = value;
        }
        else if (name.equals(OutputKeys.MEDIA_TYPE)) {
            translet._mediaType = value;
        }
        else if (name.equals(OutputKeys.STANDALONE)) {
            translet._standalone = value;
        }
        else if (name.equals(OutputKeys.VERSION)) {
            translet._version = value;
        }
        else if (name.equals(OutputKeys.OMIT_XML_DECLARATION)) {
            translet._omitHeader =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputKeys.INDENT)) {
            translet._indent =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) {
            if (value != null) {
                translet._cdata = null; // clear previous setting
                StringTokenizer e = new StringTokenizer(value);
                while (e.hasMoreTokens()) {
                    translet.addCdataElement(e.nextToken());
                }
            }
        }
        else if (name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE)) {
             if (value != null && value.equals("yes")) {
                 translet._isStandalone = true;
             }
        }
    }
}
 
Example 4
Source File: TransformerImpl.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Internal method to pass any properties to the translet prior to
 * initiating the transformation
 */
private void transferOutputProperties(AbstractTranslet translet)
{
    // Return right now if no properties are set
    if (_properties == null) return;

    // Get a list of all the defined properties
    Enumeration names = _properties.propertyNames();
    while (names.hasMoreElements()) {
        // Note the use of get() instead of getProperty()
        String name  = (String) names.nextElement();
        String value = (String) _properties.get(name);

        // Ignore default properties
        if (value == null) continue;

        // Pass property value to translet - override previous setting
        if (name.equals(OutputKeys.ENCODING)) {
            translet._encoding = value;
        }
        else if (name.equals(OutputKeys.METHOD)) {
            translet._method = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_PUBLIC)) {
            translet._doctypePublic = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_SYSTEM)) {
            translet._doctypeSystem = value;
        }
        else if (name.equals(OutputKeys.MEDIA_TYPE)) {
            translet._mediaType = value;
        }
        else if (name.equals(OutputKeys.STANDALONE)) {
            translet._standalone = value;
        }
        else if (name.equals(OutputKeys.VERSION)) {
            translet._version = value;
        }
        else if (name.equals(OutputKeys.OMIT_XML_DECLARATION)) {
            translet._omitHeader =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputKeys.INDENT)) {
            translet._indent =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) {
            if (value != null) {
                translet._cdata = null; // clear previous setting
                StringTokenizer e = new StringTokenizer(value);
                while (e.hasMoreTokens()) {
                    translet.addCdataElement(e.nextToken());
                }
            }
        }
        else if (name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE)) {
             if (value != null && value.equals("yes")) {
                 translet._isStandalone = true;
             }
        }
    }
}
 
Example 5
Source File: TransformerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Internal method to pass any properties to the translet prior to
 * initiating the transformation
 */
private void transferOutputProperties(AbstractTranslet translet)
{
    // Return right now if no properties are set
    if (_properties == null) return;

    // Get a list of all the defined properties
    Enumeration names = _properties.propertyNames();
    while (names.hasMoreElements()) {
        // Note the use of get() instead of getProperty()
        String name  = (String) names.nextElement();
        String value = (String) _properties.get(name);

        // Ignore default properties
        if (value == null) continue;

        // Pass property value to translet - override previous setting
        if (name.equals(OutputKeys.ENCODING)) {
            translet._encoding = value;
        }
        else if (name.equals(OutputKeys.METHOD)) {
            translet._method = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_PUBLIC)) {
            translet._doctypePublic = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_SYSTEM)) {
            translet._doctypeSystem = value;
        }
        else if (name.equals(OutputKeys.MEDIA_TYPE)) {
            translet._mediaType = value;
        }
        else if (name.equals(OutputKeys.STANDALONE)) {
            translet._standalone = value;
        }
        else if (name.equals(OutputKeys.VERSION)) {
            translet._version = value;
        }
        else if (name.equals(OutputKeys.OMIT_XML_DECLARATION)) {
            translet._omitHeader =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputKeys.INDENT)) {
            translet._indent =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) {
            if (value != null) {
                translet._cdata = null; // clear previous setting
                StringTokenizer e = new StringTokenizer(value);
                while (e.hasMoreTokens()) {
                    translet.addCdataElement(e.nextToken());
                }
            }
        }
        else if (name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE)) {
             if (value != null && value.equals("yes")) {
                 translet._isStandalone = true;
             }
        }
    }
}
 
Example 6
Source File: TransformerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Internal method to pass any properties to the translet prior to
 * initiating the transformation
 */
private void transferOutputProperties(AbstractTranslet translet)
{
    // Return right now if no properties are set
    if (_properties == null) return;

    // Get a list of all the defined properties
    Enumeration names = _properties.propertyNames();
    while (names.hasMoreElements()) {
        // Note the use of get() instead of getProperty()
        String name  = (String) names.nextElement();
        String value = (String) _properties.get(name);

        // Ignore default properties
        if (value == null) continue;

        // Pass property value to translet - override previous setting
        if (name.equals(OutputKeys.ENCODING)) {
            translet._encoding = value;
        }
        else if (name.equals(OutputKeys.METHOD)) {
            translet._method = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_PUBLIC)) {
            translet._doctypePublic = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_SYSTEM)) {
            translet._doctypeSystem = value;
        }
        else if (name.equals(OutputKeys.MEDIA_TYPE)) {
            translet._mediaType = value;
        }
        else if (name.equals(OutputKeys.STANDALONE)) {
            translet._standalone = value;
        }
        else if (name.equals(OutputKeys.VERSION)) {
            translet._version = value;
        }
        else if (name.equals(OutputKeys.OMIT_XML_DECLARATION)) {
            translet._omitHeader =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputKeys.INDENT)) {
            translet._indent =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) {
            if (value != null) {
                translet._cdata = null; // clear previous setting
                StringTokenizer e = new StringTokenizer(value);
                while (e.hasMoreTokens()) {
                    translet.addCdataElement(e.nextToken());
                }
            }
        }
        else if (name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE)) {
             if (value != null && value.equals("yes")) {
                 translet._isStandalone = true;
             }
        }
    }
}
 
Example 7
Source File: TransformerImpl.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Internal method to pass any properties to the translet prior to
 * initiating the transformation
 */
private void transferOutputProperties(AbstractTranslet translet)
{
    // Return right now if no properties are set
    if (_properties == null) return;

    // Get a list of all the defined properties
    Enumeration<?> names = _properties.propertyNames();
    while (names.hasMoreElements()) {
        // Note the use of get() instead of getProperty()
        String name  = (String) names.nextElement();
        String value = (String) _properties.get(name);

        // Ignore default properties
        if (value == null) continue;

        // Pass property value to translet - override previous setting
        if (name.equals(OutputKeys.ENCODING)) {
            translet._encoding = value;
        }
        else if (name.equals(OutputKeys.METHOD)) {
            translet._method = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_PUBLIC)) {
            translet._doctypePublic = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_SYSTEM)) {
            translet._doctypeSystem = value;
        }
        else if (name.equals(OutputKeys.MEDIA_TYPE)) {
            translet._mediaType = value;
        }
        else if (name.equals(OutputKeys.STANDALONE)) {
            translet._standalone = value;
        }
        else if (name.equals(OutputKeys.VERSION)) {
            translet._version = value;
        }
        else if (name.equals(OutputKeys.OMIT_XML_DECLARATION)) {
            translet._omitHeader =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputKeys.INDENT)) {
            translet._indent =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) {
            if (value != null) {
                translet._cdata = null; // clear previous setting
                StringTokenizer e = new StringTokenizer(value);
                while (e.hasMoreTokens()) {
                    translet.addCdataElement(e.nextToken());
                }
            }
        }
        else if (name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE)) {
             if (value != null && value.equals("yes")) {
                 translet._isStandalone = true;
             }
        }
    }
}
 
Example 8
Source File: TransformerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Internal method to pass any properties to the translet prior to
 * initiating the transformation
 */
private void transferOutputProperties(AbstractTranslet translet)
{
    // Return right now if no properties are set
    if (_properties == null) return;

    // Get a list of all the defined properties
    Enumeration names = _properties.propertyNames();
    while (names.hasMoreElements()) {
        // Note the use of get() instead of getProperty()
        String name  = (String) names.nextElement();
        String value = (String) _properties.get(name);

        // Ignore default properties
        if (value == null) continue;

        // Pass property value to translet - override previous setting
        if (name.equals(OutputKeys.ENCODING)) {
            translet._encoding = value;
        }
        else if (name.equals(OutputKeys.METHOD)) {
            translet._method = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_PUBLIC)) {
            translet._doctypePublic = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_SYSTEM)) {
            translet._doctypeSystem = value;
        }
        else if (name.equals(OutputKeys.MEDIA_TYPE)) {
            translet._mediaType = value;
        }
        else if (name.equals(OutputKeys.STANDALONE)) {
            translet._standalone = value;
        }
        else if (name.equals(OutputKeys.VERSION)) {
            translet._version = value;
        }
        else if (name.equals(OutputKeys.OMIT_XML_DECLARATION)) {
            translet._omitHeader =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputKeys.INDENT)) {
            translet._indent =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) {
            if (value != null) {
                translet._cdata = null; // clear previous setting
                StringTokenizer e = new StringTokenizer(value);
                while (e.hasMoreTokens()) {
                    translet.addCdataElement(e.nextToken());
                }
            }
        }
        else if (name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE)) {
             if (value != null && value.equals("yes")) {
                 translet._isStandalone = true;
             }
        }
    }
}
 
Example 9
Source File: TransformerImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Internal method to pass any properties to the translet prior to
 * initiating the transformation
 */
private void transferOutputProperties(AbstractTranslet translet)
{
    // Return right now if no properties are set
    if (_properties == null) return;

    // Get a list of all the defined properties
    Enumeration names = _properties.propertyNames();
    while (names.hasMoreElements()) {
        // Note the use of get() instead of getProperty()
        String name  = (String) names.nextElement();
        String value = (String) _properties.get(name);

        // Ignore default properties
        if (value == null) continue;

        // Pass property value to translet - override previous setting
        if (name.equals(OutputKeys.ENCODING)) {
            translet._encoding = value;
        }
        else if (name.equals(OutputKeys.METHOD)) {
            translet._method = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_PUBLIC)) {
            translet._doctypePublic = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_SYSTEM)) {
            translet._doctypeSystem = value;
        }
        else if (name.equals(OutputKeys.MEDIA_TYPE)) {
            translet._mediaType = value;
        }
        else if (name.equals(OutputKeys.STANDALONE)) {
            translet._standalone = value;
        }
        else if (name.equals(OutputKeys.VERSION)) {
            translet._version = value;
        }
        else if (name.equals(OutputKeys.OMIT_XML_DECLARATION)) {
            translet._omitHeader =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputKeys.INDENT)) {
            translet._indent =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) {
            if (value != null) {
                translet._cdata = null; // clear previous setting
                StringTokenizer e = new StringTokenizer(value);
                while (e.hasMoreTokens()) {
                    translet.addCdataElement(e.nextToken());
                }
            }
        }
        else if (name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE)) {
             if (value != null && value.equals("yes")) {
                 translet._isStandalone = true;
             }
        }
    }
}
 
Example 10
Source File: TransformerImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Internal method to pass any properties to the translet prior to
 * initiating the transformation
 */
private void transferOutputProperties(AbstractTranslet translet)
{
    // Return right now if no properties are set
    if (_properties == null) return;

    // Get a list of all the defined properties
    Enumeration names = _properties.propertyNames();
    while (names.hasMoreElements()) {
        // Note the use of get() instead of getProperty()
        String name  = (String) names.nextElement();
        String value = (String) _properties.get(name);

        // Ignore default properties
        if (value == null) continue;

        // Pass property value to translet - override previous setting
        if (name.equals(OutputKeys.ENCODING)) {
            translet._encoding = value;
        }
        else if (name.equals(OutputKeys.METHOD)) {
            translet._method = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_PUBLIC)) {
            translet._doctypePublic = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_SYSTEM)) {
            translet._doctypeSystem = value;
        }
        else if (name.equals(OutputKeys.MEDIA_TYPE)) {
            translet._mediaType = value;
        }
        else if (name.equals(OutputKeys.STANDALONE)) {
            translet._standalone = value;
        }
        else if (name.equals(OutputKeys.VERSION)) {
            translet._version = value;
        }
        else if (name.equals(OutputKeys.OMIT_XML_DECLARATION)) {
            translet._omitHeader =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputKeys.INDENT)) {
            translet._indent =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) {
            if (value != null) {
                translet._cdata = null; // clear previous setting
                StringTokenizer e = new StringTokenizer(value);
                while (e.hasMoreTokens()) {
                    translet.addCdataElement(e.nextToken());
                }
            }
        }
        else if (name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE)) {
             if (value != null && value.equals("yes")) {
                 translet._isStandalone = true;
             }
        }
    }
}
 
Example 11
Source File: TransformerImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Internal method to pass any properties to the translet prior to
 * initiating the transformation
 */
private void transferOutputProperties(AbstractTranslet translet)
{
    // Return right now if no properties are set
    if (_properties == null) return;

    // Get a list of all the defined properties
    Enumeration names = _properties.propertyNames();
    while (names.hasMoreElements()) {
        // Note the use of get() instead of getProperty()
        String name  = (String) names.nextElement();
        String value = (String) _properties.get(name);

        // Ignore default properties
        if (value == null) continue;

        // Pass property value to translet - override previous setting
        if (name.equals(OutputKeys.ENCODING)) {
            translet._encoding = value;
        }
        else if (name.equals(OutputKeys.METHOD)) {
            translet._method = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_PUBLIC)) {
            translet._doctypePublic = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_SYSTEM)) {
            translet._doctypeSystem = value;
        }
        else if (name.equals(OutputKeys.MEDIA_TYPE)) {
            translet._mediaType = value;
        }
        else if (name.equals(OutputKeys.STANDALONE)) {
            translet._standalone = value;
        }
        else if (name.equals(OutputKeys.VERSION)) {
            translet._version = value;
        }
        else if (name.equals(OutputKeys.OMIT_XML_DECLARATION)) {
            translet._omitHeader =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputKeys.INDENT)) {
            translet._indent =
                (value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_EXTENSIONS_UNIVERSAL +"indent-amount")) {
             if (value != null) {
                 translet._indentamount = Integer.parseInt(value);
             }
        }
        else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) {
            if (value != null) {
                translet._cdata = null; // clear previous setting
                StringTokenizer e = new StringTokenizer(value);
                while (e.hasMoreTokens()) {
                    translet.addCdataElement(e.nextToken());
                }
            }
        }
        else if (name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE)) {
             if (value != null && value.equals("yes")) {
                 translet._isStandalone = true;
             }
        }
    }
}