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 intprotected static final charprotected static final intprotected booleanFlag that is set to true first time something has been output.protected final booleanprotected final booleanprotected final booleanprotected booleanprotected booleanprotected final WriterConfigprotected 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 StringValue passed as the expected root element, when using the multiple argumentwriteDTD(String)method.protected booleanFlag 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 StringEncoding 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 intThis 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 booleanprotected booleanFlag that is set during time that a start element is "open", ie.protected intprotected org.codehaus.stax2.validation.XMLValidatorOptional validator to use for validating output against one or more schemas, and/or for safe pretty-printing (indentation).protected intState value used with validation, to track types of content that is allowed at this point in output stream.protected org.codehaus.stax2.validation.ValidationProblemHandlerCustom validation problem handler, if any.protected final XmlWriterActual physical writer to output serialized XML content toprotected booleanSince 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 intprotected static final intprotected static final intFields 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 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
ConstructorsModifierConstructorDescriptionprotectedBaseStreamWriter(XmlWriter xw, String enc, WriterConfig cfg) -
Method Summary
Modifier and TypeMethodDescriptionprivate final void_finishDocument(boolean forceRealClose) intaddDefaultAttribute(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.voidclose()voidprotected abstract voidcloseStartElement(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.voidcopyEventFromReader(org.codehaus.stax2.XMLStreamReader2 sr, boolean preserveEventData) Method that essentially copies event that the specified reader has just read.abstract voidcopyStartElement(InputElementStack elemStack, AttributeCollector attrCollector) Implementation-dependant method called to fully copy START_ELEMENT event that the passed-in stream reader points toprotected voiddoReportProblem(XMLReporter rep, String probType, String msg, Location loc) protected voiddoReportProblem(XMLReporter rep, org.codehaus.stax2.validation.XMLValidationProblem prob) protected voiddoWriteStartDocument(String version, String encoding, String standAlone) intfindAttributeIndex(String nsURI, String localName) voidflush()intgetAttributeLocalName(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 QNameorg.codehaus.stax2.XMLStreamLocation2abstract NamespaceContextabstract StringgetNamespaceURI(String prefix) abstract StringgetProperty(String name) protected abstract StringMethod needed for error message generationprotected final booleanbooleanisNotationDeclared(String name) booleanisPropertySupported(String name) booleanprotected booleanMethod that is used by output classes to determine whether we are in validating mode.protected static voidreportIllegalArg(String msg) protected static voidMethod called when an illegal method (namespace-specific method on non-ns writer) is called by the application.protected voidreportInvalidContent(int evtType) protected static voidreportNwfAttr(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_NAMESis is enabled.protected static voidreportNwfAttr(String msg, Object arg) protected static voidreportNwfContent(String msg) This is the method called when an output method call violates content well-formedness checks andWstxOutputProperties.P_OUTPUT_VALIDATE_CONTENTis is enabled.protected static voidreportNwfContent(String msg, Object arg) protected static voidreportNwfStructure(String msg) This is the method called when an output method call violates structural well-formedness checks andWstxOutputProperties.P_OUTPUT_VALIDATE_STRUCTUREis is enabled.protected static voidreportNwfStructure(String msg, Object arg) voidreportProblem(org.codehaus.stax2.validation.XMLValidationProblem prob) voidvoidreportValidationProblem(String msg, int severity) voidreportValidationProblem(String format, Object arg) voidreportValidationProblem(String format, Object arg, Object arg2) voidreportValidationProblem(String msg, Location loc, int severity) voidreportValidationProblem(Location loc, String msg) private voidabstract voidabstract voidsetNamespaceContext(NamespaceContext context) abstract voidbooleansetProperty(String name, Object value) org.codehaus.stax2.validation.ValidationProblemHandlersetValidationProblemHandler(org.codehaus.stax2.validation.ValidationProblemHandler h) org.codehaus.stax2.validation.XMLValidatorstopValidatingAgainst(org.codehaus.stax2.validation.XMLValidationSchema schema) org.codehaus.stax2.validation.XMLValidatorstopValidatingAgainst(org.codehaus.stax2.validation.XMLValidator validator) protected static voidthrowFromIOE(IOException ioe) protected static voidthrowOutputError(String msg) protected static voidthrowOutputError(String format, Object arg) toString()org.codehaus.stax2.validation.XMLValidatorvalidateAgainst(org.codehaus.stax2.validation.XMLValidationSchema schema) abstract StringvalidateQNamePrefix(QName name) Method called before writing a QName via Typed Access API.protected voidverifyRootElement(String localName, String prefix) protected final voidprotected final voidfinal WriterMethod that can be called to get a wrapper instance that can be used to essentially call thewriteRawmethod via regularWriterinterface.final WriterMethod that can be called to get a wrapper instance that can be used to essentially call thewriteCharactersmethod via regularWriterinterface.abstract voidwriteAttribute(String localName, String value) abstract voidwriteAttribute(String nsURI, String localName, String value) abstract voidwriteAttribute(String prefix, String nsURI, String localName, String value) voidwriteCData(char[] cbuf, int start, int len) voidwriteCData(String data) voidwriteCharacters(char[] text, int start, int len) voidwriteCharacters(String text) voidMethod 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.voidwriteComment(String data) abstract voidwriteDefaultNamespace(String nsURI) voidvoidvoidwriteDTD(org.codehaus.stax2.DTDInfo info) abstract voidwriteEmptyElement(String localName) abstract voidwriteEmptyElement(String nsURI, String localName) abstract voidwriteEmptyElement(String prefix, String localName, String nsURI) voidabstract voidabstract voidwriteEndElement(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.voidwriteEntityRef(String name) abstract voidabstract voidwriteNamespace(String prefix, String nsURI) voidwriteProcessingInstruction(String target) voidwriteProcessingInstruction(String target, String data) voidwriteRaw(char[] text, int start, int offset) voidvoidvoidwriteSpace(char[] text, int offset, int length) voidwriteSpace(String text) voidvoidwriteStartDocument(String version) voidwriteStartDocument(String encoding, String version) voidwriteStartDocument(String version, String encoding, boolean standAlone) abstract voidwriteStartElement(String localName) abstract voidwriteStartElement(String nsURI, String localName) abstract voidwriteStartElement(String prefix, String localName, String nsURI) abstract voidConvenience method needed byXMLEventWriterimplementation, to use when writing a start element, and possibly its attributes and namespace declarations.Methods inherited from class org.codehaus.stax2.ri.Stax2WriterImpl
copyStartElementMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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(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:
closein interfaceXMLStreamWriter- Throws:
XMLStreamException
-
flush
- Specified by:
flushin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
getNamespaceContext
- Specified by:
getNamespaceContextin interfaceXMLStreamWriter
-
getPrefix
- Specified by:
getPrefixin interfaceXMLStreamWriter
-
getProperty
- Specified by:
getPropertyin interfaceXMLStreamWriter
-
setDefaultNamespace
- Specified by:
setDefaultNamespacein interfaceXMLStreamWriter- Throws:
XMLStreamException
-
setNamespaceContext
- Specified by:
setNamespaceContextin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
setPrefix
- Specified by:
setPrefixin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeAttribute
- Specified by:
writeAttributein interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeAttribute
public abstract void writeAttribute(String nsURI, String localName, String value) throws XMLStreamException - Specified by:
writeAttributein interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeAttribute
public abstract void writeAttribute(String prefix, String nsURI, String localName, String value) throws XMLStreamException - Specified by:
writeAttributein interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeCData
- Specified by:
writeCDatain interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeCharacters
- Specified by:
writeCharactersin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeCharacters
- Specified by:
writeCharactersin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeComment
- Specified by:
writeCommentin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeDefaultNamespace
- Specified by:
writeDefaultNamespacein interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeDTD
- Specified by:
writeDTDin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeEmptyElement
- Specified by:
writeEmptyElementin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeEmptyElement
- Specified by:
writeEmptyElementin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeEmptyElement
public abstract void writeEmptyElement(String prefix, String localName, String nsURI) throws XMLStreamException - Specified by:
writeEmptyElementin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeEndDocument
- Specified by:
writeEndDocumentin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeEndElement
- Specified by:
writeEndElementin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeEntityRef
- Specified by:
writeEntityRefin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeNamespace
- Specified by:
writeNamespacein interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeProcessingInstruction
- Specified by:
writeProcessingInstructionin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeProcessingInstruction
- Specified by:
writeProcessingInstructionin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeStartDocument
- Specified by:
writeStartDocumentin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeStartDocument
- Specified by:
writeStartDocumentin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeStartDocument
- Specified by:
writeStartDocumentin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
doWriteStartDocument
protected void doWriteStartDocument(String version, String encoding, String standAlone) throws XMLStreamException - Throws:
XMLStreamException
-
writeStartElement
- Specified by:
writeStartElementin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeStartElement
- Specified by:
writeStartElementin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeStartElement
public abstract void writeStartElement(String prefix, String localName, String nsURI) throws XMLStreamException - Specified by:
writeStartElementin 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:
copyEventFromReaderin interfaceorg.codehaus.stax2.XMLStreamWriter2- Overrides:
copyEventFromReaderin 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:
closeCompletelyin interfaceorg.codehaus.stax2.XMLStreamWriter2- Throws:
XMLStreamException
-
isPropertySupported
- Specified by:
isPropertySupportedin interfaceorg.codehaus.stax2.XMLStreamWriter2- Overrides:
isPropertySupportedin classorg.codehaus.stax2.ri.Stax2WriterImpl
-
setProperty
- Specified by:
setPropertyin interfaceorg.codehaus.stax2.XMLStreamWriter2- Overrides:
setPropertyin 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:
validateAgainstin interfaceorg.codehaus.stax2.validation.Validatable- Overrides:
validateAgainstin 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:
stopValidatingAgainstin interfaceorg.codehaus.stax2.validation.Validatable- Overrides:
stopValidatingAgainstin 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:
stopValidatingAgainstin interfaceorg.codehaus.stax2.validation.Validatable- Overrides:
stopValidatingAgainstin classorg.codehaus.stax2.ri.Stax2WriterImpl- Throws:
XMLStreamException
-
setValidationProblemHandler
public org.codehaus.stax2.validation.ValidationProblemHandler setValidationProblemHandler(org.codehaus.stax2.validation.ValidationProblemHandler h) - Specified by:
setValidationProblemHandlerin interfaceorg.codehaus.stax2.validation.Validatable- Overrides:
setValidationProblemHandlerin classorg.codehaus.stax2.ri.Stax2WriterImpl
-
resetValidationFlags
private void resetValidationFlags() -
getLocation
public org.codehaus.stax2.XMLStreamLocation2 getLocation()- Specified by:
getLocationin interfaceorg.codehaus.stax2.XMLStreamWriter2- Specified by:
getLocationin classorg.codehaus.stax2.ri.Stax2WriterImpl
-
getEncoding
- Specified by:
getEncodingin interfaceorg.codehaus.stax2.XMLStreamWriter2- Specified by:
getEncodingin classorg.codehaus.stax2.ri.Stax2WriterImpl
-
writeCData
- Specified by:
writeCDatain interfaceorg.codehaus.stax2.XMLStreamWriter2- Overrides:
writeCDatain 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:
writeDTDin interfaceorg.codehaus.stax2.XMLStreamWriter2- Overrides:
writeDTDin classorg.codehaus.stax2.ri.Stax2WriterImpl- Throws:
XMLStreamException
-
writeFullEndElement
- Specified by:
writeFullEndElementin interfaceorg.codehaus.stax2.XMLStreamWriter2- Overrides:
writeFullEndElementin classorg.codehaus.stax2.ri.Stax2WriterImpl- Throws:
XMLStreamException
-
writeStartDocument
public void writeStartDocument(String version, String encoding, boolean standAlone) throws XMLStreamException - Specified by:
writeStartDocumentin interfaceorg.codehaus.stax2.XMLStreamWriter2- Specified by:
writeStartDocumentin classorg.codehaus.stax2.ri.Stax2WriterImpl- Throws:
XMLStreamException
-
writeRaw
- Specified by:
writeRawin interfaceorg.codehaus.stax2.XMLStreamWriter2- Overrides:
writeRawin classorg.codehaus.stax2.ri.Stax2WriterImpl- Throws:
XMLStreamException
-
writeRaw
- Specified by:
writeRawin interfaceorg.codehaus.stax2.XMLStreamWriter2- Specified by:
writeRawin classorg.codehaus.stax2.ri.Stax2WriterImpl- Throws:
XMLStreamException
-
writeRaw
- Specified by:
writeRawin interfaceorg.codehaus.stax2.XMLStreamWriter2- Specified by:
writeRawin classorg.codehaus.stax2.ri.Stax2WriterImpl- Throws:
XMLStreamException
-
writeSpace
- Specified by:
writeSpacein interfaceorg.codehaus.stax2.XMLStreamWriter2- Overrides:
writeSpacein classorg.codehaus.stax2.ri.Stax2WriterImpl- Throws:
XMLStreamException
-
writeSpace
- Specified by:
writeSpacein interfaceorg.codehaus.stax2.XMLStreamWriter2- Overrides:
writeSpacein classorg.codehaus.stax2.ri.Stax2WriterImpl- Throws:
XMLStreamException
-
getXmlVersion
- Specified by:
getXmlVersionin interfaceorg.codehaus.stax2.validation.ValidationContext
-
getCurrentElementName
- Specified by:
getCurrentElementNamein interfaceorg.codehaus.stax2.validation.ValidationContext
-
getNamespaceURI
-
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:
getBaseUriin interfaceorg.codehaus.stax2.validation.ValidationContext
-
getValidationLocation
- Specified by:
getValidationLocationin interfaceorg.codehaus.stax2.validation.ValidationContext
-
reportProblem
public void reportProblem(org.codehaus.stax2.validation.XMLValidationProblem prob) throws XMLStreamException - Specified by:
reportProblemin 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:
addDefaultAttributein interfaceorg.codehaus.stax2.validation.ValidationContext
-
isNotationDeclared
- Specified by:
isNotationDeclaredin interfaceorg.codehaus.stax2.validation.ValidationContext
-
isUnparsedEntityDeclared
- Specified by:
isUnparsedEntityDeclaredin interfaceorg.codehaus.stax2.validation.ValidationContext
-
getAttributeCount
public int getAttributeCount()- Specified by:
getAttributeCountin interfaceorg.codehaus.stax2.validation.ValidationContext
-
getAttributeLocalName
- Specified by:
getAttributeLocalNamein interfaceorg.codehaus.stax2.validation.ValidationContext
-
getAttributeNamespace
- Specified by:
getAttributeNamespacein interfaceorg.codehaus.stax2.validation.ValidationContext
-
getAttributePrefix
- Specified by:
getAttributePrefixin interfaceorg.codehaus.stax2.validation.ValidationContext
-
getAttributeValue
- Specified by:
getAttributeValuein interfaceorg.codehaus.stax2.validation.ValidationContext
-
getAttributeValue
-
getAttributeType
- Specified by:
getAttributeTypein interfaceorg.codehaus.stax2.validation.ValidationContext
-
findAttributeIndex
-
wrapAsRawWriter
Method that can be called to get a wrapper instance that can be used to essentially call thewriteRawmethod via regularWriterinterface. -
wrapAsTextWriter
Method that can be called to get a wrapper instance that can be used to essentially call thewriteCharactersmethod via regularWriterinterface. -
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 byXMLEventWriterimplementation, 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:
IOExceptionXMLStreamException
-
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_STRUCTUREis 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_CONTENTis 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_NAMESis 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
-