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

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