|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectglobal.sandbox.xmlutilities.OutputFormat
public class OutputFormat
Convenient harness for configuration of Transformers'
output intent.
This class supports the following keys:
method
, OutputKeys.METHOD
version
, OutputKeys.VERSION
encoding
, OutputKeys.ENCODING
omit-xml-declaration
, OutputKeys.OMIT_XML_DECLARATION
standalone
, OutputKeys.STANDALONE
doctype-public
, OutputKeys.DOCTYPE_PUBLIC
doctype-system
, OutputKeys.DOCTYPE_SYSTEM
cdata-section-elements
, OutputKeys.CDATA_SECTION_ELEMENTS
indent
, OutputKeys.INDENT
media-type
, OutputKeys.MEDIA_TYPE
Nested Class Summary | |
---|---|
static class |
OutputFormat.Boolean
Represents Boolean value with appropriate value expected by Transformer . |
static class |
OutputFormat.Builder
Builder for declarative construction of OutputFormat . |
private static interface |
OutputFormat.ConfigurationValue
Convenient interface for getting rendered codes. |
static class |
OutputFormat.OutputMethod
Typed representation of output method with appropriate and expected values by Transformer . |
Field Summary | |
---|---|
private List<String> |
cdataSectionElements
CDATA section element list. |
private Map<String,String> |
customProperties
Custom properties. |
private String |
doctypePublic
DOCTYPE PUBLIC. |
private String |
doctypeSystem
DOCTYPE SYSTEM. |
private String |
encoding
encoding. |
static String |
HTML_VERSION_4_0
Default version for HTML output method. |
private OutputFormat.Boolean |
indent
Indent flag. |
private String |
mediaType
Media type. |
private OutputFormat.OutputMethod |
method
output method. |
private OutputFormat.Boolean |
omitXmlDeclaration
omit XML Declaration flag. |
private static long |
serialVersionUID
|
private OutputFormat.Boolean |
standalone
standalone flag. |
private static List<String> |
SUPPORTED_KEYS
List of supported keys by this class. |
private String |
version
version. |
static String |
XML_VERSION_1_0
Default version for XML output method. |
Constructor Summary | |
---|---|
OutputFormat()
|
Method Summary | |
---|---|
void |
addCdataSectionElement(String elementName)
Adds qualified element name into CDATA section element list. |
void |
addCustomProperty(String key,
String value)
Adds specified key-value property. |
private static void |
addPropertyIfDefined(Properties result,
String key,
OutputFormat.ConfigurationValue value)
Adds property if value is not null . |
private static void |
addPropertyIfDefined(Properties result,
String key,
String value)
Adds property if value is not null . |
List<String> |
getCdataSectionElements()
Returns list of CDATA section elements. |
Map<String,String> |
getCustomProperties()
Returns custom properties. |
String |
getDoctypePublic()
Returns DOCTYPE PUBLIC. |
String |
getDoctypeSystem()
Returns DOCTYPE SYSTEM. |
String |
getEncoding()
Returns encoding. |
OutputFormat.Boolean |
getIndent()
Returns indent. |
String |
getMediaType()
Returns media type. |
OutputFormat.OutputMethod |
getMethod()
Returns output method. |
OutputFormat.Boolean |
getOmitXmlDeclaration()
Returns omit XML declaration flag. |
OutputFormat.Boolean |
getStandalone()
Returns standalone. |
String |
getVersion()
Returns version. |
static OutputFormat.Builder |
newCustomMethodBuilder(String method)
Creates builder for custom method. |
static OutputFormat.Builder |
newHtmlMethodBuilder()
Creates builder for HTML method intent. |
static OutputFormat.Builder |
newTextMethodBuilder()
Creates builder for Text method intent. |
static OutputFormat.Builder |
newXmlMethodBuilder()
Creates builder for XML method intent. |
private static String |
renderCdataSectionElementList(List<String> elements)
Renders list of CDATA section elements into property value text. |
void |
setDoctypePublic(String doctypePublic)
Sets DOCTYPE PUBLIC. |
void |
setDoctypeSystem(String doctypeSystem)
Sets DOCTYPE SYSTEM. |
void |
setEncoding(String encoding)
Sets encoding. |
void |
setIndent(OutputFormat.Boolean indent)
Sets indent flag. |
void |
setMediaType(String mediaType)
Sets media type. |
void |
setMethod(OutputFormat.OutputMethod method)
Sets output method. |
void |
setOmitXmlDeclaration(OutputFormat.Boolean omitXmlDeclaration)
Sets omit XML declaration flag. |
void |
setStandalone(OutputFormat.Boolean standalone)
Sets standalone flag. |
void |
setVersion(String version)
Sets version. |
Properties |
toTransformerOutputProperties()
Renders this class into Properties ready to be used by
setOutputProperties(java.util.Properties) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
public static final String XML_VERSION_1_0
public static final String HTML_VERSION_4_0
private static final List<String> SUPPORTED_KEYS
private OutputFormat.OutputMethod method
private String version
private String encoding
private OutputFormat.Boolean omitXmlDeclaration
private OutputFormat.Boolean standalone
private String doctypePublic
private String doctypeSystem
private final List<String> cdataSectionElements
private OutputFormat.Boolean indent
private String mediaType
private final Map<String,String> customProperties
Constructor Detail |
---|
public OutputFormat()
Method Detail |
---|
public static OutputFormat.Builder newXmlMethodBuilder()
public static OutputFormat.Builder newHtmlMethodBuilder()
public static OutputFormat.Builder newTextMethodBuilder()
public static OutputFormat.Builder newCustomMethodBuilder(String method)
method
- mandatory name of the custom method
public Properties toTransformerOutputProperties()
this
class into Properties
ready to be used by
setOutputProperties(java.util.Properties)
.
private static void addPropertyIfDefined(Properties result, String key, String value)
null
.
result
- target mapkey
- keyvalue
- valueprivate static void addPropertyIfDefined(Properties result, String key, OutputFormat.ConfigurationValue value)
null
.
result
- target mapkey
- keyvalue
- valueprivate static String renderCdataSectionElementList(List<String> elements)
elements
- list of CDATA section elements
public void setMethod(OutputFormat.OutputMethod method)
method
- methodpublic void setVersion(String version)
version
- version stringpublic void setEncoding(String encoding)
encoding
- encoding namepublic void setOmitXmlDeclaration(OutputFormat.Boolean omitXmlDeclaration)
omitXmlDeclaration
- statepublic void setStandalone(OutputFormat.Boolean standalone)
standalone
- statepublic void setDoctypePublic(String doctypePublic)
doctypePublic
- valuepublic void setDoctypeSystem(String doctypeSystem)
doctypeSystem
- valuepublic void setIndent(OutputFormat.Boolean indent)
indent
- statepublic void setMediaType(String mediaType)
mediaType
- media typepublic void addCdataSectionElement(String elementName)
elementName
- element to addpublic void addCustomProperty(String key, String value)
key
- keyvalue
- valuepublic OutputFormat.OutputMethod getMethod()
public String getVersion()
public String getEncoding()
public OutputFormat.Boolean getOmitXmlDeclaration()
public OutputFormat.Boolean getStandalone()
public String getDoctypePublic()
public String getDoctypeSystem()
public List<String> getCdataSectionElements()
public OutputFormat.Boolean getIndent()
public String getMediaType()
public Map<String,String> getCustomProperties()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |