Module com.sun.xml.bind.osgi
Class XmlOutputAbstractImpl
- java.lang.Object
-
- org.glassfish.jaxb.runtime.v2.runtime.output.XmlOutputAbstractImpl
-
- All Implemented Interfaces:
XmlOutput
- Direct Known Subclasses:
ForkXmlOutput
,MTOMXmlOutput
,SAXOutput
,UTF8XmlOutput
,XMLEventWriterOutput
,XMLStreamWriterOutput
public abstract class XmlOutputAbstractImpl extends Object implements XmlOutput
Abstract implementation ofXmlOutput
Implements the optimal methods, where defer to the non-optimal methods.- Author:
- Kohsuke Kawaguchi
-
-
Field Summary
Fields Modifier and Type Field Description protected NamespaceContextImpl
nsContext
Set by the marshaller before the start tag is written for the root element.protected int[]
nsUriIndex2prefixIndex
The conversion table from the namespace URI index to prefix index.protected XMLSerializer
serializer
-
Constructor Summary
Constructors Modifier Constructor Description protected
XmlOutputAbstractImpl()
Default constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
attribute(int prefix, String localName, String value)
void
attribute(Name name, String value)
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
endStartTag()
abstract void
endTag(int prefix, String localName)
void
endTag(Name name)
void
startDocument(XMLSerializer serializer, boolean fragment, int[] nsUriIndex2prefixIndex, NamespaceContextImpl nsContext)
Called at the very beginning.
-
-
-
Field Detail
-
nsUriIndex2prefixIndex
protected int[] nsUriIndex2prefixIndex
The 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
protected NamespaceContextImpl nsContext
Set by the marshaller before the start tag is written for the root element.
-
serializer
protected XMLSerializer serializer
-
-
Method Detail
-
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
public void endDocument(boolean fragment) throws IOException, SAXException, XMLStreamException
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
public void beginStartTag(Name name) throws IOException, XMLStreamException
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
public void attribute(Name name, String value) throws IOException, XMLStreamException
- 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
public abstract void endStartTag() throws IOException, SAXException
- Specified by:
endStartTag
in interfaceXmlOutput
- Throws:
IOException
SAXException
-
endTag
public void endTag(Name name) throws IOException, SAXException, XMLStreamException
- 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
-
-