XMLStreamWriter, that does
namespace repairing, ie resolves possible conflicts between prefixes
(add new bindings as necessary), as well as automatically creates
namespace declarations as necessary.
| Modifier and Type | Field and Description |
|---|---|
| protected final String | |
| protected int[] | mAutoNsSeq
Sequence number used for generating dynamic namespace prefixes. |
| protected String | |
| protected HashMap | mSuggestedPrefixes
Map that contains URI-to-prefix entries that point out suggested prefixes for URIs. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final void | copyStartElement(InputElementStack elemStack, AttributeCollector ac)
Implements abstract com. Element copier method implementation suitable for use with namespace-aware writers in repairing mode. |
| public void | doSetPrefix(String prefix, String uri)
Implements abstract com.
|
| protected final String | findElemPrefix(String
URI of namespace for which we need a prefix nsURI, SimpleOutputElement elem)Method called to find an existing prefix for the given namespace, if any exists in the scope. |
| protected final String | findOrCreateAttrPrefix(String
Suggested prefix to bind, if any; may be null
to indicate "no preference" suggPrefix, String URI of namespace for which we need a prefix nsURI, SimpleOutputElement Currently open start element, on which the attribute
will be added. elem)Method called to somehow find a prefix for given namespace, to be used for a new start element; either use an existing one, or generate a new one. |
| protected final String | generateElemPrefix(String suggPrefix, String nsURI, SimpleOutputElement elem)
Method called after |
| public void | setDefaultNamespace(String
the uri to bind to the default namespace, may be null uri)Implements abstract com. Implements javax. With repairing writer, this is only taken as a suggestion as to how the caller would prefer prefixes to be mapped. |
| private final String | |
| public String | validateQNamePrefix(QName name)
Implements abstract com. 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. Implements javax. 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. Implements javax. Writes an attribute to the output stream |
| public void | writeDefaultNamespace(String
the uri to bind the default namespace to nsURI)Implements abstract com. Implements javax. 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. Implements javax. 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. Convenience method needed by |
| protected void | writeStartOrEmpty(String localName, String nsURI)
Implements abstract com.
|
| protected void | writeStartOrEmpty(String suggPrefix, String localName, String nsURI)
Implements abstract com.
|
| protected void | writeTypedAttribute(String prefix, String nsURI, String localName, AsciiValueEncoder enc)
Overrides com. Method that will write attribute with value that is known not to require additional escaping. |
| mAutomaticNsPrefix | back to summary |
|---|---|
| protected final String mAutomaticNsPrefix | |
| mAutoNsSeq | back to summary |
|---|---|
| protected int[] mAutoNsSeq Sequence number used for generating dynamic namespace prefixes. Array used as a wrapper to allow for easy sharing of the sequence number. | |
| mSuggestedDefNs | back to summary |
|---|---|
| protected String mSuggestedDefNs | |
| mSuggestedPrefixes | back to summary |
|---|---|
| protected HashMap<String, String> mSuggestedPrefixes Map that contains URI-to-prefix entries that point out suggested
prefixes for URIs. These are populated by calls to
| |
| RepairingNsStreamWriter | back to summary |
|---|---|
| public RepairingNsStreamWriter(XmlWriter xw, String enc, WriterConfig cfg) | |
| copyStartElement | back to summary |
|---|---|
| public final void copyStartElement(InputElementStack elemStack, AttributeCollector ac) throws IOException, XMLStreamException Implements abstract com. Element copier method implementation suitable for use with
namespace-aware writers in repairing mode.
The trickiest thing is having to properly
order calls to
| |
| doSetPrefix | back to summary |
|---|---|
| public void doSetPrefix(String prefix, String uri) throws XMLStreamException Implements abstract com.
| |
| findElemPrefix | back to summary |
|---|---|
| protected final String findElemPrefix(String nsURI, SimpleOutputElement elem) throws XMLStreamException Method called to find an existing prefix for the given namespace, if any exists in the scope. If one is found, it's returned (including "" for the current default namespace); if not, null is returned.
| |
| findOrCreateAttrPrefix | back to summary |
|---|---|
| protected final String findOrCreateAttrPrefix(String suggPrefix, String nsURI, SimpleOutputElement elem) throws XMLStreamException Method called to somehow find a prefix for given namespace, to be used for a new start element; either use an existing one, or generate a new one. If a new mapping needs to be generated, it will also be automatically bound, and necessary namespace declaration output.
| |
| generateElemPrefix | back to summary |
|---|---|
| protected final String generateElemPrefix(String suggPrefix, String nsURI, SimpleOutputElement elem) throws XMLStreamException Method called after | |
| setDefaultNamespace | back to summary |
|---|---|
| public void setDefaultNamespace(String uri) throws XMLStreamException Implements abstract com. Implements javax. With repairing writer, this is only taken as a suggestion as to how the caller would prefer prefixes to be mapped.
| |
| validateElemPrefix | back to summary |
|---|---|
| private final String validateElemPrefix(String prefix, String nsURI, SimpleOutputElement elem) throws XMLStreamException | |
| validateQNamePrefix | back to summary |
|---|---|
| public String validateQNamePrefix(QName name) throws XMLStreamException Implements abstract com. Doc from com. 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 | |
| writeAttribute | back to summary |
|---|---|
| public void writeAttribute(String nsURI, String localName, String value) throws XMLStreamException Implements abstract com. Implements javax. Doc from javax. Writes an attribute to the output stream
| |
| writeAttribute | back to summary |
|---|---|
| public void writeAttribute(String prefix, String nsURI, String localName, String value) throws XMLStreamException Implements abstract com. Implements javax. Doc from javax. Writes an attribute to the output stream
| |
| writeDefaultNamespace | back to summary |
|---|---|
| public void writeDefaultNamespace(String nsURI) throws XMLStreamException Implements abstract com. Implements javax. Doc from javax. Writes the default namespace to the stream
| |
| writeNamespace | back to summary |
|---|---|
| public void writeNamespace(String prefix, String nsURI) throws XMLStreamException Implements abstract com. Implements javax. Doc from javax. 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
| |
| writeStartElement | back to summary |
|---|---|
| public void writeStartElement(StartElement elem) throws XMLStreamException Implements abstract com. Doc from com. Convenience method needed by
| |
| writeStartOrEmpty | back to summary |
|---|---|
| protected void writeStartOrEmpty(String localName, String nsURI) throws XMLStreamException Implements abstract com.
| |
| writeStartOrEmpty | back to summary |
|---|---|
| protected void writeStartOrEmpty(String suggPrefix, String localName, String nsURI) throws XMLStreamException Implements abstract com.
| |
| writeTypedAttribute | back to summary |
|---|---|
| protected void writeTypedAttribute(String prefix, String nsURI, String localName, AsciiValueEncoder enc) throws XMLStreamException Overrides com. Doc from com. Method that will write attribute with value that is known not to require additional escaping.
| |