Java Code Examples for com.sun.org.apache.xml.internal.serializer.SerializationHandler#setDoctype()

The following examples show how to use com.sun.org.apache.xml.internal.serializer.SerializationHandler#setDoctype() . 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: AbstractTranslet.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Transfer the output settings to the output post-processor
 */
protected void transferOutputSettings(SerializationHandler handler) {
    if (_method != null) {
        if (_method.equals("xml")) {
            if (_standalone != null) {
                handler.setStandalone(_standalone);
            }
            if (_omitHeader) {
                handler.setOmitXMLDeclaration(true);
            }
            handler.setCdataSectionElements(_cdata);
            if (_version != null) {
                handler.setVersion(_version);
            }
            handler.setIndent(_indent);
            handler.setIndentAmount(_indentamount);
            if (_doctypeSystem != null) {
                handler.setDoctype(_doctypeSystem, _doctypePublic);
            }
            handler.setIsStandalone(_isStandalone);
        }
        else if (_method.equals("html")) {
            handler.setIndent(_indent);
            handler.setDoctype(_doctypeSystem, _doctypePublic);
            if (_mediaType != null) {
                handler.setMediaType(_mediaType);
            }
        }
    }
    else {
        handler.setCdataSectionElements(_cdata);
        if (_version != null) {
            handler.setVersion(_version);
        }
        if (_standalone != null) {
            handler.setStandalone(_standalone);
        }
        if (_omitHeader) {
            handler.setOmitXMLDeclaration(true);
        }
        handler.setIndent(_indent);
        handler.setDoctype(_doctypeSystem, _doctypePublic);
        handler.setIsStandalone(_isStandalone);
    }
}
 
Example 2
Source File: AbstractTranslet.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Transfer the output settings to the output post-processor
 */
protected void transferOutputSettings(SerializationHandler handler) {
    if (_method != null) {
        if (_method.equals("xml")) {
            if (_standalone != null) {
                handler.setStandalone(_standalone);
            }
            if (_omitHeader) {
                handler.setOmitXMLDeclaration(true);
            }
            handler.setCdataSectionElements(_cdata);
            if (_version != null) {
                handler.setVersion(_version);
            }
            handler.setIndent(_indent);
            handler.setIndentAmount(_indentamount);
            if (_doctypeSystem != null) {
                handler.setDoctype(_doctypeSystem, _doctypePublic);
            }
            handler.setIsStandalone(_isStandalone);
        }
        else if (_method.equals("html")) {
            handler.setIndent(_indent);
            handler.setDoctype(_doctypeSystem, _doctypePublic);
            if (_mediaType != null) {
                handler.setMediaType(_mediaType);
            }
        }
    }
    else {
        handler.setCdataSectionElements(_cdata);
        if (_version != null) {
            handler.setVersion(_version);
        }
        if (_standalone != null) {
            handler.setStandalone(_standalone);
        }
        if (_omitHeader) {
            handler.setOmitXMLDeclaration(true);
        }
        handler.setIndent(_indent);
        handler.setDoctype(_doctypeSystem, _doctypePublic);
        handler.setIsStandalone(_isStandalone);
    }
}
 
Example 3
Source File: AbstractTranslet.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Transfer the output settings to the output post-processor
 */
protected void transferOutputSettings(SerializationHandler handler) {
    if (_method != null) {
        if (_method.equals("xml")) {
            if (_standalone != null) {
                handler.setStandalone(_standalone);
            }
            if (_omitHeader) {
                handler.setOmitXMLDeclaration(true);
            }
            handler.setCdataSectionElements(_cdata);
            if (_version != null) {
                handler.setVersion(_version);
            }
            handler.setIndent(_indent);
            handler.setIndentAmount(_indentamount);
            if (_doctypeSystem != null) {
                handler.setDoctype(_doctypeSystem, _doctypePublic);
            }
            handler.setIsStandalone(_isStandalone);
        }
        else if (_method.equals("html")) {
            handler.setIndent(_indent);
            handler.setDoctype(_doctypeSystem, _doctypePublic);
            if (_mediaType != null) {
                handler.setMediaType(_mediaType);
            }
        }
    }
    else {
        handler.setCdataSectionElements(_cdata);
        if (_version != null) {
            handler.setVersion(_version);
        }
        if (_standalone != null) {
            handler.setStandalone(_standalone);
        }
        if (_omitHeader) {
            handler.setOmitXMLDeclaration(true);
        }
        handler.setIndent(_indent);
        handler.setDoctype(_doctypeSystem, _doctypePublic);
        handler.setIsStandalone(_isStandalone);
    }
}
 
Example 4
Source File: AbstractTranslet.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Transfer the output settings to the output post-processor
 */
protected void transferOutputSettings(SerializationHandler handler) {
    if (_method != null) {
        if (_method.equals("xml")) {
            if (_standalone != null) {
                handler.setStandalone(_standalone);
            }
            if (_omitHeader) {
                handler.setOmitXMLDeclaration(true);
            }
            handler.setCdataSectionElements(_cdata);
            if (_version != null) {
                handler.setVersion(_version);
            }
            handler.setIndent(_indent);
            handler.setIndentAmount(_indentamount);
            if (_doctypeSystem != null) {
                handler.setDoctype(_doctypeSystem, _doctypePublic);
            }
            handler.setIsStandalone(_isStandalone);
        }
        else if (_method.equals("html")) {
            handler.setIndent(_indent);
            handler.setDoctype(_doctypeSystem, _doctypePublic);
            if (_mediaType != null) {
                handler.setMediaType(_mediaType);
            }
        }
    }
    else {
        handler.setCdataSectionElements(_cdata);
        if (_version != null) {
            handler.setVersion(_version);
        }
        if (_standalone != null) {
            handler.setStandalone(_standalone);
        }
        if (_omitHeader) {
            handler.setOmitXMLDeclaration(true);
        }
        handler.setIndent(_indent);
        handler.setDoctype(_doctypeSystem, _doctypePublic);
        handler.setIsStandalone(_isStandalone);
    }
}
 
Example 5
Source File: AbstractTranslet.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Transfer the output settings to the output post-processor
 */
protected void transferOutputSettings(SerializationHandler handler) {
    if (_method != null) {
        if (_method.equals("xml")) {
            if (_standalone != null) {
                handler.setStandalone(_standalone);
            }
            if (_omitHeader) {
                handler.setOmitXMLDeclaration(true);
            }
            handler.setCdataSectionElements(_cdata);
            if (_version != null) {
                handler.setVersion(_version);
            }
            handler.setIndent(_indent);
            handler.setIndentAmount(_indentamount);
            if (_doctypeSystem != null) {
                handler.setDoctype(_doctypeSystem, _doctypePublic);
            }
            handler.setIsStandalone(_isStandalone);
        }
        else if (_method.equals("html")) {
            handler.setIndent(_indent);
            handler.setDoctype(_doctypeSystem, _doctypePublic);
            if (_mediaType != null) {
                handler.setMediaType(_mediaType);
            }
        }
    }
    else {
        handler.setCdataSectionElements(_cdata);
        if (_version != null) {
            handler.setVersion(_version);
        }
        if (_standalone != null) {
            handler.setStandalone(_standalone);
        }
        if (_omitHeader) {
            handler.setOmitXMLDeclaration(true);
        }
        handler.setIndent(_indent);
        handler.setDoctype(_doctypeSystem, _doctypePublic);
        handler.setIsStandalone(_isStandalone);
    }
}
 
Example 6
Source File: AbstractTranslet.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Transfer the output settings to the output post-processor
 */
protected void transferOutputSettings(SerializationHandler handler) {
    if (_method != null) {
        if (_method.equals("xml")) {
            if (_standalone != null) {
                handler.setStandalone(_standalone);
            }
            if (_omitHeader) {
                handler.setOmitXMLDeclaration(true);
            }
            handler.setCdataSectionElements(_cdata);
            if (_version != null) {
                handler.setVersion(_version);
            }
            handler.setIndent(_indent);
            handler.setIndentAmount(_indentamount);
            if (_doctypeSystem != null) {
                handler.setDoctype(_doctypeSystem, _doctypePublic);
            }
            handler.setIsStandalone(_isStandalone);
        }
        else if (_method.equals("html")) {
            handler.setIndent(_indent);
            handler.setDoctype(_doctypeSystem, _doctypePublic);
            if (_mediaType != null) {
                handler.setMediaType(_mediaType);
            }
        }
    }
    else {
        handler.setCdataSectionElements(_cdata);
        if (_version != null) {
            handler.setVersion(_version);
        }
        if (_standalone != null) {
            handler.setStandalone(_standalone);
        }
        if (_omitHeader) {
            handler.setOmitXMLDeclaration(true);
        }
        handler.setIndent(_indent);
        handler.setDoctype(_doctypeSystem, _doctypePublic);
        handler.setIsStandalone(_isStandalone);
    }
}
 
Example 7
Source File: TransformerImpl.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * This method is used to pass any properties to the output handler
 * when running the identity transform.
 */
public void transferOutputProperties(SerializationHandler handler)
{
    // Return right now if no properties are set
    if (_properties == null) return;

    String doctypePublic = null;
    String doctypeSystem = null;

    // 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.DOCTYPE_PUBLIC)) {
            doctypePublic = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_SYSTEM)) {
            doctypeSystem = value;
        }
        else if (name.equals(OutputKeys.MEDIA_TYPE)) {
            handler.setMediaType(value);
        }
        else if (name.equals(OutputKeys.STANDALONE)) {
            handler.setStandalone(value);
        }
        else if (name.equals(OutputKeys.VERSION)) {
            handler.setVersion(value);
        }
        else if (name.equals(OutputKeys.OMIT_XML_DECLARATION)) {
            handler.setOmitXMLDeclaration(
                value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputKeys.INDENT)) {
            handler.setIndent(
                value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL +"indent-amount")) {
            if (value != null) {
                handler.setIndentAmount(Integer.parseInt(value));
            }
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_EXTENSIONS_UNIVERSAL +"indent-amount")) {
            if (value != null) {
                handler.setIndentAmount(Integer.parseInt(value));
            }
        }
        else if (name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE)) {
            if (value != null && value.equals("yes")) {
                handler.setIsStandalone(true);
            }
        }
        else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) {
            if (value != null) {
                StringTokenizer e = new StringTokenizer(value);
                List<String> uriAndLocalNames = null;
                while (e.hasMoreTokens()) {
                    final String token = e.nextToken();

                    // look for the last colon, as the String may be
                    // something like "http://abc.com:local"
                    int lastcolon = token.lastIndexOf(':');
                    String uri;
                    String localName;
                    if (lastcolon > 0) {
                        uri = token.substring(0, lastcolon);
                        localName = token.substring(lastcolon+1);
                    } else {
                        // no colon at all, lets hope this is the
                        // local name itself then
                        uri = null;
                        localName = token;
                    }

                    if (uriAndLocalNames == null) {
                        uriAndLocalNames = new ArrayList<>();
                    }
                    // add the uri/localName as a pair, in that order
                    uriAndLocalNames.add(uri);
                    uriAndLocalNames.add(localName);
                }
                handler.setCdataSectionElements(uriAndLocalNames);
            }
        }
    }

    // Call setDoctype() if needed
    if (doctypePublic != null || doctypeSystem != null) {
        handler.setDoctype(doctypeSystem, doctypePublic);
    }
}
 
Example 8
Source File: AbstractTranslet.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Transfer the output settings to the output post-processor
 */
protected void transferOutputSettings(SerializationHandler handler) {
    if (_method != null) {
        if (_method.equals("xml")) {
            if (_standalone != null) {
                handler.setStandalone(_standalone);
            }
            if (_omitHeader) {
                handler.setOmitXMLDeclaration(true);
            }
            handler.setCdataSectionElements(_cdata);
            if (_version != null) {
                handler.setVersion(_version);
            }
            handler.setIndent(_indent);
            if (_indentamount >= 0)
                handler.setIndentAmount(_indentamount);
            if (_doctypeSystem != null) {
                handler.setDoctype(_doctypeSystem, _doctypePublic);
            }
            handler.setIsStandalone(_isStandalone);
        }
        else if (_method.equals("html")) {
            handler.setIndent(_indent);
            handler.setDoctype(_doctypeSystem, _doctypePublic);
            if (_mediaType != null) {
                handler.setMediaType(_mediaType);
            }
        }
    }
    else {
        handler.setCdataSectionElements(_cdata);
        if (_version != null) {
            handler.setVersion(_version);
        }
        if (_standalone != null) {
            handler.setStandalone(_standalone);
        }
        if (_omitHeader) {
            handler.setOmitXMLDeclaration(true);
        }
        handler.setIndent(_indent);
        handler.setDoctype(_doctypeSystem, _doctypePublic);
        handler.setIsStandalone(_isStandalone);
    }
}
 
Example 9
Source File: TransformerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This method is used to pass any properties to the output handler
 * when running the identity transform.
 */
public void transferOutputProperties(SerializationHandler handler)
{
    // Return right now if no properties are set
    if (_properties == null) return;

    String doctypePublic = null;
    String doctypeSystem = null;

    // 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.DOCTYPE_PUBLIC)) {
            doctypePublic = value;
        }
        else if (name.equals(OutputKeys.DOCTYPE_SYSTEM)) {
            doctypeSystem = value;
        }
        else if (name.equals(OutputKeys.MEDIA_TYPE)) {
            handler.setMediaType(value);
        }
        else if (name.equals(OutputKeys.STANDALONE)) {
            handler.setStandalone(value);
        }
        else if (name.equals(OutputKeys.VERSION)) {
            handler.setVersion(value);
        }
        else if (name.equals(OutputKeys.OMIT_XML_DECLARATION)) {
            handler.setOmitXMLDeclaration(
                value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputKeys.INDENT)) {
            handler.setIndent(
                value != null && value.toLowerCase().equals("yes"));
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL +"indent-amount")) {
            if (value != null) {
                handler.setIndentAmount(Integer.parseInt(value));
            }
        }
        else if (name.equals(OutputPropertiesFactory.S_BUILTIN_EXTENSIONS_UNIVERSAL +"indent-amount")) {
            if (value != null) {
                handler.setIndentAmount(Integer.parseInt(value));
            }
        }
        else if (name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE)) {
            if (value != null && value.equals("yes")) {
                handler.setIsStandalone(true);
            }
        }
        else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) {
            if (value != null) {
                StringTokenizer e = new StringTokenizer(value);
                ArrayList<String> uriAndLocalNames = null;
                while (e.hasMoreTokens()) {
                    final String token = e.nextToken();

                    // look for the last colon, as the String may be
                    // something like "http://abc.com:local"
                    int lastcolon = token.lastIndexOf(':');
                    String uri;
                    String localName;
                    if (lastcolon > 0) {
                        uri = token.substring(0, lastcolon);
                        localName = token.substring(lastcolon+1);
                    } else {
                        // no colon at all, lets hope this is the
                        // local name itself then
                        uri = null;
                        localName = token;
                    }

                    if (uriAndLocalNames == null) {
                        uriAndLocalNames = new ArrayList<>();
                    }
                    // add the uri/localName as a pair, in that order
                    uriAndLocalNames.add(uri);
                    uriAndLocalNames.add(localName);
                }
                handler.setCdataSectionElements(uriAndLocalNames);
            }
        }
    }

    // Call setDoctype() if needed
    if (doctypePublic != null || doctypeSystem != null) {
        handler.setDoctype(doctypeSystem, doctypePublic);
    }
}
 
Example 10
Source File: AbstractTranslet.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Transfer the output settings to the output post-processor
 */
protected void transferOutputSettings(SerializationHandler handler) {
    if (_method != null) {
        if (_method.equals("xml")) {
            if (_standalone != null) {
                handler.setStandalone(_standalone);
            }
            if (_omitHeader) {
                handler.setOmitXMLDeclaration(true);
            }
            handler.setCdataSectionElements(_cdata);
            if (_version != null) {
                handler.setVersion(_version);
            }
            handler.setIndent(_indent);
            if (_indentamount >= 0)
                handler.setIndentAmount(_indentamount);
            if (_doctypeSystem != null) {
                handler.setDoctype(_doctypeSystem, _doctypePublic);
            }
            handler.setIsStandalone(_isStandalone);
        }
        else if (_method.equals("html")) {
            handler.setIndent(_indent);
            handler.setDoctype(_doctypeSystem, _doctypePublic);
            if (_mediaType != null) {
                handler.setMediaType(_mediaType);
            }
        }
    }
    else {
        handler.setCdataSectionElements(_cdata);
        if (_version != null) {
            handler.setVersion(_version);
        }
        if (_standalone != null) {
            handler.setStandalone(_standalone);
        }
        if (_omitHeader) {
            handler.setOmitXMLDeclaration(true);
        }
        handler.setIndent(_indent);
        handler.setDoctype(_doctypeSystem, _doctypePublic);
        handler.setIsStandalone(_isStandalone);
    }
}
 
Example 11
Source File: AbstractTranslet.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Transfer the output settings to the output post-processor
 */
protected void transferOutputSettings(SerializationHandler handler) {
    if (_method != null) {
        if (_method.equals("xml")) {
            if (_standalone != null) {
                handler.setStandalone(_standalone);
            }
            if (_omitHeader) {
                handler.setOmitXMLDeclaration(true);
            }
            handler.setCdataSectionElements(_cdata);
            if (_version != null) {
                handler.setVersion(_version);
            }
            handler.setIndent(_indent);
            handler.setIndentAmount(_indentamount);
            if (_doctypeSystem != null) {
                handler.setDoctype(_doctypeSystem, _doctypePublic);
            }
            handler.setIsStandalone(_isStandalone);
        }
        else if (_method.equals("html")) {
            handler.setIndent(_indent);
            handler.setDoctype(_doctypeSystem, _doctypePublic);
            if (_mediaType != null) {
                handler.setMediaType(_mediaType);
            }
        }
    }
    else {
        handler.setCdataSectionElements(_cdata);
        if (_version != null) {
            handler.setVersion(_version);
        }
        if (_standalone != null) {
            handler.setStandalone(_standalone);
        }
        if (_omitHeader) {
            handler.setOmitXMLDeclaration(true);
        }
        handler.setIndent(_indent);
        handler.setDoctype(_doctypeSystem, _doctypePublic);
        handler.setIsStandalone(_isStandalone);
    }
}
 
Example 12
Source File: AbstractTranslet.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Transfer the output settings to the output post-processor
 */
protected void transferOutputSettings(SerializationHandler handler) {
    if (_method != null) {
        if (_method.equals("xml")) {
            if (_standalone != null) {
                handler.setStandalone(_standalone);
            }
            if (_omitHeader) {
                handler.setOmitXMLDeclaration(true);
            }
            handler.setCdataSectionElements(_cdata);
            if (_version != null) {
                handler.setVersion(_version);
            }
            handler.setIndent(_indent);
            handler.setIndentAmount(_indentamount);
            if (_doctypeSystem != null) {
                handler.setDoctype(_doctypeSystem, _doctypePublic);
            }
            handler.setIsStandalone(_isStandalone);
        }
        else if (_method.equals("html")) {
            handler.setIndent(_indent);
            handler.setDoctype(_doctypeSystem, _doctypePublic);
            if (_mediaType != null) {
                handler.setMediaType(_mediaType);
            }
        }
    }
    else {
        handler.setCdataSectionElements(_cdata);
        if (_version != null) {
            handler.setVersion(_version);
        }
        if (_standalone != null) {
            handler.setStandalone(_standalone);
        }
        if (_omitHeader) {
            handler.setOmitXMLDeclaration(true);
        }
        handler.setIndent(_indent);
        handler.setDoctype(_doctypeSystem, _doctypePublic);
        handler.setIsStandalone(_isStandalone);
    }
}
 
Example 13
Source File: AbstractTranslet.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Transfer the output settings to the output post-processor
 */
protected void transferOutputSettings(SerializationHandler handler) {
    if (_method != null) {
        if (_method.equals("xml")) {
            if (_standalone != null) {
                handler.setStandalone(_standalone);
            }
            if (_omitHeader) {
                handler.setOmitXMLDeclaration(true);
            }
            handler.setCdataSectionElements(_cdata);
            if (_version != null) {
                handler.setVersion(_version);
            }
            handler.setIndent(_indent);
            handler.setIndentAmount(_indentamount);
            if (_doctypeSystem != null) {
                handler.setDoctype(_doctypeSystem, _doctypePublic);
            }
            handler.setIsStandalone(_isStandalone);
        }
        else if (_method.equals("html")) {
            handler.setIndent(_indent);
            handler.setDoctype(_doctypeSystem, _doctypePublic);
            if (_mediaType != null) {
                handler.setMediaType(_mediaType);
            }
        }
    }
    else {
        handler.setCdataSectionElements(_cdata);
        if (_version != null) {
            handler.setVersion(_version);
        }
        if (_standalone != null) {
            handler.setStandalone(_standalone);
        }
        if (_omitHeader) {
            handler.setOmitXMLDeclaration(true);
        }
        handler.setIndent(_indent);
        handler.setDoctype(_doctypeSystem, _doctypePublic);
        handler.setIsStandalone(_isStandalone);
    }
}