Top Description Fields Constructors Methods
com.ctc.wstx.sw

public Class SimpleNsStreamWriter

extends BaseNsStreamWriter
Class Inheritance
Imports
java.io.IOException, java.util.Iterator, javax.xml.XMLConstants, javax.xml.namespace.QName, javax.xml.stream.XMLStreamWriter, .XMLStreamException, javax.xml.stream.events.Attribute, .Namespace, .StartElement, com.ctc.wstx.api.WriterConfig, com.ctc.wstx.cfg.ErrorConsts, com.ctc.wstx.sr.AttributeCollector, .InputElementStack

Namespace-aware implementation of XMLStreamWriter, 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

Inherited from com.ctc.wstx.sw.BaseNsStreamWriter:
ERR_NSDECL_WRONG_STATEmAutomaticNSMAX_POOL_SIZEmCurrElemmEmptyElementHandlermOutputElemPoolmPoolSizemRootNsContextsPrefixXmlsPrefixXmlns

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final void
copyStartElement(InputElementStack elemStack, AttributeCollector attrCollector)

Implements abstract com.ctc.wstx.sw.BaseStreamWriter.copyStartElement.

Element copier method implementation suitable to be used with namespace-aware writers in non-repairing (explicit namespaces) mode.

public void
public void
setDefaultNamespace(String
the uri to bind to the default namespace, may be null
uri
)

Implements abstract com.ctc.wstx.sw.BaseNsStreamWriter.setDefaultNamespace.

Implements javax.xml.stream.XMLStreamWriter.setDefaultNamespace.

Binds a URI to the default namespace This URI is bound in the scope of the current START_ELEMENT / END_ELEMENT pair.

public String
validateQNamePrefix(QName name)

Implements abstract com.ctc.wstx.sw.BaseStreamWriter.validateQNamePrefix.

Method called before writing a QName via Typed Access API.

public void
writeAttribute(String
the uri of the prefix for this attribute
nsURI
,
String
the local name of the attribute
localName
,
String
the value of the attribute
value
)

Implements abstract com.ctc.wstx.sw.BaseNsStreamWriter.writeAttribute.

Implements javax.xml.stream.XMLStreamWriter.writeAttribute.

Writes an attribute to the output stream

public void
writeAttribute(String
the prefix for this attribute
prefix
,
String
the uri of the prefix for this attribute
nsURI
,
String
the local name of the attribute
localName
,
String
the value of the attribute
value
)

Implements abstract com.ctc.wstx.sw.BaseNsStreamWriter.writeAttribute.

Implements javax.xml.stream.XMLStreamWriter.writeAttribute.

Writes an attribute to the output stream

public void
writeDefaultNamespace(String
the uri to bind the default namespace to
nsURI
)

Implements abstract com.ctc.wstx.sw.BaseNsStreamWriter.writeDefaultNamespace.

Implements javax.xml.stream.XMLStreamWriter.writeDefaultNamespace.

Writes the default namespace to the stream

public void
writeNamespace(String
the prefix to bind this namespace to
prefix
,
String
the uri to bind the prefix to
nsURI
)

Implements abstract com.ctc.wstx.sw.BaseNsStreamWriter.writeNamespace.

Implements javax.xml.stream.XMLStreamWriter.writeNamespace.

Writes a namespace to the output stream If the prefix argument to this method is the empty string, "xmlns", or null this method will delegate to writeDefaultNamespace

public void
writeStartElement(StartElement elem)

Implements abstract com.ctc.wstx.sw.BaseNsStreamWriter.writeStartElement.

Convenience method needed by javax.xml.stream.XMLEventWriter implementation, to use when writing a start element, and possibly its attributes and namespace declarations.

protected void
protected void
Inherited from com.ctc.wstx.sw.BaseNsStreamWriter:
checkStartElementcloseStartElementdoWriteAttrdoWriteAttrdoWriteDefaultNsdoWriteEndTagdoWriteNamespacedoWriteStartTagdoWriteStartTaggetCurrentElementNamegetNamespaceContextgetNamespaceURIgetPrefixgetTopElementDescsetNamespaceContextsetPrefixwriteAttributewriteEmptyElementwriteEmptyElementwriteEmptyElementwriteEndElementwriteEndElementwriteFullEndElementwriteStartElementwriteStartElementwriteStartElementwriteTypedAttribute

Constructor Detail

SimpleNsStreamWriterback to summary
public SimpleNsStreamWriter(XmlWriter xw, String enc, WriterConfig cfg)

Method Detail

copyStartElementback to summary
public final void copyStartElement(InputElementStack elemStack, AttributeCollector attrCollector) throws IOException, XMLStreamException

Implements abstract com.ctc.wstx.sw.BaseStreamWriter.copyStartElement.

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 to setPrefix, writeNamespace and writeStartElement; the order writers expect is bit different from the order in which element information is passed in.

Annotations
@Override
doSetPrefixback to summary
public void doSetPrefix(String prefix, String uri) throws XMLStreamException

Implements abstract com.ctc.wstx.sw.BaseNsStreamWriter.doSetPrefix.

Annotations
@Override
setDefaultNamespaceback to summary
public void setDefaultNamespace(String uri) throws XMLStreamException

Implements abstract com.ctc.wstx.sw.BaseNsStreamWriter.setDefaultNamespace.

Implements javax.xml.stream.XMLStreamWriter.setDefaultNamespace.

Doc from javax.xml.stream.XMLStreamWriter.setDefaultNamespace.

Binds a URI to the default namespace This URI is bound in the scope of the current START_ELEMENT / END_ELEMENT pair. If this method is called before a START_ELEMENT has been written the uri is bound in the root scope.

Parameters
uri:String

the uri to bind to the default namespace, may be null

Annotations
@Override
Exceptions
XMLStreamException:
if an error occurs
validateQNamePrefixback to summary
public String validateQNamePrefix(QName name)

Implements abstract com.ctc.wstx.sw.BaseStreamWriter.validateQNamePrefix.

Doc from com.ctc.wstx.sw.BaseStreamWriter.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:String

Prefix to use when writing out given QName as an element or attribute value

Annotations
@Override
writeAttributeback to summary
public void writeAttribute(String nsURI, String localName, String value) throws XMLStreamException

Implements abstract com.ctc.wstx.sw.BaseNsStreamWriter.writeAttribute.

Implements javax.xml.stream.XMLStreamWriter.writeAttribute.

Doc from javax.xml.stream.XMLStreamWriter.writeAttribute.

Writes an attribute to the output stream

Parameters
nsURI:String

the uri of the prefix for this attribute

localName:String

the local name of the attribute

value:String

the value of the attribute

Annotations
@Override
Exceptions
XMLStreamException:
if the namespace URI has not been bound to a prefix and javax.xml.stream.isRepairingNamespaces has not been set to true
writeAttributeback to summary
public void writeAttribute(String prefix, String nsURI, String localName, String value) throws XMLStreamException

Implements abstract com.ctc.wstx.sw.BaseNsStreamWriter.writeAttribute.

Implements javax.xml.stream.XMLStreamWriter.writeAttribute.

Doc from javax.xml.stream.XMLStreamWriter.writeAttribute.

Writes an attribute to the output stream

Parameters
prefix:String

the prefix for this attribute

nsURI:String

the uri of the prefix for this attribute

localName:String

the local name of the attribute

value:String

the value of the attribute

Annotations
@Override
Exceptions
XMLStreamException:
if the namespace URI has not been bound to a prefix and javax.xml.stream.isRepairingNamespaces has not been set to true
writeDefaultNamespaceback to summary
public void writeDefaultNamespace(String nsURI) throws XMLStreamException

Implements abstract com.ctc.wstx.sw.BaseNsStreamWriter.writeDefaultNamespace.

Implements javax.xml.stream.XMLStreamWriter.writeDefaultNamespace.

Doc from javax.xml.stream.XMLStreamWriter.writeDefaultNamespace.

Writes the default namespace to the stream

Parameters
nsURI:String

the uri to bind the default namespace to

Annotations
@Override
Exceptions
XMLStreamException:
if an error occurs
writeNamespaceback to summary
public void writeNamespace(String prefix, String nsURI) throws XMLStreamException

Implements abstract com.ctc.wstx.sw.BaseNsStreamWriter.writeNamespace.

Implements javax.xml.stream.XMLStreamWriter.writeNamespace.

Doc from javax.xml.stream.XMLStreamWriter.writeNamespace.

Writes a namespace to the output stream If the prefix argument to this method is the empty string, "xmlns", or null this method will delegate to writeDefaultNamespace

Parameters
prefix:String

the prefix to bind this namespace to

nsURI:String

the uri to bind the prefix to

Annotations
@Override
Exceptions
XMLStreamException:
if an error occurs
writeStartElementback to summary
public void writeStartElement(StartElement elem) throws XMLStreamException

Implements abstract com.ctc.wstx.sw.BaseNsStreamWriter.writeStartElement.

Doc from com.ctc.wstx.sw.BaseStreamWriter.writeStartElement.

Convenience method needed by javax.xml.stream.XMLEventWriter implementation, to use when writing a start element, and possibly its attributes and namespace declarations.

Annotations
@Override
writeStartOrEmptyback to summary
protected void writeStartOrEmpty(String localName, String nsURI) throws XMLStreamException

Implements abstract com.ctc.wstx.sw.BaseNsStreamWriter.writeStartOrEmpty.

Annotations
@Override
writeStartOrEmptyback to summary
protected void writeStartOrEmpty(String prefix, String localName, String nsURI) throws XMLStreamException

Implements abstract com.ctc.wstx.sw.BaseNsStreamWriter.writeStartOrEmpty.

Annotations
@Override