public abstract class AbstractXMLStreamWriter<T> extends Object implements XMLStreamWriter
Constructor and Description |
---|
AbstractXMLStreamWriter(T rootInfo,
boolean repaireNamespaces)
Create writer instance.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
NamespaceContext |
getNamespaceContext() |
String |
getPrefix(String namespaceURI) |
Object |
getProperty(String name) |
protected XMLStreamWriterScope<T> |
getScope() |
protected boolean |
isStartDocumentWritten() |
void |
setDefaultNamespace(String namespaceURI) |
void |
setNamespaceContext(NamespaceContext context) |
void |
setPrefix(String prefix,
String namespaceURI) |
protected abstract void |
writeAttr(String prefix,
String localName,
String namespaceURI,
String value)
Write attribute.
|
void |
writeAttribute(String localName,
String value) |
void |
writeAttribute(String namespaceURI,
String localName,
String value) |
void |
writeAttribute(String prefix,
String namespaceURI,
String localName,
String value) |
void |
writeCData(String data) |
void |
writeCharacters(char[] text,
int start,
int length) |
protected void |
writeCharacters(Object data,
int type) |
void |
writeCharacters(String text) |
void |
writeComment(String data) |
protected abstract void |
writeData(Object data,
int type)
Write characters/comment/dtd/entity data.
|
void |
writeDefaultNamespace(String namespaceURI) |
void |
writeDTD(String dtd) |
void |
writeEmptyElement(String localName) |
void |
writeEmptyElement(String namespaceURI,
String localName) |
void |
writeEmptyElement(String prefix,
String localName,
String namespaceURI) |
void |
writeEndDocument() |
void |
writeEndElement() |
protected abstract void |
writeEndElementTag()
Write end element tag.
|
void |
writeEntityRef(String name) |
void |
writeNamespace(String prefix,
String namespaceURI) |
protected abstract void |
writeNsDecl(String prefix,
String namespaceURI)
Write namespace declaration.
|
protected abstract void |
writePI(String target,
String data)
Read processing instruction.
|
void |
writeProcessingInstruction(String target) |
void |
writeProcessingInstruction(String target,
String data) |
void |
writeStartDocument() |
void |
writeStartDocument(String version) |
void |
writeStartDocument(String encoding,
String version) |
void |
writeStartElement(String localName) |
void |
writeStartElement(String namespaceURI,
String localName) |
void |
writeStartElement(String prefix,
String localName,
String namespaceURI) |
protected abstract T |
writeStartElementTag(String prefix,
String localPart,
String namespaceURI)
Write open start element tag.
|
protected abstract void |
writeStartElementTagEnd()
Write close start element tag.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
flush
public AbstractXMLStreamWriter(T rootInfo, boolean repaireNamespaces)
rootInfo
- root scope informationprotected XMLStreamWriterScope<T> getScope()
protected boolean isStartDocumentWritten()
true
if START_DOCUMENT
event has been writtenprotected abstract T writeStartElementTag(String prefix, String localPart, String namespaceURI) throws XMLStreamException
getScope().getInfo()
.prefix
- element prefix (may be XMLConstants.DEFAULT_NS_PREFIX
)localPart
- local namenamespaceURI
- namespace URIXMLStreamException
protected abstract void writeStartElementTagEnd() throws XMLStreamException
XMLStreamException
protected abstract void writeEndElementTag() throws XMLStreamException
XMLStreamException
protected abstract void writeAttr(String prefix, String localName, String namespaceURI, String value) throws XMLStreamException
prefix
- attribute prefix (may be XMLConstants.DEFAULT_NS_PREFIX
)localName
- local namenamespaceURI
- namespace URIvalue
- attribute valueXMLStreamException
protected abstract void writeNsDecl(String prefix, String namespaceURI) throws XMLStreamException
prefix
- namespace prefixnamespaceURI
- namespace URIXMLStreamException
protected abstract void writeData(Object data, int type) throws XMLStreamException
data
- text/datatype
- one of CHARACTERS, COMMENT, CDATA, DTD, ENTITY_REFERENCE, SPACE
XMLStreamException
protected abstract void writePI(String target, String data) throws XMLStreamException
target
- PI targetdata
- PI data (may be null
)XMLStreamException
public void writeStartElement(String localName) throws XMLStreamException
writeStartElement
in interface XMLStreamWriter
XMLStreamException
public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException
writeStartElement
in interface XMLStreamWriter
XMLStreamException
public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException
writeStartElement
in interface XMLStreamWriter
XMLStreamException
public void writeEndElement() throws XMLStreamException
writeEndElement
in interface XMLStreamWriter
XMLStreamException
public void writeEmptyElement(String localName) throws XMLStreamException
writeEmptyElement
in interface XMLStreamWriter
XMLStreamException
public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException
writeEmptyElement
in interface XMLStreamWriter
XMLStreamException
public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException
writeEmptyElement
in interface XMLStreamWriter
XMLStreamException
public void writeAttribute(String localName, String value) throws XMLStreamException
writeAttribute
in interface XMLStreamWriter
XMLStreamException
public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException
writeAttribute
in interface XMLStreamWriter
XMLStreamException
public void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException
writeAttribute
in interface XMLStreamWriter
XMLStreamException
protected final void writeCharacters(Object data, int type) throws XMLStreamException
XMLStreamException
public void writeCharacters(String text) throws XMLStreamException
writeCharacters
in interface XMLStreamWriter
XMLStreamException
public void writeCharacters(char[] text, int start, int length) throws XMLStreamException
writeCharacters
in interface XMLStreamWriter
XMLStreamException
public void writeCData(String data) throws XMLStreamException
writeCData
in interface XMLStreamWriter
XMLStreamException
public void writeStartDocument() throws XMLStreamException
writeStartDocument
in interface XMLStreamWriter
XMLStreamException
public void writeStartDocument(String version) throws XMLStreamException
writeStartDocument
in interface XMLStreamWriter
XMLStreamException
public void writeStartDocument(String encoding, String version) throws XMLStreamException
writeStartDocument
in interface XMLStreamWriter
XMLStreamException
public void writeEndDocument() throws XMLStreamException
writeEndDocument
in interface XMLStreamWriter
XMLStreamException
public void close() throws XMLStreamException
close
in interface XMLStreamWriter
XMLStreamException
public void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException
writeNamespace
in interface XMLStreamWriter
XMLStreamException
public void writeDefaultNamespace(String namespaceURI) throws XMLStreamException
writeDefaultNamespace
in interface XMLStreamWriter
XMLStreamException
public String getPrefix(String namespaceURI) throws XMLStreamException
getPrefix
in interface XMLStreamWriter
XMLStreamException
public void setPrefix(String prefix, String namespaceURI) throws XMLStreamException
setPrefix
in interface XMLStreamWriter
XMLStreamException
public void setDefaultNamespace(String namespaceURI) throws XMLStreamException
setDefaultNamespace
in interface XMLStreamWriter
XMLStreamException
public void setNamespaceContext(NamespaceContext context) throws XMLStreamException
setNamespaceContext
in interface XMLStreamWriter
XMLStreamException
public NamespaceContext getNamespaceContext()
getNamespaceContext
in interface XMLStreamWriter
public void writeComment(String data) throws XMLStreamException
writeComment
in interface XMLStreamWriter
XMLStreamException
public void writeProcessingInstruction(String target) throws XMLStreamException
writeProcessingInstruction
in interface XMLStreamWriter
XMLStreamException
public void writeProcessingInstruction(String target, String data) throws XMLStreamException
writeProcessingInstruction
in interface XMLStreamWriter
XMLStreamException
public void writeDTD(String dtd) throws XMLStreamException
writeDTD
in interface XMLStreamWriter
XMLStreamException
public void writeEntityRef(String name) throws XMLStreamException
writeEntityRef
in interface XMLStreamWriter
XMLStreamException
public Object getProperty(String name) throws IllegalArgumentException
getProperty
in interface XMLStreamWriter
IllegalArgumentException
Copyright © 2005–2019 Apache Software Foundation. All rights reserved.