public class MetaXMLStreamWriter extends AbstractMetaXMLWriter implements XMLStreamWriter
JPhyloIOEventWriter
. Instances of this class should not (and cannot) be created directly in application code, but
JPhyloIOXMLEventWriter.createMetaXMLStreamWriter(JPhyloIOEventReceiver)
should be used instead.
This writer does not manage namespaces of custom XML elements. The application needs to ensure that all used prefixes
(either in any elements, attributes or character data) are properly declared within the custom XML
(e.g. by adding Namespace
events). Any methods of this writer changing the namespace mapping or obtaining information
about it refer to the underlying writer. Note that if the default namespace is changed (either by setting a new default namespace or a completely
new namespace context object) while this reader is on the top level of custom XML, it is possible that the literal meta
end tag is written with the wrong default namespace (it would be written with a prefix then).
No end elements can be written by this writer, if the according start element was not written with this instance as well.
Constructor and Description |
---|
MetaXMLStreamWriter(JPhyloIOEventReceiver receiver,
XMLStreamWriter underlyingXMLWriter)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
This method has no effect in this writer.
|
void |
flush()
This method has no effect in this writer, since the underlying
JPhyloIOEventWriter
does not implement a flush() method. |
NamespaceContext |
getNamespaceContext() |
String |
getPrefix(String uri) |
Object |
getProperty(String name) |
void |
setDefaultNamespace(String uri) |
void |
setNamespaceContext(NamespaceContext context) |
void |
setPrefix(String prefix,
String uri) |
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 len) |
void |
writeCharacters(String text) |
void |
writeComment(String data) |
void |
writeDefaultNamespace(String namespaceURI) |
void |
writeDTD(String dtd) |
void |
writeEmptyElement(String localName)
It depends on the implementation of XMLStreamWriter returned by
XMLOutputFactory.createXMLStreamWriter(java.io.Writer)
if a self-closing tag or a separate start and end tag is written by this method. |
void |
writeEmptyElement(String namespaceURI,
String localName)
It depends on the implementation of XMLStreamWriter returned by
XMLOutputFactory.createXMLStreamWriter(java.io.Writer)
if a self-closing tag or a separate start and end tag is written by this method. |
void |
writeEmptyElement(String prefix,
String localName,
String namespaceURI)
It depends on the implementation of XMLStreamWriter returned by
XMLOutputFactory.createXMLStreamWriter(java.io.Writer)
if a self-closing tag or a separate start and end tag is written by this method. |
void |
writeEndDocument() |
void |
writeEndElement() |
void |
writeEntityRef(String name) |
void |
writeNamespace(String prefix,
String namespaceURI) |
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) |
getReceiver, getUnderlyingXMLWriter
public MetaXMLStreamWriter(JPhyloIOEventReceiver receiver, XMLStreamWriter underlyingXMLWriter)
receiver
- the event receiver to write the JPhyloIO events created by this writer tounderlyingXMLWriter
- the XML writer used by the associated JPhyloIO event writerpublic void close() throws XMLStreamException
close
in interface XMLStreamWriter
XMLStreamException
public void flush() throws XMLStreamException
JPhyloIOEventWriter
does not implement a flush() method.flush
in interface XMLStreamWriter
XMLStreamException
public NamespaceContext getNamespaceContext()
getNamespaceContext
in interface XMLStreamWriter
public String getPrefix(String uri) throws XMLStreamException
getPrefix
in interface XMLStreamWriter
XMLStreamException
public Object getProperty(String name) throws IllegalArgumentException
getProperty
in interface XMLStreamWriter
IllegalArgumentException
public void setDefaultNamespace(String uri) throws XMLStreamException
setDefaultNamespace
in interface XMLStreamWriter
XMLStreamException
public void setNamespaceContext(NamespaceContext context) throws XMLStreamException
setNamespaceContext
in interface XMLStreamWriter
XMLStreamException
public void setPrefix(String prefix, String uri) throws XMLStreamException
setPrefix
in interface XMLStreamWriter
XMLStreamException
public void writeAttribute(String prefix, String namespaceURI, 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 localName, String value) throws XMLStreamException
writeAttribute
in interface XMLStreamWriter
XMLStreamException
public void writeCData(String data) throws XMLStreamException
writeCData
in interface XMLStreamWriter
XMLStreamException
public void writeCharacters(char[] text, int start, int len) throws XMLStreamException
writeCharacters
in interface XMLStreamWriter
XMLStreamException
public void writeCharacters(String text) throws XMLStreamException
writeCharacters
in interface XMLStreamWriter
XMLStreamException
public void writeComment(String data) throws XMLStreamException
writeComment
in interface XMLStreamWriter
XMLStreamException
public void writeDTD(String dtd) throws XMLStreamException
writeDTD
in interface XMLStreamWriter
XMLStreamException
public void writeDefaultNamespace(String namespaceURI) throws XMLStreamException
writeDefaultNamespace
in interface XMLStreamWriter
XMLStreamException
public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException
XMLOutputFactory.createXMLStreamWriter(java.io.Writer)
if a self-closing tag or a separate start and end tag is written by this method.writeEmptyElement
in interface XMLStreamWriter
XMLStreamException
public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException
XMLOutputFactory.createXMLStreamWriter(java.io.Writer)
if a self-closing tag or a separate start and end tag is written by this method.writeEmptyElement
in interface XMLStreamWriter
XMLStreamException
public void writeEmptyElement(String localName) throws XMLStreamException
XMLOutputFactory.createXMLStreamWriter(java.io.Writer)
if a self-closing tag or a separate start and end tag is written by this method.writeEmptyElement
in interface XMLStreamWriter
XMLStreamException
public void writeEndDocument() throws XMLStreamException
writeEndDocument
in interface XMLStreamWriter
XMLStreamException
public void writeEndElement() throws XMLStreamException
writeEndElement
in interface XMLStreamWriter
XMLStreamException
public void writeEntityRef(String name) throws XMLStreamException
writeEntityRef
in interface XMLStreamWriter
XMLStreamException
public void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException
writeNamespace
in interface XMLStreamWriter
XMLStreamException
public void writeProcessingInstruction(String target, String data) throws XMLStreamException
writeProcessingInstruction
in interface XMLStreamWriter
XMLStreamException
public void writeProcessingInstruction(String target) throws XMLStreamException
writeProcessingInstruction
in interface XMLStreamWriter
XMLStreamException
public void writeStartDocument() throws XMLStreamException
writeStartDocument
in interface XMLStreamWriter
XMLStreamException
public void writeStartDocument(String encoding, String version) throws XMLStreamException
writeStartDocument
in interface XMLStreamWriter
XMLStreamException
public void writeStartDocument(String version) throws XMLStreamException
writeStartDocument
in interface XMLStreamWriter
XMLStreamException
public void writeStartElement(String prefix, String localName, String namespaceURI) 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 localName) throws XMLStreamException
writeStartElement
in interface XMLStreamWriter
XMLStreamException