Package com.ctc.wstx.sw
Class BaseStreamWriter
java.lang.Object
org.codehaus.stax2.ri.Stax2WriterImpl
com.ctc.wstx.sw.BaseStreamWriter
- All Implemented Interfaces:
OutputConfigFlags
,XMLStreamConstants
,XMLStreamWriter
,org.codehaus.stax2.typed.TypedXMLStreamWriter
,org.codehaus.stax2.validation.Validatable
,org.codehaus.stax2.validation.ValidationContext
,org.codehaus.stax2.XMLStreamWriter2
- Direct Known Subclasses:
TypedStreamWriter
public abstract class BaseStreamWriter
extends org.codehaus.stax2.ri.Stax2WriterImpl
implements org.codehaus.stax2.validation.ValidationContext, OutputConfigFlags
Base class for
XMLStreamWriter
implementations Woodstox has.
Contains partial stream writer implementation, plus utility methods
shared by concrete implementation classes. Main reason for such
abstract base class is to allow other parts of Woodstox core to refer
to any of stream writer implementations in general way.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int
protected static final char
protected static final int
protected boolean
Flag that is set to true first time something has been output.protected final boolean
protected final boolean
protected final boolean
protected boolean
protected boolean
protected final WriterConfig
protected char[]
Intermediate buffer into which characters of a String can be copied, in cases where such a copy followed by array access is faster than callingString.charAt()
(which perhaps surprisingly is often case, and especially significant for longer buffers).protected String
Value passed as the expected root element, when using the multiple argumentwriteDTD(java.lang.String)
method.protected boolean
Flag that indicates that current element is an empty element (one that is explicitly defined as one, by calling a method -- NOT one that just happens to be empty).protected String
Encoding to use; may be passed from the factory (when a method that defines encoding is used), updated by a call towriteStartDocument()
, or null if neither.protected static final int
This constant defines minimum length of a String, for which it is beneficial to do an intermediate copy (using String.getChars()), and iterate over intermediate array, instead of iterating using String.charAt().protected boolean
protected boolean
Flag that is set during time that a start element is "open", ie.protected int
protected org.codehaus.stax2.validation.XMLValidator
Optional validator to use for validating output against one or more schemas, and/or for safe pretty-printing (indentation).protected int
State value used with validation, to track types of content that is allowed at this point in output stream.protected org.codehaus.stax2.validation.ValidationProblemHandler
Custom validation problem handler, if any.protected final XmlWriter
Actual physical writer to output serialized XML content toprotected boolean
Since XML 1.1 has some differences to 1.0, we need to keep a flag to indicate if we were to output XML 1.1 document.protected static final int
protected static final int
protected static final int
Fields inherited from interface com.ctc.wstx.cfg.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_STRUCTURE
Fields inherited from interface javax.xml.stream.XMLStreamConstants
ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BaseStreamWriter
(XmlWriter xw, String enc, WriterConfig cfg) -
Method Summary
Modifier and TypeMethodDescriptionprivate final void
_finishDocument
(boolean forceRealClose) int
addDefaultAttribute
(String localName, String uri, String prefix, String value) Adding default attribute values does not usually make sense on output side, so the implementation is a NOP for now.void
close()
void
protected abstract void
closeStartElement
(boolean emptyElem) Method called to close an open start element, when another main-level element (not namespace declaration or attribute) is being output; except for end element which is handled differently.void
copyEventFromReader
(org.codehaus.stax2.XMLStreamReader2 sr, boolean preserveEventData) Method that essentially copies event that the specified reader has just read.abstract void
copyStartElement
(InputElementStack elemStack, AttributeCollector attrCollector) Implementation-dependant method called to fully copy START_ELEMENT event that the passed-in stream reader points toprotected void
doReportProblem
(XMLReporter rep, String probType, String msg, Location loc) protected void
doReportProblem
(XMLReporter rep, org.codehaus.stax2.validation.XMLValidationProblem prob) protected void
doWriteStartDocument
(String version, String encoding, String standAlone) int
findAttributeIndex
(String nsURI, String localName) void
flush()
int
getAttributeLocalName
(int index) getAttributeNamespace
(int index) getAttributePrefix
(int index) getAttributeType
(int index) getAttributeValue
(int index) getAttributeValue
(String nsURI, String localName) As of now, there is no way to specify the base URI.protected final char[]
protected final char[]
getCopyBuffer
(int minLen) abstract QName
org.codehaus.stax2.XMLStreamLocation2
abstract NamespaceContext
abstract String
getNamespaceURI
(String prefix) abstract String
getProperty
(String name) protected abstract String
Method needed for error message generationprotected final boolean
boolean
isNotationDeclared
(String name) boolean
isPropertySupported
(String name) boolean
protected boolean
Method that is used by output classes to determine whether we are in validating mode.protected static void
reportIllegalArg
(String msg) protected static void
Method called when an illegal method (namespace-specific method on non-ns writer) is called by the application.protected void
reportInvalidContent
(int evtType) protected static void
reportNwfAttr
(String msg) This is the method called when an output method call violates attribute well-formedness checks (trying to output dup attrs) andWstxOutputProperties.P_OUTPUT_VALIDATE_NAMES
is is enabled.protected static void
reportNwfAttr
(String msg, Object arg) protected static void
reportNwfContent
(String msg) This is the method called when an output method call violates content well-formedness checks andWstxOutputProperties.P_OUTPUT_VALIDATE_CONTENT
is is enabled.protected static void
reportNwfContent
(String msg, Object arg) protected static void
reportNwfStructure
(String msg) This is the method called when an output method call violates structural well-formedness checks andWstxOutputProperties.P_OUTPUT_VALIDATE_STRUCTURE
is is enabled.protected static void
reportNwfStructure
(String msg, Object arg) void
reportProblem
(org.codehaus.stax2.validation.XMLValidationProblem prob) void
void
reportValidationProblem
(String msg, int severity) void
reportValidationProblem
(String format, Object arg) void
reportValidationProblem
(String format, Object arg, Object arg2) void
reportValidationProblem
(String msg, Location loc, int severity) void
reportValidationProblem
(Location loc, String msg) private void
abstract void
abstract void
setNamespaceContext
(NamespaceContext context) abstract void
boolean
setProperty
(String name, Object value) org.codehaus.stax2.validation.ValidationProblemHandler
setValidationProblemHandler
(org.codehaus.stax2.validation.ValidationProblemHandler h) org.codehaus.stax2.validation.XMLValidator
stopValidatingAgainst
(org.codehaus.stax2.validation.XMLValidationSchema schema) org.codehaus.stax2.validation.XMLValidator
stopValidatingAgainst
(org.codehaus.stax2.validation.XMLValidator validator) protected static void
throwFromIOE
(IOException ioe) protected static void
throwOutputError
(String msg) protected static void
throwOutputError
(String format, Object arg) toString()
org.codehaus.stax2.validation.XMLValidator
validateAgainst
(org.codehaus.stax2.validation.XMLValidationSchema schema) abstract String
validateQNamePrefix
(QName name) Method called before writing a QName via Typed Access API.protected void
verifyRootElement
(String localName, String prefix) protected final void
protected final void
final Writer
Method that can be called to get a wrapper instance that can be used to essentially call thewriteRaw
method via regularWriter
interface.final Writer
Method that can be called to get a wrapper instance that can be used to essentially call thewriteCharacters
method via regularWriter
interface.abstract void
writeAttribute
(String localName, String value) abstract void
writeAttribute
(String nsURI, String localName, String value) abstract void
writeAttribute
(String prefix, String nsURI, String localName, String value) void
writeCData
(char[] cbuf, int start, int len) void
writeCData
(String data) void
writeCharacters
(char[] text, int start, int len) void
writeCharacters
(String text) void
Method called byXMLEventWriter
(instead of more generic text output methods), so that we can verify (if necessary) that this character output type is legal in this context.void
writeComment
(String data) abstract void
writeDefaultNamespace
(String nsURI) void
void
void
writeDTD
(org.codehaus.stax2.DTDInfo info) abstract void
writeEmptyElement
(String localName) abstract void
writeEmptyElement
(String nsURI, String localName) abstract void
writeEmptyElement
(String prefix, String localName, String nsURI) void
abstract void
abstract void
writeEndElement
(QName name) Method called byXMLEventWriter
(instead of the version that takes no argument), so that we can verify it does match the start element if necessary.void
writeEntityRef
(String name) abstract void
abstract void
writeNamespace
(String prefix, String nsURI) void
writeProcessingInstruction
(String target) void
writeProcessingInstruction
(String target, String data) void
writeRaw
(char[] text, int start, int offset) void
void
void
writeSpace
(char[] text, int offset, int length) void
writeSpace
(String text) void
void
writeStartDocument
(String version) void
writeStartDocument
(String encoding, String version) void
writeStartDocument
(String version, String encoding, boolean standAlone) abstract void
writeStartElement
(String localName) abstract void
writeStartElement
(String nsURI, String localName) abstract void
writeStartElement
(String prefix, String localName, String nsURI) abstract void
Convenience method needed byXMLEventWriter
implementation, to use when writing a start element, and possibly its attributes and namespace declarations.Methods inherited from class org.codehaus.stax2.ri.Stax2WriterImpl
copyStartElement
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.codehaus.stax2.typed.TypedXMLStreamWriter
writeBinary, writeBinary, writeBinaryAttribute, writeBinaryAttribute, writeBoolean, writeBooleanAttribute, writeDecimal, writeDecimalAttribute, writeDouble, writeDoubleArray, writeDoubleArrayAttribute, writeDoubleAttribute, writeFloat, writeFloatArray, writeFloatArrayAttribute, writeFloatAttribute, writeInt, writeIntArray, writeIntArrayAttribute, writeIntAttribute, writeInteger, writeIntegerAttribute, writeLong, writeLongArray, writeLongArrayAttribute, writeLongAttribute, writeQName, writeQNameAttribute
-
Field Details
-
STATE_PROLOG
protected static final int STATE_PROLOG- See Also:
-
STATE_TREE
protected static final int STATE_TREE- See Also:
-
STATE_EPILOG
protected static final int STATE_EPILOG- See Also:
-
CHAR_SPACE
protected static final char CHAR_SPACE- See Also:
-
MIN_ARRAYCOPY
protected static final int MIN_ARRAYCOPYThis constant defines minimum length of a String, for which it is beneficial to do an intermediate copy (using String.getChars()), and iterate over intermediate array, instead of iterating using String.charAt(). Former is generally faster for longer Strings, but has some overhead for shorter Strings. Tests indicate that the threshold is somewhere between 8 and 16 characters, at least on x86 platform.- See Also:
-
ATTR_MIN_ARRAYCOPY
protected static final int ATTR_MIN_ARRAYCOPY- See Also:
-
DEFAULT_COPYBUFFER_LEN
protected static final int DEFAULT_COPYBUFFER_LEN- See Also:
-
mWriter
Actual physical writer to output serialized XML content to -
mCopyBuffer
protected char[] mCopyBufferIntermediate buffer into which characters of a String can be copied, in cases where such a copy followed by array access is faster than callingString.charAt()
(which perhaps surprisingly is often case, and especially significant for longer buffers). -
mConfig
-
mCfgCDataAsText
protected final boolean mCfgCDataAsText -
mCfgCopyDefaultAttrs
protected final boolean mCfgCopyDefaultAttrs -
mCfgAutomaticEmptyElems
protected final boolean mCfgAutomaticEmptyElems -
mCheckStructure
protected boolean mCheckStructure -
mCheckAttrs
protected boolean mCheckAttrs -
mEncoding
Encoding to use; may be passed from the factory (when a method that defines encoding is used), updated by a call towriteStartDocument()
, or null if neither. Is passed to the escaping writer factory to allow escaping writers to do additional escaping if necessary (like encapsulating non-ascii chars in a doc encoded usig ascii). -
mValidator
protected org.codehaus.stax2.validation.XMLValidator mValidatorOptional validator to use for validating output against one or more schemas, and/or for safe pretty-printing (indentation). -
mXml11
protected boolean mXml11Since XML 1.1 has some differences to 1.0, we need to keep a flag to indicate if we were to output XML 1.1 document. -
mVldProbHandler
protected org.codehaus.stax2.validation.ValidationProblemHandler mVldProbHandlerCustom validation problem handler, if any. -
mState
protected int mState -
mAnyOutput
protected boolean mAnyOutputFlag that is set to true first time something has been output. Generally needed to keep track of whether XML declaration (START_DOCUMENT) can be output or not. -
mStartElementOpen
protected boolean mStartElementOpenFlag that is set during time that a start element is "open", ie. START_ELEMENT has been output (and possibly zero or more name space declarations and attributes), before other main-level constructs have been output. -
mEmptyElement
protected boolean mEmptyElementFlag that indicates that current element is an empty element (one that is explicitly defined as one, by calling a method -- NOT one that just happens to be empty). This is needed to know what to do when next non-ns/attr node is output; normally a new context is opened, but for empty elements not. -
mVldContent
protected int mVldContentState value used with validation, to track types of content that is allowed at this point in output stream. Only used if validation is enabled: if so, value is determined via validation callbacks. -
mDtdRootElem
Value passed as the expected root element, when using the multiple argumentwriteDTD(java.lang.String)
method. Will be used in structurally validating mode (and in dtd-validating mode, since that automatically enables structural validation as well, to pre-filter well-formedness errors that validators might have trouble dealing with). -
mReturnNullForDefaultNamespace
protected boolean mReturnNullForDefaultNamespace
-
-
Constructor Details
-
BaseStreamWriter
-
-
Method Details
-
close
- Specified by:
close
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
flush
- Specified by:
flush
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
getNamespaceContext
- Specified by:
getNamespaceContext
in interfaceXMLStreamWriter
-
getPrefix
- Specified by:
getPrefix
in interfaceXMLStreamWriter
-
getProperty
- Specified by:
getProperty
in interfaceXMLStreamWriter
-
setDefaultNamespace
- Specified by:
setDefaultNamespace
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
setNamespaceContext
- Specified by:
setNamespaceContext
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
setPrefix
- Specified by:
setPrefix
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeAttribute
- Specified by:
writeAttribute
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeAttribute
public abstract void writeAttribute(String nsURI, String localName, String value) throws XMLStreamException - Specified by:
writeAttribute
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeAttribute
public abstract void writeAttribute(String prefix, String nsURI, String localName, String value) throws XMLStreamException - Specified by:
writeAttribute
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeCData
- Specified by:
writeCData
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeCharacters
- Specified by:
writeCharacters
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeCharacters
- Specified by:
writeCharacters
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeComment
- Specified by:
writeComment
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeDefaultNamespace
- Specified by:
writeDefaultNamespace
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeDTD
- Specified by:
writeDTD
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeEmptyElement
- Specified by:
writeEmptyElement
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeEmptyElement
- Specified by:
writeEmptyElement
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeEmptyElement
public abstract void writeEmptyElement(String prefix, String localName, String nsURI) throws XMLStreamException - Specified by:
writeEmptyElement
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeEndDocument
- Specified by:
writeEndDocument
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeEndElement
- Specified by:
writeEndElement
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeEntityRef
- Specified by:
writeEntityRef
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeNamespace
- Specified by:
writeNamespace
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeProcessingInstruction
- Specified by:
writeProcessingInstruction
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeProcessingInstruction
- Specified by:
writeProcessingInstruction
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeStartDocument
- Specified by:
writeStartDocument
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeStartDocument
- Specified by:
writeStartDocument
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeStartDocument
- Specified by:
writeStartDocument
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
doWriteStartDocument
protected void doWriteStartDocument(String version, String encoding, String standAlone) throws XMLStreamException - Throws:
XMLStreamException
-
writeStartElement
- Specified by:
writeStartElement
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeStartElement
- Specified by:
writeStartElement
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
writeStartElement
public abstract void writeStartElement(String prefix, String localName, String nsURI) throws XMLStreamException - Specified by:
writeStartElement
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
copyEventFromReader
public void copyEventFromReader(org.codehaus.stax2.XMLStreamReader2 sr, boolean preserveEventData) throws XMLStreamException Method that essentially copies event that the specified reader has just read.- Specified by:
copyEventFromReader
in interfaceorg.codehaus.stax2.XMLStreamWriter2
- Overrides:
copyEventFromReader
in classorg.codehaus.stax2.ri.Stax2WriterImpl
- Parameters:
sr
- Stream reader to use for accessing event to copypreserveEventData
- If true, writer is not allowed to change the state of the reader (so that all the data associated with the current event has to be preserved); if false, writer is allowed to use methods that may cause some data to be discarded. Setting this to false may improve the performance, since it may allow full no-copy streaming of data, especially textual contents.- Throws:
XMLStreamException
-
closeCompletely
- Specified by:
closeCompletely
in interfaceorg.codehaus.stax2.XMLStreamWriter2
- Throws:
XMLStreamException
-
isPropertySupported
- Specified by:
isPropertySupported
in interfaceorg.codehaus.stax2.XMLStreamWriter2
- Overrides:
isPropertySupported
in classorg.codehaus.stax2.ri.Stax2WriterImpl
-
setProperty
- Specified by:
setProperty
in interfaceorg.codehaus.stax2.XMLStreamWriter2
- Overrides:
setProperty
in classorg.codehaus.stax2.ri.Stax2WriterImpl
- Parameters:
name
- Name of the property to setvalue
- Value to set property to.- Returns:
- True, if the specified property was succesfully set to specified value; false if its value was not changed
-
validateAgainst
public org.codehaus.stax2.validation.XMLValidator validateAgainst(org.codehaus.stax2.validation.XMLValidationSchema schema) throws XMLStreamException - Specified by:
validateAgainst
in interfaceorg.codehaus.stax2.validation.Validatable
- Overrides:
validateAgainst
in classorg.codehaus.stax2.ri.Stax2WriterImpl
- Throws:
XMLStreamException
-
stopValidatingAgainst
public org.codehaus.stax2.validation.XMLValidator stopValidatingAgainst(org.codehaus.stax2.validation.XMLValidationSchema schema) throws XMLStreamException - Specified by:
stopValidatingAgainst
in interfaceorg.codehaus.stax2.validation.Validatable
- Overrides:
stopValidatingAgainst
in classorg.codehaus.stax2.ri.Stax2WriterImpl
- Throws:
XMLStreamException
-
stopValidatingAgainst
public org.codehaus.stax2.validation.XMLValidator stopValidatingAgainst(org.codehaus.stax2.validation.XMLValidator validator) throws XMLStreamException - Specified by:
stopValidatingAgainst
in interfaceorg.codehaus.stax2.validation.Validatable
- Overrides:
stopValidatingAgainst
in classorg.codehaus.stax2.ri.Stax2WriterImpl
- Throws:
XMLStreamException
-
setValidationProblemHandler
public org.codehaus.stax2.validation.ValidationProblemHandler setValidationProblemHandler(org.codehaus.stax2.validation.ValidationProblemHandler h) - Specified by:
setValidationProblemHandler
in interfaceorg.codehaus.stax2.validation.Validatable
- Overrides:
setValidationProblemHandler
in classorg.codehaus.stax2.ri.Stax2WriterImpl
-
resetValidationFlags
private void resetValidationFlags() -
getLocation
public org.codehaus.stax2.XMLStreamLocation2 getLocation()- Specified by:
getLocation
in interfaceorg.codehaus.stax2.XMLStreamWriter2
- Specified by:
getLocation
in classorg.codehaus.stax2.ri.Stax2WriterImpl
-
getEncoding
- Specified by:
getEncoding
in interfaceorg.codehaus.stax2.XMLStreamWriter2
- Specified by:
getEncoding
in classorg.codehaus.stax2.ri.Stax2WriterImpl
-
writeCData
- Specified by:
writeCData
in interfaceorg.codehaus.stax2.XMLStreamWriter2
- Overrides:
writeCData
in classorg.codehaus.stax2.ri.Stax2WriterImpl
- Throws:
XMLStreamException
-
writeDTD
- Throws:
XMLStreamException
-
writeDTD
public void writeDTD(String rootName, String systemId, String publicId, String internalSubset) throws XMLStreamException - Specified by:
writeDTD
in interfaceorg.codehaus.stax2.XMLStreamWriter2
- Overrides:
writeDTD
in classorg.codehaus.stax2.ri.Stax2WriterImpl
- Throws:
XMLStreamException
-
writeFullEndElement
- Specified by:
writeFullEndElement
in interfaceorg.codehaus.stax2.XMLStreamWriter2
- Overrides:
writeFullEndElement
in classorg.codehaus.stax2.ri.Stax2WriterImpl
- Throws:
XMLStreamException
-
writeStartDocument
public void writeStartDocument(String version, String encoding, boolean standAlone) throws XMLStreamException - Specified by:
writeStartDocument
in interfaceorg.codehaus.stax2.XMLStreamWriter2
- Specified by:
writeStartDocument
in classorg.codehaus.stax2.ri.Stax2WriterImpl
- Throws:
XMLStreamException
-
writeRaw
- Specified by:
writeRaw
in interfaceorg.codehaus.stax2.XMLStreamWriter2
- Overrides:
writeRaw
in classorg.codehaus.stax2.ri.Stax2WriterImpl
- Throws:
XMLStreamException
-
writeRaw
- Specified by:
writeRaw
in interfaceorg.codehaus.stax2.XMLStreamWriter2
- Specified by:
writeRaw
in classorg.codehaus.stax2.ri.Stax2WriterImpl
- Throws:
XMLStreamException
-
writeRaw
- Specified by:
writeRaw
in interfaceorg.codehaus.stax2.XMLStreamWriter2
- Specified by:
writeRaw
in classorg.codehaus.stax2.ri.Stax2WriterImpl
- Throws:
XMLStreamException
-
writeSpace
- Specified by:
writeSpace
in interfaceorg.codehaus.stax2.XMLStreamWriter2
- Overrides:
writeSpace
in classorg.codehaus.stax2.ri.Stax2WriterImpl
- Throws:
XMLStreamException
-
writeSpace
- Specified by:
writeSpace
in interfaceorg.codehaus.stax2.XMLStreamWriter2
- Overrides:
writeSpace
in classorg.codehaus.stax2.ri.Stax2WriterImpl
- Throws:
XMLStreamException
-
getXmlVersion
- Specified by:
getXmlVersion
in interfaceorg.codehaus.stax2.validation.ValidationContext
-
getCurrentElementName
- Specified by:
getCurrentElementName
in interfaceorg.codehaus.stax2.validation.ValidationContext
-
getNamespaceURI
- Specified by:
getNamespaceURI
in interfaceorg.codehaus.stax2.validation.ValidationContext
-
getBaseUri
As of now, there is no way to specify the base URI. Could be improved in future, if xml:base is supported.- Specified by:
getBaseUri
in interfaceorg.codehaus.stax2.validation.ValidationContext
-
getValidationLocation
- Specified by:
getValidationLocation
in interfaceorg.codehaus.stax2.validation.ValidationContext
-
reportProblem
public void reportProblem(org.codehaus.stax2.validation.XMLValidationProblem prob) throws XMLStreamException - Specified by:
reportProblem
in interfaceorg.codehaus.stax2.validation.ValidationContext
- Throws:
XMLStreamException
-
addDefaultAttribute
Adding default attribute values does not usually make sense on output side, so the implementation is a NOP for now.- Specified by:
addDefaultAttribute
in interfaceorg.codehaus.stax2.validation.ValidationContext
-
isNotationDeclared
- Specified by:
isNotationDeclared
in interfaceorg.codehaus.stax2.validation.ValidationContext
-
isUnparsedEntityDeclared
- Specified by:
isUnparsedEntityDeclared
in interfaceorg.codehaus.stax2.validation.ValidationContext
-
getAttributeCount
public int getAttributeCount()- Specified by:
getAttributeCount
in interfaceorg.codehaus.stax2.validation.ValidationContext
-
getAttributeLocalName
- Specified by:
getAttributeLocalName
in interfaceorg.codehaus.stax2.validation.ValidationContext
-
getAttributeNamespace
- Specified by:
getAttributeNamespace
in interfaceorg.codehaus.stax2.validation.ValidationContext
-
getAttributePrefix
- Specified by:
getAttributePrefix
in interfaceorg.codehaus.stax2.validation.ValidationContext
-
getAttributeValue
- Specified by:
getAttributeValue
in interfaceorg.codehaus.stax2.validation.ValidationContext
-
getAttributeValue
- Specified by:
getAttributeValue
in interfaceorg.codehaus.stax2.validation.ValidationContext
-
getAttributeType
- Specified by:
getAttributeType
in interfaceorg.codehaus.stax2.validation.ValidationContext
-
findAttributeIndex
- Specified by:
findAttributeIndex
in interfaceorg.codehaus.stax2.validation.ValidationContext
-
wrapAsRawWriter
Method that can be called to get a wrapper instance that can be used to essentially call thewriteRaw
method via regularWriter
interface. -
wrapAsTextWriter
Method that can be called to get a wrapper instance that can be used to essentially call thewriteCharacters
method via regularWriter
interface. -
isValidating
protected boolean isValidating()Method that is used by output classes to determine whether we are in validating mode.Note: current implementation of this method is not perfect; it may be possible it can return true even if we are only using a DTD to get some limited info, without validating?
-
writeStartElement
Convenience method needed byXMLEventWriter
implementation, to use when writing a start element, and possibly its attributes and namespace declarations.- Throws:
XMLStreamException
-
writeEndElement
Method called byXMLEventWriter
(instead of the version that takes no argument), so that we can verify it does match the start element if necessary.- Throws:
XMLStreamException
-
writeCharacters
Method called byXMLEventWriter
(instead of more generic text output methods), so that we can verify (if necessary) that this character output type is legal in this context. Specifically, it's not acceptable to add non-whitespace content outside root element (in prolog/epilog).Note: cut'n pasted from the main
writeCharacters
; not good... but done to optimize white-space cases.- Throws:
XMLStreamException
-
closeStartElement
Method called to close an open start element, when another main-level element (not namespace declaration or attribute) is being output; except for end element which is handled differently.- Throws:
XMLStreamException
-
inPrologOrEpilog
protected final boolean inPrologOrEpilog() -
_finishDocument
- Parameters:
forceRealClose
- If true, will force calling of close() on the underlying physical result (stream, writer). If false, will let XmlWriter decide whether to call close(); will be done if auto-closing enabled, but not otherwise.- Throws:
XMLStreamException
-
copyStartElement
public abstract void copyStartElement(InputElementStack elemStack, AttributeCollector attrCollector) throws IOException, XMLStreamException Implementation-dependant method called to fully copy START_ELEMENT event that the passed-in stream reader points to- Throws:
IOException
XMLStreamException
-
validateQNamePrefix
Method called before writing a QName via Typed Access API. In namespace-repairing mode it should take appropriate actions to ensure that the given namespace URI is bound to a namespace and return whatever it maps to. In non-repairing work no additional work is to be done and methods- Returns:
- Prefix to use when writing out given QName as an element or attribute value
- Throws:
XMLStreamException
-
verifyWriteCData
- Throws:
XMLStreamException
-
verifyWriteDTD
- Throws:
XMLStreamException
-
verifyRootElement
- Throws:
XMLStreamException
-
throwOutputError
- Throws:
XMLStreamException
-
throwOutputError
- Throws:
XMLStreamException
-
reportIllegalMethod
Method called when an illegal method (namespace-specific method on non-ns writer) is called by the application.- Throws:
XMLStreamException
-
reportNwfStructure
This is the method called when an output method call violates structural well-formedness checks andWstxOutputProperties.P_OUTPUT_VALIDATE_STRUCTURE
is is enabled.- Throws:
XMLStreamException
-
reportNwfStructure
- Throws:
XMLStreamException
-
reportNwfContent
This is the method called when an output method call violates content well-formedness checks andWstxOutputProperties.P_OUTPUT_VALIDATE_CONTENT
is is enabled.- Throws:
XMLStreamException
-
reportNwfContent
- Throws:
XMLStreamException
-
reportNwfAttr
This is the method called when an output method call violates attribute well-formedness checks (trying to output dup attrs) andWstxOutputProperties.P_OUTPUT_VALIDATE_NAMES
is is enabled.- Throws:
XMLStreamException
-
reportNwfAttr
- Throws:
XMLStreamException
-
throwFromIOE
- Throws:
XMLStreamException
-
reportIllegalArg
- Throws:
IllegalArgumentException
-
reportInvalidContent
- Throws:
XMLStreamException
-
reportValidationProblem
public void reportValidationProblem(String msg, Location loc, int severity) throws XMLStreamException - Throws:
XMLStreamException
-
reportValidationProblem
- Throws:
XMLStreamException
-
reportValidationProblem
- Throws:
XMLStreamException
-
reportValidationProblem
- Throws:
XMLStreamException
-
reportValidationProblem
- Throws:
XMLStreamException
-
reportValidationProblem
public void reportValidationProblem(String format, Object arg, Object arg2) throws XMLStreamException - Throws:
XMLStreamException
-
doReportProblem
protected void doReportProblem(XMLReporter rep, String probType, String msg, Location loc) throws XMLStreamException - Throws:
XMLStreamException
-
doReportProblem
protected void doReportProblem(XMLReporter rep, org.codehaus.stax2.validation.XMLValidationProblem prob) throws XMLStreamException - Throws:
XMLStreamException
-
getTopElementDesc
Method needed for error message generation -
getCopyBuffer
protected final char[] getCopyBuffer() -
getCopyBuffer
protected final char[] getCopyBuffer(int minLen) -
toString
-