本文整理汇总了Java中com.sun.org.apache.xml.internal.serializer.OutputPropertiesFactory.getDefaultMethodProperties方法的典型用法代码示例。如果您正苦于以下问题:Java OutputPropertiesFactory.getDefaultMethodProperties方法的具体用法?Java OutputPropertiesFactory.getDefaultMethodProperties怎么用?Java OutputPropertiesFactory.getDefaultMethodProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.org.apache.xml.internal.serializer.OutputPropertiesFactory
的用法示例。
在下文中一共展示了OutputPropertiesFactory.getDefaultMethodProperties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setDefaults
import com.sun.org.apache.xml.internal.serializer.OutputPropertiesFactory; //导入方法依赖的package包/类
/**
* 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));
}
}
}
示例2: LSSerializerImpl
import com.sun.org.apache.xml.internal.serializer.OutputPropertiesFactory; //导入方法依赖的package包/类
/**
* 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);
}
示例3: loadSerializer
import com.sun.org.apache.xml.internal.serializer.OutputPropertiesFactory; //导入方法依赖的package包/类
/**
* 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);
}