Class XmlOutputAbstractImpl
java.lang.Object
com.sun.xml.bind.v2.runtime.output.XmlOutputAbstractImpl
- All Implemented Interfaces:
XmlOutput
- Direct Known Subclasses:
ForkXmlOutput
,MTOMXmlOutput
,SAXOutput
,UTF8XmlOutput
,XMLEventWriterOutput
,XMLStreamWriterOutput
Abstract implementation of
XmlOutput
Implements the optimal methods, where defer to
the non-optimal methods.- Author:
- Kohsuke Kawaguchi
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected NamespaceContextImpl
Set by the marshaller before the start tag is written for the root element.protected int[]
The conversion table from the namespace URI index to prefix index.protected XMLSerializer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
void
abstract void
beginStartTag
(int prefix, String localName) void
beginStartTag
(Name name) Writes a start tag.void
endDocument
(boolean fragment) Called at the very end.abstract void
abstract void
void
void
startDocument
(XMLSerializer serializer, boolean fragment, int[] nsUriIndex2prefixIndex, NamespaceContextImpl nsContext) Called at the very beginning.
-
Field Details
-
nsUriIndex2prefixIndex
protected int[] nsUriIndex2prefixIndexThe conversion table from the namespace URI index to prefix index. This array is shared withXMLSerializer
and is updated by it automatically. This allowsName.nsUriIndex
to be converted to prefix index (forNamespaceContextImpl
) quickly. -
nsContext
Set by the marshaller before the start tag is written for the root element. -
serializer
-
-
Constructor Details
-
XmlOutputAbstractImpl
public XmlOutputAbstractImpl()
-
-
Method Details
-
startDocument
public void startDocument(XMLSerializer serializer, boolean fragment, int[] nsUriIndex2prefixIndex, NamespaceContextImpl nsContext) throws IOException, SAXException, XMLStreamException Called at the very beginning.- Specified by:
startDocument
in interfaceXmlOutput
- Parameters:
serializer
- theXMLSerializer
that coordinates this whole marshalling episode.fragment
- true if we are marshalling a fragment.- Throws:
IOException
SAXException
XMLStreamException
-
endDocument
Called at the very end.- Specified by:
endDocument
in interfaceXmlOutput
- Parameters:
fragment
- false if we are writing the whole document.- Throws:
IOException
SAXException
XMLStreamException
-
beginStartTag
Writes a start tag.At this point
nsContext
holds namespace declarations needed for this new element.This method is used for writing tags that are indexed.
- Specified by:
beginStartTag
in interfaceXmlOutput
- Throws:
IOException
XMLStreamException
-
beginStartTag
public abstract void beginStartTag(int prefix, String localName) throws IOException, XMLStreamException - Specified by:
beginStartTag
in interfaceXmlOutput
- Throws:
IOException
XMLStreamException
-
attribute
- Specified by:
attribute
in interfaceXmlOutput
- Throws:
IOException
XMLStreamException
-
attribute
public abstract void attribute(int prefix, String localName, String value) throws IOException, XMLStreamException - Specified by:
attribute
in interfaceXmlOutput
- Parameters:
prefix
- -1 if this attribute does not have a prefix (this handling differs from that of elements.)- Throws:
IOException
XMLStreamException
-
endStartTag
- Specified by:
endStartTag
in interfaceXmlOutput
- Throws:
IOException
SAXException
-
endTag
- Specified by:
endTag
in interfaceXmlOutput
- Throws:
IOException
SAXException
XMLStreamException
-
endTag
public abstract void endTag(int prefix, String localName) throws IOException, SAXException, XMLStreamException - Specified by:
endTag
in interfaceXmlOutput
- Throws:
IOException
SAXException
XMLStreamException
-