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

The following examples show how to use com.sun.org.apache.xml.internal.serializer.ToXMLStream. 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: 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 #2
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);
}