Class WriterConfig
java.lang.Object
com.ctc.wstx.api.CommonConfig
com.ctc.wstx.api.WriterConfig
- All Implemented Interfaces:
OutputConfigFlags, org.codehaus.stax2.XMLStreamProperties
Simple configuration container class; passed by writer factory to writer
instance created.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final boolean09-Aug-2007, TSa: Space has always been added after empty element (before closing "/>"), but now it is configurable.protected static final String(package private) static final boolean(package private) static final boolean(package private) static final booleanAs per [WSTX-120], default was changed to false, from true (default prior to wstx 4.0)(package private) static final intFor now, full instances start with same settings as J2ME subset(package private) static final intDefault config flags are converted from individual settings, to conform to Stax 1.0 specifications.(package private) static final boolean(package private) static final boolean(package private) static final boolean(package private) static final boolean(package private) static final boolean(package private) static final booleanprotected int(package private) BufferRecyclerThis is the actually container of the recyclable buffers.(package private) final boolean(package private) static final ThreadLocal<SoftReference<BufferRecycler>> ThisThreadLocalcontains ato ainvalid reference
SoftRerefenceBufferRecyclerused to provide a low-cost buffer recycling between Reader instances.(package private) Object[](package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intMap to use for converting from String property ids to ints described above; useful to allow use of switch later on.Fields inherited from class CommonConfig
CPROP_IMPL_NAME, CPROP_IMPL_VERSION, CPROP_RETURN_NULL_FOR_DEFAULT_NAMESPACE, CPROP_SUPPORT_XMLID, CPROP_SUPPORTS_XML11, IMPL_NAME, IMPL_VERSION, mReturnNullForDefaultNamespace, sStdPropertiesFields inherited from interface OutputConfigFlags
CFG_ADD_SPACE_AFTER_EMPTY_ELEM, CFG_AUTO_CLOSE_OUTPUT, CFG_AUTOMATIC_EMPTY_ELEMENTS, CFG_AUTOMATIC_END_ELEMENTS, CFG_AUTOMATIC_NS, CFG_COPY_DEFAULT_ATTRS, CFG_ENABLE_NS, CFG_ESCAPE_CR, CFG_FIX_CONTENT, CFG_OUTPUT_CDATA_AS_TEXT, CFG_USE_DOUBLE_QUOTES_IN_XML_DECL, CFG_VALIDATE_ATTR, CFG_VALIDATE_CONTENT, CFG_VALIDATE_NAMES, CFG_VALIDATE_STRUCTUREFields inherited from interface org.codehaus.stax2.XMLStreamProperties
XSP_IMPLEMENTATION_NAME, XSP_IMPLEMENTATION_VERSION, XSP_NAMESPACE_AWARE, XSP_PROBLEM_REPORTER, XSP_SUPPORT_XMLID, XSP_SUPPORTS_XML11, XSP_V_XMLID_FULL, XSP_V_XMLID_NONE, XSP_V_XMLID_TYPING -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateWriterConfig(WriterConfig base, boolean j2meSubset, int flags, Object[] specProps) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]allocFullBBuffer(int minSize) char[]allocFullCBuffer(int minSize) char[]allocMediumCBuffer(int minSize) Method called to allocate intermediate recyclable copy buffersbooleanbooleanbooleanvoidFor Woodstox, this profile enables all basic well-formedness checks, including checking for name validity, and also enables all matching "fix-me" properties (currently only content-fixing property exists).voidFor Woodstox, setting this profile disables most checks for validity; specifically anything that can have measurable performance impact.voidFor Woodstox, this profile enables all basic well-formedness checks, including checking for name validity.static WriterConfigstatic WriterConfigprivate BufferRecyclervoiddoAddSpaceAfterEmptyElem(boolean state) voiddoAutoCloseOutput(boolean state) voiddoCopyDefaultAttrs(boolean state) voiddoEscapeCr(boolean state) voiddoFixContent(boolean state) voiddoOutputCDataAsText(boolean state) voiddoSupportNamespaces(boolean state) voiddoUseDoubleQuotesInXmlDecl(boolean state) voiddoValidateAttributes(boolean state) voiddoValidateContent(boolean state) voiddoValidateNames(boolean state) voiddoValidateStructure(boolean state) voidenableAutomaticEmptyElements(boolean state) voidenableAutomaticEndElements(boolean state) voidenableAutomaticNamespaces(boolean state) protected intfindPropertyId(String propName) voidfreeFullBBuffer(byte[] buffer) voidfreeFullCBuffer(char[] buffer) voidfreeMediumCBuffer(char[] buffer) org.codehaus.stax2.io.EscapingWriterFactoryintgetProperty(int id) private final ObjectgetSpecialProperty(int ix) org.codehaus.stax2.io.EscapingWriterFactoryprivate final booleanhasConfigFlag(int flag) voidsetAttrValueEscaperFactory(org.codehaus.stax2.io.EscapingWriterFactory f) voidsetAutomaticNsPrefix(String prefix) private voidsetConfigFlag(int flag, boolean state) voidvoidvoidbooleansetProperty(String name, int id, Object value) private final voidsetSpecialProperty(int ix, Object value) voidsetTextEscaperFactory(org.codehaus.stax2.io.EscapingWriterFactory f) booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanboolean
-
Field Details
-
DEFAULT_AUTOMATIC_NS_PREFIX
- See Also:
-
PROP_AUTOMATIC_NS
static final int PROP_AUTOMATIC_NS- See Also:
-
PROP_AUTOMATIC_EMPTY_ELEMENTS
static final int PROP_AUTOMATIC_EMPTY_ELEMENTS- See Also:
-
PROP_AUTO_CLOSE_OUTPUT
static final int PROP_AUTO_CLOSE_OUTPUT- See Also:
-
PROP_ENABLE_NS
static final int PROP_ENABLE_NS- See Also:
-
PROP_AUTOMATIC_NS_PREFIX
static final int PROP_AUTOMATIC_NS_PREFIX- See Also:
-
PROP_TEXT_ESCAPER
static final int PROP_TEXT_ESCAPER- See Also:
-
PROP_ATTR_VALUE_ESCAPER
static final int PROP_ATTR_VALUE_ESCAPER- See Also:
-
PROP_PROBLEM_REPORTER
static final int PROP_PROBLEM_REPORTER- See Also:
-
PROP_USE_DOUBLE_QUOTES_IN_XML_DECL
static final int PROP_USE_DOUBLE_QUOTES_IN_XML_DECL- See Also:
-
PROP_OUTPUT_CDATA_AS_TEXT
static final int PROP_OUTPUT_CDATA_AS_TEXT- See Also:
-
PROP_COPY_DEFAULT_ATTRS
static final int PROP_COPY_DEFAULT_ATTRS- See Also:
-
PROP_ESCAPE_CR
static final int PROP_ESCAPE_CR- See Also:
-
PROP_ADD_SPACE_AFTER_EMPTY_ELEM
static final int PROP_ADD_SPACE_AFTER_EMPTY_ELEM- See Also:
-
PROP_AUTOMATIC_END_ELEMENTS
static final int PROP_AUTOMATIC_END_ELEMENTS- See Also:
-
PROP_VALIDATE_STRUCTURE
static final int PROP_VALIDATE_STRUCTURE- See Also:
-
PROP_VALIDATE_CONTENT
static final int PROP_VALIDATE_CONTENT- See Also:
-
PROP_VALIDATE_ATTR
static final int PROP_VALIDATE_ATTR- See Also:
-
PROP_VALIDATE_NAMES
static final int PROP_VALIDATE_NAMES- See Also:
-
PROP_FIX_CONTENT
static final int PROP_FIX_CONTENT- See Also:
-
PROP_OUTPUT_INVALID_CHAR_HANDLER
static final int PROP_OUTPUT_INVALID_CHAR_HANDLER- See Also:
-
PROP_OUTPUT_EMPTY_ELEMENT_HANDLER
static final int PROP_OUTPUT_EMPTY_ELEMENT_HANDLER- See Also:
-
PROP_UNDERLYING_STREAM
static final int PROP_UNDERLYING_STREAM- See Also:
-
PROP_UNDERLYING_WRITER
static final int PROP_UNDERLYING_WRITER- See Also:
-
DEFAULT_USE_DOUBLE_QUOTES_IN_XML_DECL
static final boolean DEFAULT_USE_DOUBLE_QUOTES_IN_XML_DECL- See Also:
-
DEFAULT_OUTPUT_CDATA_AS_TEXT
static final boolean DEFAULT_OUTPUT_CDATA_AS_TEXT- See Also:
-
DEFAULT_COPY_DEFAULT_ATTRS
static final boolean DEFAULT_COPY_DEFAULT_ATTRS- See Also:
-
DEFAULT_ESCAPE_CR
static final boolean DEFAULT_ESCAPE_CR- See Also:
-
DEFAULT_ADD_SPACE_AFTER_EMPTY_ELEM
static final boolean DEFAULT_ADD_SPACE_AFTER_EMPTY_ELEM09-Aug-2007, TSa: Space has always been added after empty element (before closing "/>"), but now it is configurable. 31-Dec-2009, TSa: Intention was to leave it enabled for backwards compatibility: but due to a bug this was NOT the case... ugh.- See Also:
-
DEFAULT_VALIDATE_STRUCTURE
static final boolean DEFAULT_VALIDATE_STRUCTURE- See Also:
-
DEFAULT_VALIDATE_CONTENT
static final boolean DEFAULT_VALIDATE_CONTENT- See Also:
-
DEFAULT_VALIDATE_ATTR
static final boolean DEFAULT_VALIDATE_ATTR- See Also:
-
DEFAULT_VALIDATE_NAMES
static final boolean DEFAULT_VALIDATE_NAMES- See Also:
-
DEFAULT_FIX_CONTENT
static final boolean DEFAULT_FIX_CONTENTAs per [WSTX-120], default was changed to false, from true (default prior to wstx 4.0)- See Also:
-
DEFAULT_FLAGS_J2ME
static final int DEFAULT_FLAGS_J2MEDefault config flags are converted from individual settings, to conform to Stax 1.0 specifications.- See Also:
-
DEFAULT_FLAGS_FULL
static final int DEFAULT_FLAGS_FULLFor now, full instances start with same settings as J2ME subset- See Also:
-
sProperties
-
mIsJ2MESubset
final boolean mIsJ2MESubset -
mConfigFlags
protected int mConfigFlags -
mSpecialProperties
Object[] mSpecialProperties -
SPEC_PROC_COUNT
private static final int SPEC_PROC_COUNT- See Also:
-
SP_IX_AUTO_NS_PREFIX
private static final int SP_IX_AUTO_NS_PREFIX- See Also:
-
SP_IX_TEXT_ESCAPER_FACTORY
private static final int SP_IX_TEXT_ESCAPER_FACTORY- See Also:
-
SP_IX_ATTR_VALUE_ESCAPER_FACTORY
private static final int SP_IX_ATTR_VALUE_ESCAPER_FACTORY- See Also:
-
SP_IX_PROBLEM_REPORTER
private static final int SP_IX_PROBLEM_REPORTER- See Also:
-
SP_IX_INVALID_CHAR_HANDLER
private static final int SP_IX_INVALID_CHAR_HANDLER- See Also:
-
SP_IX_EMPTY_ELEMENT_HANDLER
private static final int SP_IX_EMPTY_ELEMENT_HANDLER- See Also:
-
mRecyclerRef
ThisThreadLocalcontains ato ainvalid reference
SoftRerefenceBufferRecyclerused to provide a low-cost buffer recycling between Reader instances. -
mCurrRecycler
BufferRecycler mCurrRecyclerThis is the actually container of the recyclable buffers. It is obtained via ThreadLocal/SoftReference combination, if one exists, when Config instance is created. If one does not exists, it will created first time a buffer is returned.
-
-
Constructor Details
-
WriterConfig
-
-
Method Details
-
createJ2MEDefaults
-
createFullDefaults
-
findPropertyId
- Specified by:
findPropertyIdin classCommonConfig- Returns:
- Internal enumerated int matching the String name of the property, if one found: -1 to indicate no match was found.
-
getProperty
- Specified by:
getPropertyin classCommonConfig
-
setProperty
- Specified by:
setPropertyin classCommonConfig- Returns:
- True, if the specified property was succesfully set to specified value; false if its value was not changed
-
getConfigFlags
public int getConfigFlags() -
automaticNamespacesEnabled
public boolean automaticNamespacesEnabled() -
automaticEmptyElementsEnabled
public boolean automaticEmptyElementsEnabled() -
willAutoCloseOutput
public boolean willAutoCloseOutput() -
willSupportNamespaces
public boolean willSupportNamespaces() -
willUseDoubleQuotesInXmlDecl
public boolean willUseDoubleQuotesInXmlDecl()- Since:
- 4.2.2
-
willOutputCDataAsText
public boolean willOutputCDataAsText() -
willCopyDefaultAttrs
public boolean willCopyDefaultAttrs() -
willEscapeCr
public boolean willEscapeCr() -
willAddSpaceAfterEmptyElem
public boolean willAddSpaceAfterEmptyElem() -
automaticEndElementsEnabled
public boolean automaticEndElementsEnabled() -
willValidateStructure
public boolean willValidateStructure() -
willValidateContent
public boolean willValidateContent() -
willValidateAttributes
public boolean willValidateAttributes() -
willValidateNames
public boolean willValidateNames() -
willFixContent
public boolean willFixContent() -
getAutomaticNsPrefix
- Returns:
- Prefix to use as the base for automatically generated namespace prefixes ("namespace prefix prefix", so to speak). Defaults to "wstxns".
-
getTextEscaperFactory
public org.codehaus.stax2.io.EscapingWriterFactory getTextEscaperFactory() -
getAttrValueEscaperFactory
public org.codehaus.stax2.io.EscapingWriterFactory getAttrValueEscaperFactory() -
getProblemReporter
-
getInvalidCharHandler
-
getEmptyElementHandler
-
enableAutomaticNamespaces
public void enableAutomaticNamespaces(boolean state) -
enableAutomaticEmptyElements
public void enableAutomaticEmptyElements(boolean state) -
doAutoCloseOutput
public void doAutoCloseOutput(boolean state) -
doSupportNamespaces
public void doSupportNamespaces(boolean state) -
doUseDoubleQuotesInXmlDecl
public void doUseDoubleQuotesInXmlDecl(boolean state) - Since:
- 4.2.2
-
doOutputCDataAsText
public void doOutputCDataAsText(boolean state) -
doCopyDefaultAttrs
public void doCopyDefaultAttrs(boolean state) -
doEscapeCr
public void doEscapeCr(boolean state) -
doAddSpaceAfterEmptyElem
public void doAddSpaceAfterEmptyElem(boolean state) -
enableAutomaticEndElements
public void enableAutomaticEndElements(boolean state) -
doValidateStructure
public void doValidateStructure(boolean state) -
doValidateContent
public void doValidateContent(boolean state) -
doValidateAttributes
public void doValidateAttributes(boolean state) -
doValidateNames
public void doValidateNames(boolean state) -
doFixContent
public void doFixContent(boolean state) -
setAutomaticNsPrefix
- Parameters:
prefix- Prefix to use as the base for automatically generated namespace prefixes ("namespace prefix prefix", so to speak).
-
setTextEscaperFactory
public void setTextEscaperFactory(org.codehaus.stax2.io.EscapingWriterFactory f) -
setAttrValueEscaperFactory
public void setAttrValueEscaperFactory(org.codehaus.stax2.io.EscapingWriterFactory f) -
setProblemReporter
-
setInvalidCharHandler
-
setEmptyElementHandler
-
configureForXmlConformance
public void configureForXmlConformance()For Woodstox, this profile enables all basic well-formedness checks, including checking for name validity. -
configureForRobustness
public void configureForRobustness()For Woodstox, this profile enables all basic well-formedness checks, including checking for name validity, and also enables all matching "fix-me" properties (currently only content-fixing property exists). -
configureForSpeed
public void configureForSpeed()For Woodstox, setting this profile disables most checks for validity; specifically anything that can have measurable performance impact. -
allocMediumCBuffer
public char[] allocMediumCBuffer(int minSize) Method called to allocate intermediate recyclable copy buffers -
freeMediumCBuffer
public void freeMediumCBuffer(char[] buffer) -
allocFullCBuffer
public char[] allocFullCBuffer(int minSize) -
freeFullCBuffer
public void freeFullCBuffer(char[] buffer) -
allocFullBBuffer
public byte[] allocFullBBuffer(int minSize) -
freeFullBBuffer
public void freeFullBBuffer(byte[] buffer) -
createRecycler
-
setConfigFlag
private void setConfigFlag(int flag, boolean state) -
hasConfigFlag
private final boolean hasConfigFlag(int flag) -
getSpecialProperty
-
setSpecialProperty
-