com.fasterxml.aalto.out
Class StreamWriterBase

java.lang.Object
  extended by org.codehaus.stax2.ri.Stax2WriterImpl
      extended by 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
protected static class StreamWriterBase.State
           
 
Field Summary
protected  boolean _cfgCDataAsText
           
protected  boolean _cfgCheckAttrs
           
protected  boolean _cfgCheckContent
           
protected  boolean _cfgCheckStructure
           
protected  WriterConfig _config
           
protected  com.fasterxml.aalto.out.OutputElement _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.
protected  String _dtdRootElemName
          Value passed as the expected root element, when using the multiple argument writeDTD(java.lang.String) method.
protected  com.fasterxml.aalto.out.OutputElement _outputElemPool
           
protected  int _poolSize
           
protected  NamespaceContext _rootNsContext
          Root namespace context defined for this writer, if any.
protected  StreamWriterBase.State _state
           
protected  boolean _stateAnyOutput
          Flag that is set to true first time something has been output.
protected  boolean _stateEmptyElement
          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 _stateStartElementOpen
          Flag that is set during time that a start element is "open", ie.
protected  WNameTable _symbols
           
protected  org.codehaus.stax2.validation.XMLValidator _validator
          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 _valueEncoderFactory
          When outputting using Typed Access API, we will need encoders.
protected  int _vldContent
          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 _vldProblemHandler
          Custom validation problem handler, if any.
protected  XmlWriter _xmlWriter
          Actual physical writer to output serialized XML content to
 
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
protected StreamWriterBase(WriterConfig cfg, XmlWriter writer, WNameTable symbols)
           
 
Method Summary
protected  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.
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 _reportNwfStructure(String msg)
          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 _reportValidationProblem(String msg)
           
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  void _verifyWriteAttr(WName name)
           
protected  void _verifyWriteCData()
           
protected  void _verifyWriteDTD()
           
protected  void _writeAttribute(WName name, org.codehaus.stax2.ri.typed.AsciiValueEncoder enc)
           
protected  void _writeAttribute(WName name, String value)
           
protected  void _writeDefaultNamespace(String uri)
           
protected  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 closeCompletely()
           
 int findAttributeIndex(String nsURI, String localName)
           
 void flush()
           
 int getAttributeCount()
           
 String getAttributeLocalName(int index)
           
 String getAttributeNamespace(int index)
           
 String getAttributePrefix(int index)
           
 String getAttributeType(int index)
           
 String getAttributeValue(int index)
           
 String getAttributeValue(String nsURI, String localName)
           
 String getBaseUri()
          As of now, there is no way to specify the base URI.
 QName getCurrentElementName()
           
 String getEncoding()
           
 org.codehaus.stax2.XMLStreamLocation2 getLocation()
           
 NamespaceContext getNamespaceContext()
           
 String getNamespaceURI(String prefix)
           
 String getPrefix(String uri)
           
 Iterator<String> getPrefixes(String uri)
           
 Object getProperty(String name)
           
 Location getValidationLocation()
           
 String getXmlVersion()
           
protected  boolean inPrologOrEpilog()
           
 boolean isNotationDeclared(String name)
           
 boolean isPropertySupported(String name)
           
 boolean isUnparsedEntityDeclared(String name)
           
protected static void reportIllegalArg(String msg)
           
protected static void reportIllegalMethod(String msg)
          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)
           
abstract  void setDefaultNamespace(String uri)
           
 void setNamespaceContext(NamespaceContext ctxt)
           
 void setPrefix(String prefix, String uri)
           
 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)
           
 String toString()
           
 org.codehaus.stax2.validation.XMLValidator validateAgainst(org.codehaus.stax2.validation.XMLValidationSchema schema)
           
protected  org.codehaus.stax2.ri.typed.ValueEncoderFactory valueEncoderFactory()
           
 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(org.codehaus.stax2.typed.Base64Variant v, byte[] value, int from, int length)
           
 void writeBinary(byte[] value, int from, int length)
           
 void writeBinaryAttribute(org.codehaus.stax2.typed.Base64Variant v, String prefix, String nsURI, String localName, byte[] value)
           
 void writeBinaryAttribute(String prefix, String nsURI, String localName, byte[] value)
           
 void writeBoolean(boolean b)
           
 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)
           
 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)
           
 void writeDoubleAttribute(String prefix, String nsURI, String localName, double value)
           
 void writeDTD(org.codehaus.stax2.DTDInfo info)
           
 void writeDTD(String dtd)
           
 void writeDTD(String rootName, String systemId, String publicId, String internalSubset)
           
 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 writeEndDocument()
           
 void writeEndElement()
           
 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)
           
 void writeFloatAttribute(String prefix, String nsURI, String localName, float value)
           
 void writeFullEndElement()
          Similar to writeEndElement(), but never allows implicit creation of empty elements.
 void writeInt(int value)
           
 void writeIntArray(int[] value, int from, int length)
           
 void writeIntArrayAttribute(String prefix, String nsURI, String localName, int[] value)
           
 void writeIntAttribute(String prefix, String nsURI, String localName, int value)
           
 void writeInteger(BigInteger value)
           
 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)
           
 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)
           
 void writeQNameAttribute(String prefix, String nsURI, String localName, QName value)
           
 void writeRaw(char[] text, int offset, int length)
           
 void writeRaw(String text)
           
 void writeRaw(String text, int start, int offset)
           
 void writeSpace(char[] cbuf, int offset, int len)
           
 void writeSpace(String text)
           
 void writeStartDocument()
           
 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.
 
Methods inherited from class org.codehaus.stax2.ri.Stax2WriterImpl
copyEventFromReader, copyStartElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_config

protected final WriterConfig _config

_rootNsContext

protected NamespaceContext _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

protected WNameTable _symbols

_xmlWriter

protected final XmlWriter _xmlWriter
Actual physical writer to output serialized XML content to


_valueEncoderFactory

protected org.codehaus.stax2.ri.typed.ValueEncoderFactory _valueEncoderFactory
When 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 _validator
Optional validator to use for validating output against one or more schemas, and/or for safe pretty-printing (indentation).


_vldContent

protected int _vldContent
State 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 _vldProblemHandler
Custom validation problem handler, if any.


_state

protected StreamWriterBase.State _state

_currElem

protected com.fasterxml.aalto.out.OutputElement _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 _stateAnyOutput
Flag 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 _stateStartElementOpen
Flag 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 _stateEmptyElement
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). 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

protected String _dtdRootElemName
Value passed as the expected root element, when using the multiple argument writeDTD(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

protected com.fasterxml.aalto.out.OutputElement _outputElemPool

_poolSize

protected int _poolSize
Constructor Detail

StreamWriterBase

protected StreamWriterBase(WriterConfig cfg,
                           XmlWriter writer,
                           WNameTable symbols)
Method Detail

close

public void close()
           throws XMLStreamException
Specified by:
close in interface XMLStreamWriter
Throws:
XMLStreamException

flush

public void flush()
           throws XMLStreamException
Specified by:
flush in interface XMLStreamWriter
Throws:
XMLStreamException

getNamespaceContext

public final NamespaceContext getNamespaceContext()
Specified by:
getNamespaceContext in interface XMLStreamWriter

getProperty

public Object getProperty(String name)
Specified by:
getProperty in interface XMLStreamWriter

setDefaultNamespace

public abstract void setDefaultNamespace(String uri)
                                  throws XMLStreamException
Specified by:
setDefaultNamespace in interface XMLStreamWriter
Throws:
XMLStreamException

setNamespaceContext

public void setNamespaceContext(NamespaceContext ctxt)
                         throws XMLStreamException
Specified by:
setNamespaceContext in interface XMLStreamWriter
Throws:
XMLStreamException

setPrefix

public final void setPrefix(String prefix,
                            String uri)
                     throws XMLStreamException
Specified by:
setPrefix in interface XMLStreamWriter
Throws:
XMLStreamException

_setPrefix

protected abstract void _setPrefix(String prefix,
                                   String uri)

writeAttribute

public final void writeAttribute(String localName,
                                 String value)
                          throws XMLStreamException
Specified by:
writeAttribute in interface XMLStreamWriter
Throws:
XMLStreamException

writeAttribute

public abstract void writeAttribute(String nsURI,
                                    String localName,
                                    String value)
                             throws XMLStreamException
Specified by:
writeAttribute in interface XMLStreamWriter
Throws:
XMLStreamException

writeAttribute

public abstract void writeAttribute(String prefix,
                                    String nsURI,
                                    String localName,
                                    String value)
                             throws XMLStreamException
Specified by:
writeAttribute in interface XMLStreamWriter
Throws:
XMLStreamException

writeCData

public void writeCData(String data)
                throws XMLStreamException
Specified by:
writeCData in interface XMLStreamWriter
Throws:
XMLStreamException

writeCharacters

public void writeCharacters(char[] text,
                            int start,
                            int len)
                     throws XMLStreamException
Specified by:
writeCharacters in interface XMLStreamWriter
Throws:
XMLStreamException

writeCharacters

public void writeCharacters(String text)
                     throws XMLStreamException
Specified by:
writeCharacters in interface XMLStreamWriter
Throws:
XMLStreamException

writeComment

public void writeComment(String data)
                  throws XMLStreamException
Specified by:
writeComment in interface XMLStreamWriter
Throws:
XMLStreamException

writeDefaultNamespace

public abstract void writeDefaultNamespace(String nsURI)
                                    throws XMLStreamException
Specified by:
writeDefaultNamespace in interface XMLStreamWriter
Throws:
XMLStreamException

writeDTD

public final void writeDTD(String dtd)
                    throws XMLStreamException
Specified by:
writeDTD in interface XMLStreamWriter
Throws:
XMLStreamException

writeEmptyElement

public void writeEmptyElement(String localName)
                       throws XMLStreamException
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 interface XMLStreamWriter
Throws:
XMLStreamException

writeEmptyElement

public abstract void writeEmptyElement(String nsURI,
                                       String localName)
                                throws XMLStreamException
Specified by:
writeEmptyElement in interface XMLStreamWriter
Throws:
XMLStreamException

writeEmptyElement

public abstract void writeEmptyElement(String prefix,
                                       String localName,
                                       String nsURI)
                                throws XMLStreamException
Specified by:
writeEmptyElement in interface XMLStreamWriter
Throws:
XMLStreamException

writeEndDocument

public void writeEndDocument()
                      throws XMLStreamException
Specified by:
writeEndDocument in interface XMLStreamWriter
Throws:
XMLStreamException

writeEndElement

public void writeEndElement()
                     throws XMLStreamException
Specified by:
writeEndElement in interface XMLStreamWriter
Throws:
XMLStreamException

writeEntityRef

public void writeEntityRef(String name)
                    throws XMLStreamException
Specified by:
writeEntityRef in interface XMLStreamWriter
Throws:
XMLStreamException

writeNamespace

public abstract void writeNamespace(String prefix,
                                    String nsURI)
                             throws XMLStreamException
Specified by:
writeNamespace in interface XMLStreamWriter
Throws:
XMLStreamException

writeProcessingInstruction

public void writeProcessingInstruction(String target)
                                throws XMLStreamException
Specified by:
writeProcessingInstruction in interface XMLStreamWriter
Throws:
XMLStreamException

writeProcessingInstruction

public void writeProcessingInstruction(String target,
                                       String data)
                                throws XMLStreamException
Specified by:
writeProcessingInstruction in interface XMLStreamWriter
Throws:
XMLStreamException

writeStartDocument

public void writeStartDocument()
                        throws XMLStreamException
Specified by:
writeStartDocument in interface XMLStreamWriter
Throws:
XMLStreamException

writeStartDocument

public void writeStartDocument(String version)
                        throws XMLStreamException
Specified by:
writeStartDocument in interface XMLStreamWriter
Throws:
XMLStreamException

writeStartDocument

public void writeStartDocument(String encoding,
                               String version)
                        throws XMLStreamException
Specified by:
writeStartDocument in interface XMLStreamWriter
Throws:
XMLStreamException

writeStartElement

public void writeStartElement(String localName)
                       throws XMLStreamException
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 interface XMLStreamWriter
Throws:
XMLStreamException

writeStartElement

public abstract void writeStartElement(String nsURI,
                                       String localName)
                                throws XMLStreamException
Specified by:
writeStartElement in interface XMLStreamWriter
Throws:
XMLStreamException

writeStartElement

public abstract void writeStartElement(String prefix,
                                       String localName,
                                       String nsURI)
                                throws XMLStreamException
Specified by:
writeStartElement in interface XMLStreamWriter
Throws:
XMLStreamException

getNamespaceURI

public String getNamespaceURI(String prefix)
Specified by:
getNamespaceURI in interface NamespaceContext
Specified by:
getNamespaceURI in interface org.codehaus.stax2.validation.ValidationContext

getPrefix

public String getPrefix(String uri)
Specified by:
getPrefix in interface NamespaceContext
Specified by:
getPrefix in interface XMLStreamWriter

getPrefixes

public Iterator<String> getPrefixes(String uri)
Specified by:
getPrefixes in interface NamespaceContext

writeBoolean

public void writeBoolean(boolean b)
                  throws XMLStreamException
Specified by:
writeBoolean in interface org.codehaus.stax2.typed.TypedXMLStreamWriter
Throws:
XMLStreamException

writeInt

public void writeInt(int value)
              throws XMLStreamException
Specified by:
writeInt in interface org.codehaus.stax2.typed.TypedXMLStreamWriter
Throws:
XMLStreamException

writeLong

public void writeLong(long value)
               throws XMLStreamException
Specified by:
writeLong in interface org.codehaus.stax2.typed.TypedXMLStreamWriter
Throws:
XMLStreamException

writeFloat

public void writeFloat(float value)
                throws XMLStreamException
Specified by:
writeFloat in interface org.codehaus.stax2.typed.TypedXMLStreamWriter
Throws:
XMLStreamException

writeDouble

public void writeDouble(double value)
                 throws XMLStreamException
Specified by:
writeDouble in interface org.codehaus.stax2.typed.TypedXMLStreamWriter
Throws:
XMLStreamException

writeInteger

public void writeInteger(BigInteger value)
                  throws XMLStreamException
Specified by:
writeInteger in interface org.codehaus.stax2.typed.TypedXMLStreamWriter
Throws:
XMLStreamException

writeDecimal

public void writeDecimal(BigDecimal value)
                  throws XMLStreamException
Specified by:
writeDecimal in interface org.codehaus.stax2.typed.TypedXMLStreamWriter
Throws:
XMLStreamException

writeQName

public void writeQName(QName value)
                throws XMLStreamException
Specified by:
writeQName in interface org.codehaus.stax2.typed.TypedXMLStreamWriter
Throws:
XMLStreamException

writeIntArray

public final void writeIntArray(int[] value,
                                int from,
                                int length)
                         throws XMLStreamException
Specified by:
writeIntArray in interface org.codehaus.stax2.typed.TypedXMLStreamWriter
Throws:
XMLStreamException

writeLongArray

public void writeLongArray(long[] value,
                           int from,
                           int length)
                    throws XMLStreamException
Specified by:
writeLongArray in interface org.codehaus.stax2.typed.TypedXMLStreamWriter
Throws:
XMLStreamException

writeFloatArray

public void writeFloatArray(float[] value,
                            int from,
                            int length)
                     throws XMLStreamException
Specified by:
writeFloatArray in interface org.codehaus.stax2.typed.TypedXMLStreamWriter
Throws:
XMLStreamException

writeDoubleArray

public void writeDoubleArray(double[] value,
                             int from,
                             int length)
                      throws XMLStreamException
Specified by:
writeDoubleArray in interface org.codehaus.stax2.typed.TypedXMLStreamWriter
Throws:
XMLStreamException

writeBinary

public void writeBinary(byte[] value,
                        int from,
                        int length)
                 throws XMLStreamException
Specified by:
writeBinary in interface org.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 interface org.codehaus.stax2.typed.TypedXMLStreamWriter
Throws:
XMLStreamException

writeBooleanAttribute

public final void writeBooleanAttribute(String prefix,
                                        String nsURI,
                                        String localName,
                                        boolean value)
                                 throws XMLStreamException
Specified by:
writeBooleanAttribute in interface org.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 interface org.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 interface org.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 interface org.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 interface org.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 interface org.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 interface org.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 interface org.codehaus.stax2.typed.TypedXMLStreamWriter
Throws:
XMLStreamException

writeIntArrayAttribute

public void writeIntArrayAttribute(String prefix,
                                   String nsURI,
                                   String localName,
                                   int[] value)
                            throws XMLStreamException
Specified by:
writeIntArrayAttribute in interface org.codehaus.stax2.typed.TypedXMLStreamWriter
Throws:
XMLStreamException

writeLongArrayAttribute

public void writeLongArrayAttribute(String prefix,
                                    String nsURI,
                                    String localName,
                                    long[] value)
                             throws XMLStreamException
Specified by:
writeLongArrayAttribute in interface org.codehaus.stax2.typed.TypedXMLStreamWriter
Throws:
XMLStreamException

writeFloatArrayAttribute

public void writeFloatArrayAttribute(String prefix,
                                     String nsURI,
                                     String localName,
                                     float[] value)
                              throws XMLStreamException
Specified by:
writeFloatArrayAttribute in interface org.codehaus.stax2.typed.TypedXMLStreamWriter
Throws:
XMLStreamException

writeDoubleArrayAttribute

public void writeDoubleArrayAttribute(String prefix,
                                      String nsURI,
                                      String localName,
                                      double[] value)
                               throws XMLStreamException
Specified by:
writeDoubleArrayAttribute in interface org.codehaus.stax2.typed.TypedXMLStreamWriter
Throws:
XMLStreamException

writeBinaryAttribute

public void writeBinaryAttribute(String prefix,
                                 String nsURI,
                                 String localName,
                                 byte[] value)
                          throws XMLStreamException
Specified by:
writeBinaryAttribute in interface org.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 interface org.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

protected abstract String _serializeQName(QName name)
                                   throws XMLStreamException
Throws:
XMLStreamException

writeSpace

public void writeSpace(String text)
                throws XMLStreamException
Specified by:
writeSpace in interface org.codehaus.stax2.XMLStreamWriter2
Overrides:
writeSpace in class org.codehaus.stax2.ri.Stax2WriterImpl
Throws:
XMLStreamException

writeSpace

public void writeSpace(char[] cbuf,
                       int offset,
                       int len)
                throws XMLStreamException
Specified by:
writeSpace in interface org.codehaus.stax2.XMLStreamWriter2
Overrides:
writeSpace in class org.codehaus.stax2.ri.Stax2WriterImpl
Throws:
XMLStreamException

closeCompletely

public void closeCompletely()
                     throws XMLStreamException
Specified by:
closeCompletely in interface org.codehaus.stax2.XMLStreamWriter2
Throws:
XMLStreamException

isPropertySupported

public boolean isPropertySupported(String name)
Specified by:
isPropertySupported in interface org.codehaus.stax2.XMLStreamWriter2
Overrides:
isPropertySupported in class org.codehaus.stax2.ri.Stax2WriterImpl

setProperty

public boolean setProperty(String name,
                           Object value)
Specified by:
setProperty in interface org.codehaus.stax2.XMLStreamWriter2
Overrides:
setProperty in class org.codehaus.stax2.ri.Stax2WriterImpl
Parameters:
name - Name of the property to set
value - 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 interface org.codehaus.stax2.validation.Validatable
Overrides:
validateAgainst in class org.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 interface org.codehaus.stax2.validation.Validatable
Overrides:
stopValidatingAgainst in class org.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 interface org.codehaus.stax2.validation.Validatable
Overrides:
stopValidatingAgainst in class org.codehaus.stax2.ri.Stax2WriterImpl
Throws:
XMLStreamException

setValidationProblemHandler

public org.codehaus.stax2.validation.ValidationProblemHandler setValidationProblemHandler(org.codehaus.stax2.validation.ValidationProblemHandler h)
Specified by:
setValidationProblemHandler in interface org.codehaus.stax2.validation.Validatable
Overrides:
setValidationProblemHandler in class org.codehaus.stax2.ri.Stax2WriterImpl

getLocation

public org.codehaus.stax2.XMLStreamLocation2 getLocation()
Specified by:
getLocation in interface org.codehaus.stax2.XMLStreamWriter2
Specified by:
getLocation in class org.codehaus.stax2.ri.Stax2WriterImpl

getEncoding

public String getEncoding()
Specified by:
getEncoding in interface org.codehaus.stax2.XMLStreamWriter2
Specified by:
getEncoding in class org.codehaus.stax2.ri.Stax2WriterImpl

writeCData

public void writeCData(char[] cbuf,
                       int start,
                       int len)
                throws XMLStreamException
Specified by:
writeCData in interface org.codehaus.stax2.XMLStreamWriter2
Overrides:
writeCData in class org.codehaus.stax2.ri.Stax2WriterImpl
Throws:
XMLStreamException

writeDTD

public void writeDTD(org.codehaus.stax2.DTDInfo info)
              throws XMLStreamException
Throws:
XMLStreamException

writeDTD

public void writeDTD(String rootName,
                     String systemId,
                     String publicId,
                     String internalSubset)
              throws XMLStreamException
Specified by:
writeDTD in interface org.codehaus.stax2.XMLStreamWriter2
Overrides:
writeDTD in class org.codehaus.stax2.ri.Stax2WriterImpl
Throws:
XMLStreamException

writeFullEndElement

public void writeFullEndElement()
                         throws XMLStreamException
Similar to writeEndElement(), but never allows implicit creation of empty elements.

Specified by:
writeFullEndElement in interface org.codehaus.stax2.XMLStreamWriter2
Overrides:
writeFullEndElement in class org.codehaus.stax2.ri.Stax2WriterImpl
Throws:
XMLStreamException

writeStartDocument

public void writeStartDocument(String version,
                               String encoding,
                               boolean standAlone)
                        throws XMLStreamException
Specified by:
writeStartDocument in interface org.codehaus.stax2.XMLStreamWriter2
Specified by:
writeStartDocument in class org.codehaus.stax2.ri.Stax2WriterImpl
Throws:
XMLStreamException

writeRaw

public void writeRaw(String text)
              throws XMLStreamException
Specified by:
writeRaw in interface org.codehaus.stax2.XMLStreamWriter2
Overrides:
writeRaw in class org.codehaus.stax2.ri.Stax2WriterImpl
Throws:
XMLStreamException

writeRaw

public void writeRaw(String text,
                     int start,
                     int offset)
              throws XMLStreamException
Specified by:
writeRaw in interface org.codehaus.stax2.XMLStreamWriter2
Specified by:
writeRaw in class org.codehaus.stax2.ri.Stax2WriterImpl
Throws:
XMLStreamException

writeRaw

public void writeRaw(char[] text,
                     int offset,
                     int length)
              throws XMLStreamException
Specified by:
writeRaw in interface org.codehaus.stax2.XMLStreamWriter2
Specified by:
writeRaw in class org.codehaus.stax2.ri.Stax2WriterImpl
Throws:
XMLStreamException

getXmlVersion

public String getXmlVersion()
Specified by:
getXmlVersion in interface org.codehaus.stax2.validation.ValidationContext

getCurrentElementName

public QName getCurrentElementName()
Specified by:
getCurrentElementName in interface org.codehaus.stax2.validation.ValidationContext

getBaseUri

public String 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 interface org.codehaus.stax2.validation.ValidationContext

getValidationLocation

public Location getValidationLocation()
Specified by:
getValidationLocation in interface org.codehaus.stax2.validation.ValidationContext

reportProblem

public void reportProblem(org.codehaus.stax2.validation.XMLValidationProblem prob)
                   throws XMLStreamException
Specified by:
reportProblem in interface org.codehaus.stax2.validation.ValidationContext
Throws:
XMLStreamException

addDefaultAttribute

public 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.

Specified by:
addDefaultAttribute in interface org.codehaus.stax2.validation.ValidationContext

isNotationDeclared

public boolean isNotationDeclared(String name)
Specified by:
isNotationDeclared in interface org.codehaus.stax2.validation.ValidationContext

isUnparsedEntityDeclared

public boolean isUnparsedEntityDeclared(String name)
Specified by:
isUnparsedEntityDeclared in interface org.codehaus.stax2.validation.ValidationContext

getAttributeCount

public int getAttributeCount()
Specified by:
getAttributeCount in interface org.codehaus.stax2.validation.ValidationContext

getAttributeLocalName

public String getAttributeLocalName(int index)
Specified by:
getAttributeLocalName in interface org.codehaus.stax2.validation.ValidationContext

getAttributeNamespace

public String getAttributeNamespace(int index)
Specified by:
getAttributeNamespace in interface org.codehaus.stax2.validation.ValidationContext

getAttributePrefix

public String getAttributePrefix(int index)
Specified by:
getAttributePrefix in interface org.codehaus.stax2.validation.ValidationContext

getAttributeValue

public String getAttributeValue(int index)
Specified by:
getAttributeValue in interface org.codehaus.stax2.validation.ValidationContext

getAttributeValue

public String getAttributeValue(String nsURI,
                                String localName)
Specified by:
getAttributeValue in interface org.codehaus.stax2.validation.ValidationContext

getAttributeType

public String getAttributeType(int index)
Specified by:
getAttributeType in interface org.codehaus.stax2.validation.ValidationContext

findAttributeIndex

public int findAttributeIndex(String nsURI,
                              String localName)
Specified by:
findAttributeIndex in interface org.codehaus.stax2.validation.ValidationContext

_closeStartElement

protected void _closeStartElement(boolean emptyElem)
                           throws XMLStreamException
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

protected final void _writeAttribute(WName name,
                                     String value)
                              throws XMLStreamException
Throws:
XMLStreamException

_writeAttribute

protected final void _writeAttribute(WName name,
                                     org.codehaus.stax2.ri.typed.AsciiValueEncoder enc)
                              throws XMLStreamException
Throws:
XMLStreamException

_writeDefaultNamespace

protected final void _writeDefaultNamespace(String uri)
                                     throws XMLStreamException
Throws:
XMLStreamException

_writeNamespace

protected final void _writeNamespace(String prefix,
                                     String uri)
                              throws XMLStreamException
Throws:
XMLStreamException

_writeStartDocument

protected void _writeStartDocument(String version,
                                   String encoding,
                                   String standAlone)
                            throws XMLStreamException
Throws:
XMLStreamException

_writeStartTag

protected void _writeStartTag(WName name,
                              boolean isEmpty)
                       throws XMLStreamException
Throws:
XMLStreamException

_writeStartTag

protected void _writeStartTag(WName name,
                              boolean isEmpty,
                              String uri)
                       throws XMLStreamException
Throws:
XMLStreamException

_verifyWriteAttr

protected final void _verifyWriteAttr(WName name)

_verifyStartElement

protected void _verifyStartElement(String prefix,
                                   String localName)
                            throws XMLStreamException
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

protected final void _verifyWriteCData()
                                throws XMLStreamException
Throws:
XMLStreamException

_verifyWriteDTD

protected final void _verifyWriteDTD()
                              throws XMLStreamException
Throws:
XMLStreamException

_verifyRootElement

protected void _verifyRootElement(String prefix,
                                  String localName)
                           throws org.codehaus.stax2.validation.XMLValidationException
Throws:
org.codehaus.stax2.validation.XMLValidationException

throwOutputError

protected static void throwOutputError(String msg)
                                throws XMLStreamException
Throws:
XMLStreamException

throwOutputError

protected static void throwOutputError(String format,
                                       Object arg)
                                throws XMLStreamException
Throws:
XMLStreamException

reportIllegalMethod

protected static void reportIllegalMethod(String msg)
                                   throws XMLStreamException
Method called when an illegal method (namespace-specific method on non-ns writer) is called by the application.

Throws:
XMLStreamException

_reportNwfStructure

protected static void _reportNwfStructure(String msg)
                                   throws XMLStreamException
This is the method called when an output method call violates structural well-formedness checks and structural checking is enabled.

Throws:
XMLStreamException

_reportNwfStructure

protected static void _reportNwfStructure(String msg,
                                          Object arg)
                                   throws XMLStreamException
Throws:
XMLStreamException

_reportNwfContent

protected static void _reportNwfContent(String msg)
                                 throws XMLStreamException
This is the method called when an output method call violates content well-formedness checks and content validation is enabled.

Throws:
XMLStreamException

_reportNwfContent

protected static void _reportNwfContent(String msg,
                                        Object arg)
                                 throws XMLStreamException
Throws:
XMLStreamException

_reportNwfAttr

protected static void _reportNwfAttr(String msg)
                              throws XMLStreamException
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

protected static void _reportNwfAttr(String msg,
                                     Object arg)
                              throws XMLStreamException
Throws:
XMLStreamException

_reportNwfName

protected static void _reportNwfName(String msg)
                              throws XMLStreamException
Throws:
XMLStreamException

throwFromIOE

protected static void throwFromIOE(IOException ioe)
                            throws XMLStreamException
Throws:
XMLStreamException

reportIllegalArg

protected static void reportIllegalArg(String msg)
                                throws IllegalArgumentException
Throws:
IllegalArgumentException

_reportInvalidContent

protected void _reportInvalidContent(int evtType)
                              throws XMLStreamException
Throws:
XMLStreamException

_reportValidationProblem

public void _reportValidationProblem(String msg)
                              throws XMLStreamException
Throws:
XMLStreamException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012 Fasterxml.com. All Rights Reserved.