Module com.sun.xml.bind
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 ofXmlOutputImplements the optimal methods, where defer to the non-optimal methods.- Author:
- Kohsuke Kawaguchi
-
-
Field Summary
Fields Modifier and Type Field Description protected NamespaceContextImplnsContextSet by the marshaller before the start tag is written for the root element.protected int[]nsUriIndex2prefixIndexThe conversion table from the namespace URI index to prefix index.protected XMLSerializerserializer
-
Constructor Summary
Constructors Constructor Description XmlOutputAbstractImpl()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidattribute(int prefix, String localName, String value)voidattribute(Name name, String value)abstract voidbeginStartTag(int prefix, String localName)voidbeginStartTag(Name name)Writes a start tag.voidendDocument(boolean fragment)Called at the very end.abstract voidendStartTag()abstract voidendTag(int prefix, String localName)voidendTag(Name name)voidstartDocument(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 withXMLSerializerand is updated by it automatically. This allowsName.nsUriIndexto 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:
startDocumentin interfaceXmlOutput- Parameters:
serializer- theXMLSerializerthat coordinates this whole marshalling episode.fragment- true if we are marshalling a fragment.- Throws:
IOExceptionSAXExceptionXMLStreamException
-
endDocument
public void endDocument(boolean fragment) throws IOException, SAXException, XMLStreamExceptionCalled at the very end.- Specified by:
endDocumentin interfaceXmlOutput- Parameters:
fragment- false if we are writing the whole document.- Throws:
IOExceptionSAXExceptionXMLStreamException
-
beginStartTag
public void beginStartTag(Name name) throws IOException, XMLStreamException
Writes a start tag.At this point
nsContextholds namespace declarations needed for this new element.This method is used for writing tags that are indexed.
- Specified by:
beginStartTagin interfaceXmlOutput- Throws:
IOExceptionXMLStreamException
-
beginStartTag
public abstract void beginStartTag(int prefix, String localName) throws IOException, XMLStreamException- Specified by:
beginStartTagin interfaceXmlOutput- Throws:
IOExceptionXMLStreamException
-
attribute
public void attribute(Name name, String value) throws IOException, XMLStreamException
- Specified by:
attributein interfaceXmlOutput- Throws:
IOExceptionXMLStreamException
-
attribute
public abstract void attribute(int prefix, String localName, String value) throws IOException, XMLStreamException- Specified by:
attributein interfaceXmlOutput- Parameters:
prefix- -1 if this attribute does not have a prefix (this handling differs from that of elements.)- Throws:
IOExceptionXMLStreamException
-
endStartTag
public abstract void endStartTag() throws IOException, SAXException- Specified by:
endStartTagin interfaceXmlOutput- Throws:
IOExceptionSAXException
-
endTag
public void endTag(Name name) throws IOException, SAXException, XMLStreamException
- Specified by:
endTagin interfaceXmlOutput- Throws:
IOExceptionSAXExceptionXMLStreamException
-
endTag
public abstract void endTag(int prefix, String localName) throws IOException, SAXException, XMLStreamException- Specified by:
endTagin interfaceXmlOutput- Throws:
IOExceptionSAXExceptionXMLStreamException
-
-