com.fasterxml.aalto.out
Class RepairingStreamWriter
java.lang.Object
org.codehaus.stax2.ri.Stax2WriterImpl
com.fasterxml.aalto.out.StreamWriterBase
com.fasterxml.aalto.out.RepairingStreamWriter
- 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
public final class RepairingStreamWriter
- extends StreamWriterBase
Concrete implementation of StreamWriterBase
, which
implements the "namespace repairing" mode of operation.
This means that the writer ensures correctness and validity
of namespace bindings, as based on namespace URIs caller
passes, by adding necessary namespace declarations and using
prefixes as required to obtain expected results.
Fields inherited from class com.fasterxml.aalto.out.StreamWriterBase |
_cfgCDataAsText, _cfgCheckAttrs, _cfgCheckContent, _cfgCheckStructure, _config, _currElem, _dtdRootElemName, _outputElemPool, _poolSize, _rootNsContext, _state, _stateAnyOutput, _stateEmptyElement, _stateStartElementOpen, _symbols, _validator, _valueEncoderFactory, _vldContent, _vldProblemHandler, _xmlWriter |
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 |
Method Summary |
protected WName |
_generateAttrName(String suggPrefix,
String localName,
String uri)
|
protected String |
_generateElemPrefix(String uri)
Method called if given URI is not yet bound, and no suggested prefix
is given (or one given can't be used). |
protected String |
_serializeQName(QName name)
|
void |
_setPrefix(String prefix,
String uri)
|
void |
_writeStartOrEmpty(String prefix,
String localName,
String nsURI,
boolean isEmpty)
|
void |
setDefaultNamespace(String uri)
With repairing writer, this is only taken as a suggestion as to how
the caller would prefer prefixes to be mapped. |
void |
writeAttribute(String nsURI,
String localName,
String value)
|
void |
writeAttribute(String prefix,
String nsURI,
String localName,
String value)
|
void |
writeDefaultNamespace(String nsURI)
|
void |
writeEmptyElement(String nsURI,
String localName)
|
void |
writeEmptyElement(String prefix,
String localName,
String nsURI)
|
void |
writeNamespace(String prefix,
String nsURI)
|
void |
writeStartElement(String nsURI,
String localName)
|
void |
writeStartElement(String prefix,
String localName,
String nsURI)
|
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 com.fasterxml.aalto.out.StreamWriterBase |
_closeStartElement, _reportInvalidContent, _reportNwfAttr, _reportNwfAttr, _reportNwfContent, _reportNwfContent, _reportNwfName, _reportNwfStructure, _reportNwfStructure, _reportValidationProblem, _verifyRootElement, _verifyStartElement, _verifyWriteAttr, _verifyWriteCData, _verifyWriteDTD, _writeAttribute, _writeAttribute, _writeDefaultNamespace, _writeNamespace, _writeStartDocument, _writeStartTag, _writeStartTag, addDefaultAttribute, close, closeCompletely, findAttributeIndex, flush, getAttributeCount, getAttributeLocalName, getAttributeNamespace, getAttributePrefix, getAttributeType, getAttributeValue, getAttributeValue, getBaseUri, getCurrentElementName, getEncoding, getLocation, getNamespaceContext, getNamespaceURI, getPrefix, getPrefixes, getProperty, getValidationLocation, getXmlVersion, inPrologOrEpilog, isNotationDeclared, isPropertySupported, isUnparsedEntityDeclared, reportIllegalArg, reportIllegalMethod, reportProblem, setNamespaceContext, setPrefix, setProperty, setValidationProblemHandler, stopValidatingAgainst, stopValidatingAgainst, throwFromIOE, throwOutputError, throwOutputError, toString, validateAgainst, valueEncoderFactory, writeAttribute, writeBinary, writeBinary, writeBinaryAttribute, writeBinaryAttribute, writeBoolean, writeBooleanAttribute, writeCData, writeCData, writeCharacters, writeCharacters, writeComment, writeDecimal, writeDecimalAttribute, writeDouble, writeDoubleArray, writeDoubleArrayAttribute, writeDoubleAttribute, writeDTD, writeDTD, writeDTD, writeEmptyElement, writeEndDocument, writeEndElement, writeEntityRef, writeFloat, writeFloatArray, writeFloatArrayAttribute, writeFloatAttribute, writeFullEndElement, writeInt, writeIntArray, writeIntArrayAttribute, writeIntAttribute, writeInteger, writeIntegerAttribute, writeLong, writeLongArray, writeLongArrayAttribute, writeLongAttribute, writeProcessingInstruction, writeProcessingInstruction, writeQName, writeQNameAttribute, writeRaw, writeRaw, writeRaw, writeSpace, writeSpace, writeStartDocument, writeStartDocument, writeStartDocument, writeStartDocument, writeStartElement |
Methods inherited from class org.codehaus.stax2.ri.Stax2WriterImpl |
copyEventFromReader, copyStartElement |
RepairingStreamWriter
public RepairingStreamWriter(WriterConfig cfg,
XmlWriter writer,
WNameTable symbols)
setDefaultNamespace
public void setDefaultNamespace(String uri)
throws XMLStreamException
- With repairing writer, this is only taken as a suggestion as to how
the caller would prefer prefixes to be mapped.
- Specified by:
setDefaultNamespace
in interface XMLStreamWriter
- Specified by:
setDefaultNamespace
in class StreamWriterBase
- Throws:
XMLStreamException
_setPrefix
public void _setPrefix(String prefix,
String uri)
- Specified by:
_setPrefix
in class StreamWriterBase
writeAttribute
public void writeAttribute(String nsURI,
String localName,
String value)
throws XMLStreamException
- Specified by:
writeAttribute
in interface XMLStreamWriter
- Specified by:
writeAttribute
in class StreamWriterBase
- Throws:
XMLStreamException
writeAttribute
public void writeAttribute(String prefix,
String nsURI,
String localName,
String value)
throws XMLStreamException
- Specified by:
writeAttribute
in interface XMLStreamWriter
- Specified by:
writeAttribute
in class StreamWriterBase
- Throws:
XMLStreamException
writeDefaultNamespace
public void writeDefaultNamespace(String nsURI)
throws XMLStreamException
- Specified by:
writeDefaultNamespace
in interface XMLStreamWriter
- Specified by:
writeDefaultNamespace
in class StreamWriterBase
- Throws:
XMLStreamException
writeEmptyElement
public void writeEmptyElement(String nsURI,
String localName)
throws XMLStreamException
- Specified by:
writeEmptyElement
in interface XMLStreamWriter
- Specified by:
writeEmptyElement
in class StreamWriterBase
- Throws:
XMLStreamException
writeEmptyElement
public void writeEmptyElement(String prefix,
String localName,
String nsURI)
throws XMLStreamException
- Specified by:
writeEmptyElement
in interface XMLStreamWriter
- Specified by:
writeEmptyElement
in class StreamWriterBase
- Throws:
XMLStreamException
writeNamespace
public void writeNamespace(String prefix,
String nsURI)
throws XMLStreamException
- Specified by:
writeNamespace
in interface XMLStreamWriter
- Specified by:
writeNamespace
in class StreamWriterBase
- Throws:
XMLStreamException
writeStartElement
public void writeStartElement(String nsURI,
String localName)
throws XMLStreamException
- Specified by:
writeStartElement
in interface XMLStreamWriter
- Specified by:
writeStartElement
in class StreamWriterBase
- Throws:
XMLStreamException
writeStartElement
public void writeStartElement(String prefix,
String localName,
String nsURI)
throws XMLStreamException
- Specified by:
writeStartElement
in interface XMLStreamWriter
- Specified by:
writeStartElement
in class StreamWriterBase
- Throws:
XMLStreamException
writeTypedAttribute
public void writeTypedAttribute(String prefix,
String nsURI,
String localName,
org.codehaus.stax2.ri.typed.AsciiValueEncoder enc)
throws XMLStreamException
- Description copied from class:
StreamWriterBase
- Need to leave implementation of this method abstract, because
repairing and non-repairing modes differ in how names are
handled.
- Specified by:
writeTypedAttribute
in class StreamWriterBase
- Throws:
XMLStreamException
_serializeQName
protected String _serializeQName(QName name)
throws XMLStreamException
- Specified by:
_serializeQName
in class StreamWriterBase
- Throws:
XMLStreamException
_generateAttrName
protected WName _generateAttrName(String suggPrefix,
String localName,
String uri)
throws XMLStreamException
- Parameters:
uri
- Non-empty namespace URI that will be used for the
attribute
- Throws:
XMLStreamException
_writeStartOrEmpty
public void _writeStartOrEmpty(String prefix,
String localName,
String nsURI,
boolean isEmpty)
throws XMLStreamException
- Throws:
XMLStreamException
_generateElemPrefix
protected final String _generateElemPrefix(String uri)
throws XMLStreamException
- Method called if given URI is not yet bound, and no suggested prefix
is given (or one given can't be used). If so, methods is
to create a not-yet-bound-prefix for the namespace.
- Throws:
XMLStreamException
Copyright © 2012 Fasterxml.com. All Rights Reserved.