com.sun.org.apache.xml.internal.serializer.OutputPropertiesFactory Java Examples

The following examples show how to use com.sun.org.apache.xml.internal.serializer.OutputPropertiesFactory. 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 5 votes vote down vote up
/**
 * Internal method to get the default properties from the
 * serializer factory and set them on the property object.
 * @param props a java.util.Property object on which the properties are set.
 * @param method The output method type, one of "xml", "text", "html" ...
 */
private void setDefaults(Properties props, String method)
{
        final Properties method_props =
                OutputPropertiesFactory.getDefaultMethodProperties(method);
        {
                final Enumeration names = method_props.propertyNames();
                while (names.hasMoreElements())
                {
                        final String name = (String)names.nextElement();
                        props.setProperty(name, method_props.getProperty(name));
                }
        }
}
 
Example #2
Source File: TransformerImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Verifies if a given output property name is a property defined in
 * the JAXP 1.1 / TrAX spec
 */
private boolean validOutputProperty(String name) {
    return (name.equals(OutputKeys.ENCODING) ||
            name.equals(OutputKeys.METHOD) ||
            name.equals(OutputKeys.INDENT) ||
            name.equals(OutputKeys.DOCTYPE_PUBLIC) ||
            name.equals(OutputKeys.DOCTYPE_SYSTEM) ||
            name.equals(OutputKeys.CDATA_SECTION_ELEMENTS) ||
            name.equals(OutputKeys.MEDIA_TYPE) ||
            name.equals(OutputKeys.OMIT_XML_DECLARATION)   ||
            name.equals(OutputKeys.STANDALONE) ||
            name.equals(OutputKeys.VERSION) ||
            name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE) ||
            name.charAt(0) == '{');
}
 
Example #3
Source File: TransformerImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Internal method to get the default properties from the
 * serializer factory and set them on the property object.
 * @param props a java.util.Property object on which the properties are set.
 * @param method The output method type, one of "xml", "text", "html" ...
 */
private void setDefaults(Properties props, String method)
{
        final Properties method_props =
                OutputPropertiesFactory.getDefaultMethodProperties(method);
        {
                final Enumeration names = method_props.propertyNames();
                while (names.hasMoreElements())
                {
                        final String name = (String)names.nextElement();
                        props.setProperty(name, method_props.getProperty(name));
                }
        }
}
 
Example #4
Source File: TransformerImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Verifies if a given output property name is a property defined in
 * the JAXP 1.1 / TrAX spec
 */
private boolean validOutputProperty(String name) {
    return (name.equals(OutputKeys.ENCODING) ||
            name.equals(OutputKeys.METHOD) ||
            name.equals(OutputKeys.INDENT) ||
            name.equals(OutputKeys.DOCTYPE_PUBLIC) ||
            name.equals(OutputKeys.DOCTYPE_SYSTEM) ||
            name.equals(OutputKeys.CDATA_SECTION_ELEMENTS) ||
            name.equals(OutputKeys.MEDIA_TYPE) ||
            name.equals(OutputKeys.OMIT_XML_DECLARATION)   ||
            name.equals(OutputKeys.STANDALONE) ||
            name.equals(OutputKeys.VERSION) ||
            name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE) ||
            name.charAt(0) == '{');
}
 
Example #5
Source File: TransformerImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Internal method to get the default properties from the
 * serializer factory and set them on the property object.
 * @param props a java.util.Property object on which the properties are set.
 * @param method The output method type, one of "xml", "text", "html" ...
 */
private void setDefaults(Properties props, String method)
{
        final Properties method_props =
                OutputPropertiesFactory.getDefaultMethodProperties(method);
        {
                final Enumeration names = method_props.propertyNames();
                while (names.hasMoreElements())
                {
                        final String name = (String)names.nextElement();
                        props.setProperty(name, method_props.getProperty(name));
                }
        }
}
 
Example #6
Source File: TransformerImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Verifies if a given output property name is a property defined in
 * the JAXP 1.1 / TrAX spec
 */
private boolean validOutputProperty(String name) {
    return (name.equals(OutputKeys.ENCODING) ||
            name.equals(OutputKeys.METHOD) ||
            name.equals(OutputKeys.INDENT) ||
            name.equals(OutputKeys.DOCTYPE_PUBLIC) ||
            name.equals(OutputKeys.DOCTYPE_SYSTEM) ||
            name.equals(OutputKeys.CDATA_SECTION_ELEMENTS) ||
            name.equals(OutputKeys.MEDIA_TYPE) ||
            name.equals(OutputKeys.OMIT_XML_DECLARATION)   ||
            name.equals(OutputKeys.STANDALONE) ||
            name.equals(OutputKeys.VERSION) ||
            name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE) ||
            name.charAt(0) == '{');
}
 
Example #7
Source File: TransformerImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Internal method to get the default properties from the
 * serializer factory and set them on the property object.
 * @param props a java.util.Property object on which the properties are set.
 * @param method The output method type, one of "xml", "text", "html" ...
 */
private void setDefaults(Properties props, String method)
{
        final Properties method_props =
                OutputPropertiesFactory.getDefaultMethodProperties(method);
        {
                final Enumeration names = method_props.propertyNames();
                while (names.hasMoreElements())
                {
                        final String name = (String)names.nextElement();
                        props.setProperty(name, method_props.getProperty(name));
                }
        }
}
 
Example #8
Source File: LSSerializerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructor:  Creates a LSSerializerImpl object.  The underlying
 * XML 1.0 or XML 1.1 org.apache.xml.serializer.Serializer object is
 * created and initialized the first time any of the write methods are
 * invoked to serialize the Node.  Subsequent write methods on the same
 * LSSerializerImpl object will use the previously created Serializer object.
 */
public LSSerializerImpl () {
    // set default parameters
    fFeatures |= CDATA;
    fFeatures |= COMMENTS;
    fFeatures |= ELEM_CONTENT_WHITESPACE;
    fFeatures |= ENTITIES;
    fFeatures |= NAMESPACES;
    fFeatures |= NAMESPACEDECLS;
    fFeatures |= SPLITCDATA;
    fFeatures |= WELLFORMED;
    fFeatures |= DISCARDDEFAULT;
    fFeatures |= XMLDECL;

    // New OutputFormat properties
    fDOMConfigProperties = new Properties();

    // Initialize properties to be passed on the underlying serializer
    initializeSerializerProps();

    // Read output_xml.properties and System Properties to initialize properties
    Properties  configProps = OutputPropertiesFactory.getDefaultMethodProperties("xml");

    // change xml version from 1.0 to 1.1
    //configProps.setProperty("version", "1.1");

    // Get a serializer that seriailizes according to the properties,
    // which in this case is to xml
    fXMLSerializer = new ToXMLStream();
    fXMLSerializer.setOutputFormat(configProps);

    // Initialize Serializer
    fXMLSerializer.setOutputFormat(fDOMConfigProperties);
}
 
Example #9
Source File: TransformerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Verifies if a given output property name is a property defined in
 * the JAXP 1.1 / TrAX spec
 */
private boolean validOutputProperty(String name) {
    return (name.equals(OutputKeys.ENCODING) ||
            name.equals(OutputKeys.METHOD) ||
            name.equals(OutputKeys.INDENT) ||
            name.equals(OutputKeys.DOCTYPE_PUBLIC) ||
            name.equals(OutputKeys.DOCTYPE_SYSTEM) ||
            name.equals(OutputKeys.CDATA_SECTION_ELEMENTS) ||
            name.equals(OutputKeys.MEDIA_TYPE) ||
            name.equals(OutputKeys.OMIT_XML_DECLARATION)   ||
            name.equals(OutputKeys.STANDALONE) ||
            name.equals(OutputKeys.VERSION) ||
            name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE) ||
            name.charAt(0) == '{');
}
 
Example #10
Source File: TransformerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Internal method to get the default properties from the
 * serializer factory and set them on the property object.
 * @param props a java.util.Property object on which the properties are set.
 * @param method The output method type, one of "xml", "text", "html" ...
 */
private void setDefaults(Properties props, String method)
{
        final Properties method_props =
                OutputPropertiesFactory.getDefaultMethodProperties(method);
        {
                final Enumeration names = method_props.propertyNames();
                while (names.hasMoreElements())
                {
                        final String name = (String)names.nextElement();
                        props.setProperty(name, method_props.getProperty(name));
                }
        }
}
 
Example #11
Source File: LSSerializerImpl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor:  Creates a LSSerializerImpl object.  The underlying
 * XML 1.0 or XML 1.1 org.apache.xml.serializer.Serializer object is
 * created and initialized the first time any of the write methods are
 * invoked to serialize the Node.  Subsequent write methods on the same
 * LSSerializerImpl object will use the previously created Serializer object.
 */
public LSSerializerImpl () {
    // set default parameters
    fFeatures |= CDATA;
    fFeatures |= COMMENTS;
    fFeatures |= ELEM_CONTENT_WHITESPACE;
    fFeatures |= ENTITIES;
    fFeatures |= NAMESPACES;
    fFeatures |= NAMESPACEDECLS;
    fFeatures |= SPLITCDATA;
    fFeatures |= WELLFORMED;
    fFeatures |= DISCARDDEFAULT;
    fFeatures |= XMLDECL;

    // New OutputFormat properties
    fDOMConfigProperties = new Properties();

    // Initialize properties to be passed on the underlying serializer
    initializeSerializerProps();

    // Read output_xml.properties and System Properties to initialize properties
    Properties  configProps = OutputPropertiesFactory.getDefaultMethodProperties("xml");

    // change xml version from 1.0 to 1.1
    //configProps.setProperty("version", "1.1");

    // Get a serializer that seriailizes according to the properties,
    // which in this case is to xml
    fXMLSerializer = new ToXMLStream(null);
    fXMLSerializer.setOutputFormat(configProps);

    // Initialize Serializer
    fXMLSerializer.setOutputFormat(fDOMConfigProperties);
}
 
Example #12
Source File: TransformerImpl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Verifies if a given output property name is a property defined in
 * the JAXP 1.1 / TrAX spec
 */
private boolean validOutputProperty(String name) {
    return (name.equals(OutputKeys.ENCODING) ||
            name.equals(OutputKeys.METHOD) ||
            name.equals(OutputKeys.INDENT) ||
            name.equals(OutputKeys.DOCTYPE_PUBLIC) ||
            name.equals(OutputKeys.DOCTYPE_SYSTEM) ||
            name.equals(OutputKeys.CDATA_SECTION_ELEMENTS) ||
            name.equals(OutputKeys.MEDIA_TYPE) ||
            name.equals(OutputKeys.OMIT_XML_DECLARATION)   ||
            name.equals(OutputKeys.STANDALONE) ||
            name.equals(OutputKeys.VERSION) ||
            name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE) ||
            name.charAt(0) == '{');
}
 
Example #13
Source File: TransformerImpl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Internal method to get the default properties from the
 * serializer factory and set them on the property object.
 * @param props a java.util.Property object on which the properties are set.
 * @param method The output method type, one of "xml", "text", "html" ...
 */
private void setDefaults(Properties props, String method)
{
        final Properties method_props =
                OutputPropertiesFactory.getDefaultMethodProperties(method);
        {
            final Enumeration<?> names = method_props.propertyNames();
            while (names.hasMoreElements())
            {
                final String name = (String)names.nextElement();
                props.setProperty(name, method_props.getProperty(name));
            }
        }
}
 
Example #14
Source File: TransformerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Verifies if a given output property name is a property defined in
 * the JAXP 1.1 / TrAX spec
 */
private boolean validOutputProperty(String name) {
    return (name.equals(OutputKeys.ENCODING) ||
            name.equals(OutputKeys.METHOD) ||
            name.equals(OutputKeys.INDENT) ||
            name.equals(OutputKeys.DOCTYPE_PUBLIC) ||
            name.equals(OutputKeys.DOCTYPE_SYSTEM) ||
            name.equals(OutputKeys.CDATA_SECTION_ELEMENTS) ||
            name.equals(OutputKeys.MEDIA_TYPE) ||
            name.equals(OutputKeys.OMIT_XML_DECLARATION)   ||
            name.equals(OutputKeys.STANDALONE) ||
            name.equals(OutputKeys.VERSION) ||
            name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE) ||
            name.charAt(0) == '{');
}
 
Example #15
Source File: TransformerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Internal method to get the default properties from the
 * serializer factory and set them on the property object.
 * @param props a java.util.Property object on which the properties are set.
 * @param method The output method type, one of "xml", "text", "html" ...
 */
private void setDefaults(Properties props, String method)
{
        final Properties method_props =
                OutputPropertiesFactory.getDefaultMethodProperties(method);
        {
                final Enumeration names = method_props.propertyNames();
                while (names.hasMoreElements())
                {
                        final String name = (String)names.nextElement();
                        props.setProperty(name, method_props.getProperty(name));
                }
        }
}
 
Example #16
Source File: TransformerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Verifies if a given output property name is a property defined in
 * the JAXP 1.1 / TrAX spec
 */
private boolean validOutputProperty(String name) {
    return (name.equals(OutputKeys.ENCODING) ||
            name.equals(OutputKeys.METHOD) ||
            name.equals(OutputKeys.INDENT) ||
            name.equals(OutputKeys.DOCTYPE_PUBLIC) ||
            name.equals(OutputKeys.DOCTYPE_SYSTEM) ||
            name.equals(OutputKeys.CDATA_SECTION_ELEMENTS) ||
            name.equals(OutputKeys.MEDIA_TYPE) ||
            name.equals(OutputKeys.OMIT_XML_DECLARATION)   ||
            name.equals(OutputKeys.STANDALONE) ||
            name.equals(OutputKeys.VERSION) ||
            name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE) ||
            name.charAt(0) == '{');
}
 
Example #17
Source File: TransformerImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Verifies if a given output property name is a property defined in
 * the JAXP 1.1 / TrAX spec
 */
private boolean validOutputProperty(String name) {
    return (name.equals(OutputKeys.ENCODING) ||
            name.equals(OutputKeys.METHOD) ||
            name.equals(OutputKeys.INDENT) ||
            name.equals(OutputKeys.DOCTYPE_PUBLIC) ||
            name.equals(OutputKeys.DOCTYPE_SYSTEM) ||
            name.equals(OutputKeys.CDATA_SECTION_ELEMENTS) ||
            name.equals(OutputKeys.MEDIA_TYPE) ||
            name.equals(OutputKeys.OMIT_XML_DECLARATION)   ||
            name.equals(OutputKeys.STANDALONE) ||
            name.equals(OutputKeys.VERSION) ||
            name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE) ||
            name.charAt(0) == '{');
}
 
Example #18
Source File: TransformerImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Internal method to get the default properties from the
 * serializer factory and set them on the property object.
 * @param props a java.util.Property object on which the properties are set.
 * @param method The output method type, one of "xml", "text", "html" ...
 */
private void setDefaults(Properties props, String method)
{
        final Properties method_props =
                OutputPropertiesFactory.getDefaultMethodProperties(method);
        {
                final Enumeration names = method_props.propertyNames();
                while (names.hasMoreElements())
                {
                        final String name = (String)names.nextElement();
                        props.setProperty(name, method_props.getProperty(name));
                }
        }
}
 
Example #19
Source File: TransformerImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Verifies if a given output property name is a property defined in
 * the JAXP 1.1 / TrAX spec
 */
private boolean validOutputProperty(String name) {
    return (name.equals(OutputKeys.ENCODING) ||
            name.equals(OutputKeys.METHOD) ||
            name.equals(OutputKeys.INDENT) ||
            name.equals(OutputKeys.DOCTYPE_PUBLIC) ||
            name.equals(OutputKeys.DOCTYPE_SYSTEM) ||
            name.equals(OutputKeys.CDATA_SECTION_ELEMENTS) ||
            name.equals(OutputKeys.MEDIA_TYPE) ||
            name.equals(OutputKeys.OMIT_XML_DECLARATION)   ||
            name.equals(OutputKeys.STANDALONE) ||
            name.equals(OutputKeys.VERSION) ||
            name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE) ||
            name.charAt(0) == '{');
}
 
Example #20
Source File: TransformerImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Internal method to get the default properties from the
 * serializer factory and set them on the property object.
 * @param props a java.util.Property object on which the properties are set.
 * @param method The output method type, one of "xml", "text", "html" ...
 */
private void setDefaults(Properties props, String method)
{
        final Properties method_props =
                OutputPropertiesFactory.getDefaultMethodProperties(method);
        {
                final Enumeration names = method_props.propertyNames();
                while (names.hasMoreElements())
                {
                        final String name = (String)names.nextElement();
                        props.setProperty(name, method_props.getProperty(name));
                }
        }
}
 
Example #21
Source File: TransformerImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Verifies if a given output property name is a property defined in
 * the JAXP 1.1 / TrAX spec
 */
private boolean validOutputProperty(String name) {
    return (name.equals(OutputKeys.ENCODING) ||
            name.equals(OutputKeys.METHOD) ||
            name.equals(OutputKeys.INDENT) ||
            name.equals(OutputKeys.DOCTYPE_PUBLIC) ||
            name.equals(OutputKeys.DOCTYPE_SYSTEM) ||
            name.equals(OutputKeys.CDATA_SECTION_ELEMENTS) ||
            name.equals(OutputKeys.MEDIA_TYPE) ||
            name.equals(OutputKeys.OMIT_XML_DECLARATION)   ||
            name.equals(OutputKeys.STANDALONE) ||
            name.equals(OutputKeys.VERSION) ||
            name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE) ||
            name.charAt(0) == '{');
}
 
Example #22
Source File: TransformerImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Internal method to get the default properties from the
 * serializer factory and set them on the property object.
 * @param props a java.util.Property object on which the properties are set.
 * @param method The output method type, one of "xml", "text", "html" ...
 */
private void setDefaults(Properties props, String method)
{
        final Properties method_props =
                OutputPropertiesFactory.getDefaultMethodProperties(method);
        {
                final Enumeration names = method_props.propertyNames();
                while (names.hasMoreElements())
                {
                        final String name = (String)names.nextElement();
                        props.setProperty(name, method_props.getProperty(name));
                }
        }
}
 
Example #23
Source File: TransformerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Internal method to get the default properties from the
 * serializer factory and set them on the property object.
 * @param props a java.util.Property object on which the properties are set.
 * @param method The output method type, one of "xml", "text", "html" ...
 */
private void setDefaults(Properties props, String method)
{
        final Properties method_props =
                OutputPropertiesFactory.getDefaultMethodProperties(method);
        {
                final Enumeration names = method_props.propertyNames();
                while (names.hasMoreElements())
                {
                        final String name = (String)names.nextElement();
                        props.setProperty(name, method_props.getProperty(name));
                }
        }
}
 
Example #24
Source File: TransformerImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Verifies if a given output property name is a property defined in
 * the JAXP 1.1 / TrAX spec
 */
private boolean validOutputProperty(String name) {
    return (name.equals(OutputKeys.ENCODING) ||
            name.equals(OutputKeys.METHOD) ||
            name.equals(OutputKeys.INDENT) ||
            name.equals(OutputKeys.DOCTYPE_PUBLIC) ||
            name.equals(OutputKeys.DOCTYPE_SYSTEM) ||
            name.equals(OutputKeys.CDATA_SECTION_ELEMENTS) ||
            name.equals(OutputKeys.MEDIA_TYPE) ||
            name.equals(OutputKeys.OMIT_XML_DECLARATION)   ||
            name.equals(OutputKeys.STANDALONE) ||
            name.equals(OutputKeys.VERSION) ||
            name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE) ||
            name.charAt(0) == '{');
}
 
Example #25
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 #26
Source File: SqlXmlHelperSun5.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
/**
 * Create an instance of Xalan serializer for the sake of serializing an XML
 * value according the SQL/XML specification for serialization.
 */
private void loadSerializer() throws java.io.IOException {
  // Set serialization properties.

  // using JDK5's class
  Properties props = OutputPropertiesFactory
      .getDefaultMethodProperties("xml");
  /* (original code)
  Properties props = OutputProperties.getDefaultMethodProperties("xml");
  */

  // SQL/XML[2006] 10.15:General Rules:6 says method is "xml".
  props.setProperty(OutputKeys.METHOD, "xml");

  /* Since the XMLSERIALIZE operator doesn't currently support
   * the DOCUMENT nor CONTENT keywords, SQL/XML spec says that
   * the default is CONTENT (6.7:Syntax Rules:2.a).  Further,
   * since the XMLSERIALIZE operator doesn't currently support the
   * <XML declaration option> syntax, the SQL/XML spec says
   * that the default for that option is "Unknown" (6.7:General
   * Rules:2.f).  Put those together and that in turn means that
   * the value of "OMIT XML DECLARATION" must be "Yes", as
   * stated in section 10.15:General Rules:8.c.  SO, that's what
   * we set here.
   *
   * NOTE: currently the only way to view the contents of an
   * XML column is by using an explicit XMLSERIALIZE operator.
   * This means that if an XML document is stored and it
   * begins with an XML declaration, the user will never be
   * able to _see_ that declaration after inserting the doc
   * because, as explained above, our current support for
   * XMLSERIALIZE dictates that the declaration must be
   * omitted.  Similarly, other transformations that may
   * occur from serialization (ex. entity replacement,
   * attribute order, single-to-double quotes, etc)) will
   * always be in effect for the string returned to the user;
   * the original form of the XML document, if different
   * from the serialized version, is not currently retrievable.
   */
  props.setProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");

  // We serialize everything as UTF-8 to match what we
  // store on disk.
  props.setProperty(OutputKeys.ENCODING, "UTF-8");

  // Load the serializer with the correct properties.
  serializer = SerializerFactory.getSerializer(props);
}
 
Example #27
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 #28
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 #29
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;
             }
        }
    }
}
 
Example #30
Source File: SqlXmlHelperSun5.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
/**
 * Create an instance of Xalan serializer for the sake of serializing an XML
 * value according the SQL/XML specification for serialization.
 */
private void loadSerializer() throws java.io.IOException {
  // Set serialization properties.

  // using JDK5's class
  Properties props = OutputPropertiesFactory
      .getDefaultMethodProperties("xml");
  /* (original code)
  Properties props = OutputProperties.getDefaultMethodProperties("xml");
  */

  // SQL/XML[2006] 10.15:General Rules:6 says method is "xml".
  props.setProperty(OutputKeys.METHOD, "xml");

  /* Since the XMLSERIALIZE operator doesn't currently support
   * the DOCUMENT nor CONTENT keywords, SQL/XML spec says that
   * the default is CONTENT (6.7:Syntax Rules:2.a).  Further,
   * since the XMLSERIALIZE operator doesn't currently support the
   * <XML declaration option> syntax, the SQL/XML spec says
   * that the default for that option is "Unknown" (6.7:General
   * Rules:2.f).  Put those together and that in turn means that
   * the value of "OMIT XML DECLARATION" must be "Yes", as
   * stated in section 10.15:General Rules:8.c.  SO, that's what
   * we set here.
   *
   * NOTE: currently the only way to view the contents of an
   * XML column is by using an explicit XMLSERIALIZE operator.
   * This means that if an XML document is stored and it
   * begins with an XML declaration, the user will never be
   * able to _see_ that declaration after inserting the doc
   * because, as explained above, our current support for
   * XMLSERIALIZE dictates that the declaration must be
   * omitted.  Similarly, other transformations that may
   * occur from serialization (ex. entity replacement,
   * attribute order, single-to-double quotes, etc)) will
   * always be in effect for the string returned to the user;
   * the original form of the XML document, if different
   * from the serialized version, is not currently retrievable.
   */
  props.setProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");

  // We serialize everything as UTF-8 to match what we
  // store on disk.
  props.setProperty(OutputKeys.ENCODING, "UTF-8");

  // Load the serializer with the correct properties.
  serializer = SerializerFactory.getSerializer(props);
}