Package com.ctc.wstx.sw
Class SimpleNsStreamWriter
- java.lang.Object
-
- org.codehaus.stax2.ri.Stax2WriterImpl
-
- com.ctc.wstx.sw.BaseStreamWriter
-
- com.ctc.wstx.sw.TypedStreamWriter
-
- com.ctc.wstx.sw.BaseNsStreamWriter
-
- com.ctc.wstx.sw.SimpleNsStreamWriter
-
- All Implemented Interfaces:
OutputConfigFlags
,javax.xml.stream.XMLStreamConstants
,javax.xml.stream.XMLStreamWriter
,org.codehaus.stax2.typed.TypedXMLStreamWriter
,org.codehaus.stax2.validation.Validatable
,org.codehaus.stax2.validation.ValidationContext
,org.codehaus.stax2.XMLStreamWriter2
public class SimpleNsStreamWriter extends BaseNsStreamWriter
Namespace-aware implementation ofXMLStreamWriter
, that does not do namespace repairing, ie doesn't try to resolve possible conflicts between prefixes and namespace URIs, or automatically create namespace bindings.
-
-
Field Summary
-
Fields inherited from class com.ctc.wstx.sw.BaseNsStreamWriter
ERR_NSDECL_WRONG_STATE, mAutomaticNS, MAX_POOL_SIZE, mCurrElem, mEmptyElementHandler, mOutputElemPool, mPoolSize, mRootNsContext, sPrefixXml, sPrefixXmlns
-
Fields inherited from class com.ctc.wstx.sw.TypedStreamWriter
mValueEncoderFactory
-
Fields inherited from class com.ctc.wstx.sw.BaseStreamWriter
ATTR_MIN_ARRAYCOPY, CHAR_SPACE, DEFAULT_COPYBUFFER_LEN, mAnyOutput, mCfgAutomaticEmptyElems, mCfgCDataAsText, mCfgCopyDefaultAttrs, mCheckAttrs, mCheckStructure, mConfig, mCopyBuffer, mDtdRootElem, mEmptyElement, mEncoding, MIN_ARRAYCOPY, mReturnNullForDefaultNamespace, mStartElementOpen, mState, mValidator, mVldContent, mVldProbHandler, mWriter, mXml11, STATE_EPILOG, STATE_PROLOG, STATE_TREE
-
Fields inherited from interface com.ctc.wstx.cfg.OutputConfigFlags
CFG_ADD_SPACE_AFTER_EMPTY_ELEM, CFG_AUTO_CLOSE_OUTPUT, CFG_AUTOMATIC_EMPTY_ELEMENTS, CFG_AUTOMATIC_END_ELEMENTS, CFG_AUTOMATIC_NS, CFG_COPY_DEFAULT_ATTRS, CFG_ENABLE_NS, CFG_ESCAPE_CR, CFG_FIX_CONTENT, CFG_OUTPUT_CDATA_AS_TEXT, CFG_USE_DOUBLE_QUOTES_IN_XML_DECL, CFG_VALIDATE_ATTR, CFG_VALIDATE_CONTENT, CFG_VALIDATE_NAMES, CFG_VALIDATE_STRUCTURE
-
-
Constructor Summary
Constructors Constructor Description SimpleNsStreamWriter(XmlWriter xw, java.lang.String enc, WriterConfig cfg)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copyStartElement(InputElementStack elemStack, AttributeCollector attrCollector)
Element copier method implementation suitable to be used with namespace-aware writers in non-repairing (explicit namespaces) mode.void
doSetPrefix(java.lang.String prefix, java.lang.String uri)
void
setDefaultNamespace(java.lang.String uri)
java.lang.String
validateQNamePrefix(javax.xml.namespace.QName name)
Method called before writing a QName via Typed Access API.void
writeAttribute(java.lang.String nsURI, java.lang.String localName, java.lang.String value)
void
writeAttribute(java.lang.String prefix, java.lang.String nsURI, java.lang.String localName, java.lang.String value)
void
writeDefaultNamespace(java.lang.String nsURI)
void
writeNamespace(java.lang.String prefix, java.lang.String nsURI)
void
writeStartElement(javax.xml.stream.events.StartElement elem)
Convenience method needed byXMLEventWriter
implementation, to use when writing a start element, and possibly its attributes and namespace declarations.protected void
writeStartOrEmpty(java.lang.String localName, java.lang.String nsURI)
protected void
writeStartOrEmpty(java.lang.String prefix, java.lang.String localName, java.lang.String nsURI)
-
Methods inherited from class com.ctc.wstx.sw.BaseNsStreamWriter
checkStartElement, closeStartElement, doWriteAttr, doWriteAttr, doWriteDefaultNs, doWriteEndTag, doWriteNamespace, doWriteStartTag, doWriteStartTag, getCurrentElementName, getNamespaceContext, getNamespaceURI, getPrefix, getTopElementDesc, setNamespaceContext, setPrefix, writeAttribute, writeEmptyElement, writeEmptyElement, writeEmptyElement, writeEndElement, writeEndElement, writeFullEndElement, writeStartElement, writeStartElement, writeStartElement, writeTypedAttribute
-
Methods inherited from class com.ctc.wstx.sw.TypedStreamWriter
valueEncoderFactory, 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, writeTypedElement
-
Methods inherited from class com.ctc.wstx.sw.BaseStreamWriter
addDefaultAttribute, close, closeCompletely, copyEventFromReader, doReportProblem, doReportProblem, doWriteStartDocument, findAttributeIndex, flush, getAttributeCount, getAttributeLocalName, getAttributeNamespace, getAttributePrefix, getAttributeType, getAttributeValue, getAttributeValue, getBaseUri, getCopyBuffer, getCopyBuffer, getEncoding, getLocation, getProperty, getValidationLocation, getXmlVersion, inPrologOrEpilog, isNotationDeclared, isPropertySupported, isUnparsedEntityDeclared, isValidating, reportIllegalArg, reportIllegalMethod, reportInvalidContent, reportNwfAttr, reportNwfAttr, reportNwfContent, reportNwfContent, reportNwfStructure, reportNwfStructure, reportProblem, reportValidationProblem, reportValidationProblem, reportValidationProblem, reportValidationProblem, reportValidationProblem, reportValidationProblem, setProperty, setValidationProblemHandler, stopValidatingAgainst, stopValidatingAgainst, throwFromIOE, throwOutputError, throwOutputError, toString, validateAgainst, verifyRootElement, verifyWriteCData, verifyWriteDTD, wrapAsRawWriter, wrapAsTextWriter, writeCData, writeCData, writeCharacters, writeCharacters, writeCharacters, writeComment, writeDTD, writeDTD, writeDTD, writeEndDocument, writeEntityRef, writeProcessingInstruction, writeProcessingInstruction, writeRaw, writeRaw, writeRaw, writeSpace, writeSpace, writeStartDocument, writeStartDocument, writeStartDocument, writeStartDocument
-
-
-
-
Constructor Detail
-
SimpleNsStreamWriter
public SimpleNsStreamWriter(XmlWriter xw, java.lang.String enc, WriterConfig cfg)
-
-
Method Detail
-
writeAttribute
public void writeAttribute(java.lang.String nsURI, java.lang.String localName, java.lang.String value) throws javax.xml.stream.XMLStreamException
- Specified by:
writeAttribute
in interfacejavax.xml.stream.XMLStreamWriter
- Specified by:
writeAttribute
in classBaseNsStreamWriter
- Throws:
javax.xml.stream.XMLStreamException
-
writeAttribute
public void writeAttribute(java.lang.String prefix, java.lang.String nsURI, java.lang.String localName, java.lang.String value) throws javax.xml.stream.XMLStreamException
- Specified by:
writeAttribute
in interfacejavax.xml.stream.XMLStreamWriter
- Specified by:
writeAttribute
in classBaseNsStreamWriter
- Throws:
javax.xml.stream.XMLStreamException
-
writeDefaultNamespace
public void writeDefaultNamespace(java.lang.String nsURI) throws javax.xml.stream.XMLStreamException
- Specified by:
writeDefaultNamespace
in interfacejavax.xml.stream.XMLStreamWriter
- Specified by:
writeDefaultNamespace
in classBaseNsStreamWriter
- Throws:
javax.xml.stream.XMLStreamException
-
writeNamespace
public void writeNamespace(java.lang.String prefix, java.lang.String nsURI) throws javax.xml.stream.XMLStreamException
- Specified by:
writeNamespace
in interfacejavax.xml.stream.XMLStreamWriter
- Specified by:
writeNamespace
in classBaseNsStreamWriter
- Throws:
javax.xml.stream.XMLStreamException
-
setDefaultNamespace
public void setDefaultNamespace(java.lang.String uri) throws javax.xml.stream.XMLStreamException
- Specified by:
setDefaultNamespace
in interfacejavax.xml.stream.XMLStreamWriter
- Specified by:
setDefaultNamespace
in classBaseNsStreamWriter
- Throws:
javax.xml.stream.XMLStreamException
-
doSetPrefix
public void doSetPrefix(java.lang.String prefix, java.lang.String uri) throws javax.xml.stream.XMLStreamException
- Specified by:
doSetPrefix
in classBaseNsStreamWriter
- Throws:
javax.xml.stream.XMLStreamException
-
writeStartElement
public void writeStartElement(javax.xml.stream.events.StartElement elem) throws javax.xml.stream.XMLStreamException
Description copied from class:BaseStreamWriter
Convenience method needed byXMLEventWriter
implementation, to use when writing a start element, and possibly its attributes and namespace declarations.- Specified by:
writeStartElement
in classBaseNsStreamWriter
- Throws:
javax.xml.stream.XMLStreamException
-
writeStartOrEmpty
protected void writeStartOrEmpty(java.lang.String localName, java.lang.String nsURI) throws javax.xml.stream.XMLStreamException
- Specified by:
writeStartOrEmpty
in classBaseNsStreamWriter
- Throws:
javax.xml.stream.XMLStreamException
-
writeStartOrEmpty
protected void writeStartOrEmpty(java.lang.String prefix, java.lang.String localName, java.lang.String nsURI) throws javax.xml.stream.XMLStreamException
- Specified by:
writeStartOrEmpty
in classBaseNsStreamWriter
- Throws:
javax.xml.stream.XMLStreamException
-
copyStartElement
public final void copyStartElement(InputElementStack elemStack, AttributeCollector attrCollector) throws java.io.IOException, javax.xml.stream.XMLStreamException
Element copier method implementation suitable to be used with namespace-aware writers in non-repairing (explicit namespaces) mode. The trickiest thing is having to properly order calls tosetPrefix
,writeNamespace
andwriteStartElement
; the order writers expect is bit different from the order in which element information is passed in.- Specified by:
copyStartElement
in classBaseStreamWriter
- Throws:
java.io.IOException
javax.xml.stream.XMLStreamException
-
validateQNamePrefix
public java.lang.String validateQNamePrefix(javax.xml.namespace.QName name)
Description copied from class:BaseStreamWriter
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- Specified by:
validateQNamePrefix
in classBaseStreamWriter
- Returns:
- Prefix to use when writing out given QName as an element or attribute value
-
-