Package com.fasterxml.aalto.out
Class StreamWriterBase
java.lang.Object
org.codehaus.stax2.ri.Stax2WriterImpl
com.fasterxml.aalto.out.StreamWriterBase
- All Implemented Interfaces:
NamespaceContext
,XMLStreamConstants
,XMLStreamWriter
,org.codehaus.stax2.typed.TypedXMLStreamWriter
,org.codehaus.stax2.validation.Validatable
,org.codehaus.stax2.validation.ValidationContext
,org.codehaus.stax2.XMLStreamWriter2
- Direct Known Subclasses:
NonRepairingStreamWriter
,RepairingStreamWriter
public abstract class StreamWriterBase
extends org.codehaus.stax2.ri.Stax2WriterImpl
implements NamespaceContext, org.codehaus.stax2.validation.ValidationContext
Base class for
XMLStreamReader
implementations.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final boolean
protected boolean
protected boolean
protected boolean
protected final WriterConfig
protected OutputElement
We'll use a virtual root element (like a document node of sort), to simplify other processing, basically such that there is always a current output element instance, even when in prolog or epilog.protected String
Value passed as the expected root element, when using the multiple argumentwriteDTD(java.lang.String)
method.protected OutputElement
protected int
protected NamespaceContext
Root namespace context defined for this writer, if any.protected StreamWriterBase.State
protected boolean
Flag that is set to true first time something has been output.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 boolean
Flag that is set during time that a start element is "open", ie.protected WNameTable
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 org.codehaus.stax2.ri.typed.ValueEncoderFactory
When outputting using Typed Access API, we will need encoders.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 to(package private) static final int
Although pooled objects are small, let's limit the pool size nonetheless, to minimize extra memory usage for deeply nested documents.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
StreamWriterBase
(WriterConfig cfg, XmlWriter writer, WNameTable symbols) -
Method Summary
Modifier and TypeMethodDescriptionprotected 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.private final void
_finishDocument
(boolean forceRealClose) 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) and name validaty checking 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 and content validation is enabled.protected static void
_reportNwfContent
(String msg, Object arg) protected static void
_reportNwfName
(String msg) protected static void
This is the method called when an output method call violates structural well-formedness checks and structural checking is enabled.protected static void
_reportNwfStructure
(String msg, Object arg) void
protected abstract String
_serializeQName
(QName name) protected abstract void
_setPrefix
(String prefix, String uri) protected void
_verifyRootElement
(String prefix, String localName) protected void
_verifyStartElement
(String prefix, String localName) Method that is called to ensure that we can start writing an element, both from structural point of view, and from syntactic (close previously open start element, if any).protected final void
_verifyWriteAttr
(WName name) protected final void
protected final void
protected final void
_writeAttribute
(WName name, String value) protected final void
_writeAttribute
(WName name, org.codehaus.stax2.ri.typed.AsciiValueEncoder enc) protected final void
protected final void
_writeNamespace
(String prefix, String uri) protected void
_writeStartDocument
(String version, String encoding, String standAlone) protected void
_writeStartTag
(WName name, boolean isEmpty) protected void
_writeStartTag
(WName name, boolean isEmpty, String uri) 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
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.org.codehaus.stax2.XMLStreamLocation2
final NamespaceContext
getNamespaceURI
(String prefix) getPrefixes
(String uri) getProperty
(String name) protected final boolean
boolean
isNotationDeclared
(String name) boolean
isPropertySupported
(String name) boolean
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.void
reportProblem
(org.codehaus.stax2.validation.XMLValidationProblem prob) private void
abstract void
void
final 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) protected final org.codehaus.stax2.ri.typed.ValueEncoderFactory
final 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
writeBinary
(byte[] value, int from, int length) void
writeBinary
(org.codehaus.stax2.typed.Base64Variant v, byte[] value, int from, int length) void
writeBinaryAttribute
(String prefix, String nsURI, String localName, byte[] value) void
writeBinaryAttribute
(org.codehaus.stax2.typed.Base64Variant v, String prefix, String nsURI, String localName, byte[] value) void
writeBoolean
(boolean b) final void
writeBooleanAttribute
(String prefix, String nsURI, String localName, boolean 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
writeComment
(String data) void
writeDecimal
(BigDecimal value) final void
writeDecimalAttribute
(String prefix, String nsURI, String localName, BigDecimal value) abstract void
writeDefaultNamespace
(String nsURI) void
writeDouble
(double value) void
writeDoubleArray
(double[] value, int from, int length) void
writeDoubleArrayAttribute
(String prefix, String nsURI, String localName, double[] value) final void
writeDoubleAttribute
(String prefix, String nsURI, String localName, double value) final void
void
void
writeDTD
(org.codehaus.stax2.DTDInfo info) void
writeEmptyElement
(String localName) It is assumed here that caller actually wants whatever is the default namespace (or it is used in "non-namespace" mode, where no namespaces are bound ever).abstract void
writeEmptyElement
(String nsURI, String localName) abstract void
writeEmptyElement
(String prefix, String localName, String nsURI) void
void
void
writeEntityRef
(String name) void
writeFloat
(float value) void
writeFloatArray
(float[] value, int from, int length) void
writeFloatArrayAttribute
(String prefix, String nsURI, String localName, float[] value) final void
writeFloatAttribute
(String prefix, String nsURI, String localName, float value) void
Similar towriteEndElement()
, but never allows implicit creation of empty elements.void
writeInt
(int value) final void
writeIntArray
(int[] value, int from, int length) void
writeIntArrayAttribute
(String prefix, String nsURI, String localName, int[] value) final void
writeIntAttribute
(String prefix, String nsURI, String localName, int value) void
writeInteger
(BigInteger value) final void
writeIntegerAttribute
(String prefix, String nsURI, String localName, BigInteger value) void
writeLong
(long value) void
writeLongArray
(long[] value, int from, int length) void
writeLongArrayAttribute
(String prefix, String nsURI, String localName, long[] value) final void
writeLongAttribute
(String prefix, String nsURI, String localName, long value) abstract void
writeNamespace
(String prefix, String nsURI) void
writeProcessingInstruction
(String target) void
writeProcessingInstruction
(String target, String data) void
writeQName
(QName value) final void
writeQNameAttribute
(String prefix, String nsURI, String localName, QName value) void
writeRaw
(char[] text, int offset, int length) void
void
void
writeSpace
(char[] cbuf, int offset, int len) void
writeSpace
(String text) void
void
writeStartDocument
(String version) void
writeStartDocument
(String encoding, String version) void
writeStartDocument
(String version, String encoding, boolean standAlone) void
writeStartElement
(String localName) It is assumed here that caller actually wants whatever is the default namespace (or it is used in "non-namespace" mode, where no namespaces are bound ever).abstract void
writeStartElement
(String nsURI, String localName) abstract void
writeStartElement
(String prefix, String localName, String nsURI) abstract void
writeTypedAttribute
(String prefix, String nsURI, String localName, org.codehaus.stax2.ri.typed.AsciiValueEncoder enc) Need to leave implementation of this method abstract, because repairing and non-repairing modes differ in how names are handled.private final void
writeTypedElement
(org.codehaus.stax2.ri.typed.AsciiValueEncoder enc) Methods inherited from class org.codehaus.stax2.ri.Stax2WriterImpl
copyEventFromReader, copyStartElement
-
Field Details
-
_config
-
_rootNsContext
Root namespace context defined for this writer, if any. -
_cfgCheckStructure
protected boolean _cfgCheckStructure -
_cfgCheckContent
protected boolean _cfgCheckContent -
_cfgCheckAttrs
protected boolean _cfgCheckAttrs -
_cfgCDataAsText
protected final boolean _cfgCDataAsText -
_symbols
-
_xmlWriter
Actual physical writer to output serialized XML content to -
_valueEncoderFactory
protected org.codehaus.stax2.ri.typed.ValueEncoderFactory _valueEncoderFactoryWhen outputting using Typed Access API, we will need encoders. If so, they will created by lazily-constructed factory -
_validator
protected org.codehaus.stax2.validation.XMLValidator _validatorOptional validator to use for validating output against one or more schemas, and/or for safe pretty-printing (indentation). -
_vldContent
protected int _vldContentState 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. -
_vldProblemHandler
protected org.codehaus.stax2.validation.ValidationProblemHandler _vldProblemHandlerCustom validation problem handler, if any. -
_state
-
_currElem
We'll use a virtual root element (like a document node of sort), to simplify other processing, basically such that there is always a current output element instance, even when in prolog or epilog. -
_stateAnyOutput
protected boolean _stateAnyOutputFlag 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. -
_stateStartElementOpen
protected boolean _stateStartElementOpenFlag 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. -
_stateEmptyElement
protected boolean _stateEmptyElementFlag 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. -
_dtdRootElemName
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). -
_outputElemPool
-
MAX_POOL_SIZE
static final int MAX_POOL_SIZEAlthough pooled objects are small, let's limit the pool size nonetheless, to minimize extra memory usage for deeply nested documents. Even just 4 levels might be enough, 8 should cover > 95% of cases- See Also:
-
_poolSize
protected int _poolSize
-
-
Constructor Details
-
StreamWriterBase
-
-
Method Details
-
close
- Specified by:
close
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
flush
- Specified by:
flush
in interfaceXMLStreamWriter
- Throws:
XMLStreamException
-
getNamespaceContext
- Specified by:
getNamespaceContext
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
-
_setPrefix
-
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
It is assumed here that caller actually wants whatever is the default namespace (or it is used in "non-namespace" mode, where no namespaces are bound ever). As such we do not have to distinguish between repairing and non-repairing modes.- 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
-
writeStartElement
It is assumed here that caller actually wants whatever is the default namespace (or it is used in "non-namespace" mode, where no namespaces are bound ever). As such we do not have to distinguish between repairing and non-repairing modes.- 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
-
getNamespaceURI
- Specified by:
getNamespaceURI
in interfaceNamespaceContext
- Specified by:
getNamespaceURI
in interfaceorg.codehaus.stax2.validation.ValidationContext
-
getPrefix
- Specified by:
getPrefix
in interfaceNamespaceContext
- Specified by:
getPrefix
in interfaceXMLStreamWriter
-
getPrefixes
- Specified by:
getPrefixes
in interfaceNamespaceContext
-
writeBoolean
- Specified by:
writeBoolean
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeInt
- Specified by:
writeInt
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeLong
- Specified by:
writeLong
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeFloat
- Specified by:
writeFloat
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeDouble
- Specified by:
writeDouble
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeInteger
- Specified by:
writeInteger
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeDecimal
- Specified by:
writeDecimal
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeQName
- Specified by:
writeQName
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeIntArray
- Specified by:
writeIntArray
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeLongArray
- Specified by:
writeLongArray
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeFloatArray
- Specified by:
writeFloatArray
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeDoubleArray
- Specified by:
writeDoubleArray
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeBinary
- Specified by:
writeBinary
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeBinary
public void writeBinary(org.codehaus.stax2.typed.Base64Variant v, byte[] value, int from, int length) throws XMLStreamException - Specified by:
writeBinary
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeTypedElement
private final void writeTypedElement(org.codehaus.stax2.ri.typed.AsciiValueEncoder enc) throws XMLStreamException - Throws:
XMLStreamException
-
writeBooleanAttribute
public final void writeBooleanAttribute(String prefix, String nsURI, String localName, boolean value) throws XMLStreamException - Specified by:
writeBooleanAttribute
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeIntAttribute
public final void writeIntAttribute(String prefix, String nsURI, String localName, int value) throws XMLStreamException - Specified by:
writeIntAttribute
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeLongAttribute
public final void writeLongAttribute(String prefix, String nsURI, String localName, long value) throws XMLStreamException - Specified by:
writeLongAttribute
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeFloatAttribute
public final void writeFloatAttribute(String prefix, String nsURI, String localName, float value) throws XMLStreamException - Specified by:
writeFloatAttribute
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeDoubleAttribute
public final void writeDoubleAttribute(String prefix, String nsURI, String localName, double value) throws XMLStreamException - Specified by:
writeDoubleAttribute
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeIntegerAttribute
public final void writeIntegerAttribute(String prefix, String nsURI, String localName, BigInteger value) throws XMLStreamException - Specified by:
writeIntegerAttribute
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeDecimalAttribute
public final void writeDecimalAttribute(String prefix, String nsURI, String localName, BigDecimal value) throws XMLStreamException - Specified by:
writeDecimalAttribute
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeQNameAttribute
public final void writeQNameAttribute(String prefix, String nsURI, String localName, QName value) throws XMLStreamException - Specified by:
writeQNameAttribute
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeIntArrayAttribute
public void writeIntArrayAttribute(String prefix, String nsURI, String localName, int[] value) throws XMLStreamException - Specified by:
writeIntArrayAttribute
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeLongArrayAttribute
public void writeLongArrayAttribute(String prefix, String nsURI, String localName, long[] value) throws XMLStreamException - Specified by:
writeLongArrayAttribute
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeFloatArrayAttribute
public void writeFloatArrayAttribute(String prefix, String nsURI, String localName, float[] value) throws XMLStreamException - Specified by:
writeFloatArrayAttribute
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeDoubleArrayAttribute
public void writeDoubleArrayAttribute(String prefix, String nsURI, String localName, double[] value) throws XMLStreamException - Specified by:
writeDoubleArrayAttribute
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeBinaryAttribute
public void writeBinaryAttribute(String prefix, String nsURI, String localName, byte[] value) throws XMLStreamException - Specified by:
writeBinaryAttribute
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeBinaryAttribute
public void writeBinaryAttribute(org.codehaus.stax2.typed.Base64Variant v, String prefix, String nsURI, String localName, byte[] value) throws XMLStreamException - Specified by:
writeBinaryAttribute
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamWriter
- Throws:
XMLStreamException
-
writeTypedAttribute
public abstract void writeTypedAttribute(String prefix, String nsURI, String localName, org.codehaus.stax2.ri.typed.AsciiValueEncoder enc) throws XMLStreamException Need to leave implementation of this method abstract, because repairing and non-repairing modes differ in how names are handled.- Throws:
XMLStreamException
-
_serializeQName
- 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
-
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
Similar towriteEndElement()
, but never allows implicit creation of empty elements.- 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
-
getXmlVersion
- Specified by:
getXmlVersion
in interfaceorg.codehaus.stax2.validation.ValidationContext
-
getCurrentElementName
- Specified by:
getCurrentElementName
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
-
_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() -
valueEncoderFactory
protected final org.codehaus.stax2.ri.typed.ValueEncoderFactory valueEncoderFactory() -
_writeAttribute
- Throws:
XMLStreamException
-
_writeAttribute
protected final void _writeAttribute(WName name, org.codehaus.stax2.ri.typed.AsciiValueEncoder enc) throws XMLStreamException - Throws:
XMLStreamException
-
_writeDefaultNamespace
- Throws:
XMLStreamException
-
_writeNamespace
- Throws:
XMLStreamException
-
_writeStartDocument
protected void _writeStartDocument(String version, String encoding, String standAlone) throws XMLStreamException - Throws:
XMLStreamException
-
_writeStartTag
- Throws:
XMLStreamException
-
_writeStartTag
- Throws:
XMLStreamException
-
_verifyWriteAttr
-
_verifyStartElement
Method that is called to ensure that we can start writing an element, both from structural point of view, and from syntactic (close previously open start element, if any). Note that since it needs to be called before writing out anything, no namespace bindings have been (or can be) output, and hence given prefix may not be one that actually gets used.- Throws:
XMLStreamException
-
_verifyWriteCData
- Throws:
XMLStreamException
-
_verifyWriteDTD
- Throws:
XMLStreamException
-
_verifyRootElement
protected void _verifyRootElement(String prefix, String localName) throws org.codehaus.stax2.validation.XMLValidationException - Throws:
org.codehaus.stax2.validation.XMLValidationException
-
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 and structural checking is enabled.- Throws:
XMLStreamException
-
_reportNwfStructure
- Throws:
XMLStreamException
-
_reportNwfContent
This is the method called when an output method call violates content well-formedness checks and content validation 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) and name validaty checking is enabled.- Throws:
XMLStreamException
-
_reportNwfAttr
- Throws:
XMLStreamException
-
_reportNwfName
- Throws:
XMLStreamException
-
throwFromIOE
- Throws:
XMLStreamException
-
reportIllegalArg
- Throws:
IllegalArgumentException
-
_reportInvalidContent
- Throws:
XMLStreamException
-
_reportValidationProblem
- Throws:
XMLStreamException
-
_finishDocument
- Throws:
XMLStreamException
-
toString
-