public class MetaXMLEventWriter extends AbstractMetaXMLWriter implements javax.xml.stream.XMLEventWriter
JPhyloIOEventWriter
. Instances of this class should not (and cannot) be created directly in application code, but
JPhyloIOXMLEventWriter.createMetaXMLEventWriter(JPhyloIOEventReceiver)
should be used instead.
Attributes of a start document event are not processed, since it is not possible to write them at this position of the document.
This writer does not have the necessary information (e.g. predicate) to be able to write literal meta start and end events, therefore this has to be done by the application itself.
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).
Constructor and Description |
---|
MetaXMLEventWriter(JPhyloIOEventReceiver receiver,
javax.xml.stream.XMLStreamWriter underlyingXMLWriter)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
void |
add(javax.xml.stream.events.XMLEvent event) |
void |
add(javax.xml.stream.XMLEventReader xmlReader) |
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. |
javax.xml.namespace.NamespaceContext |
getNamespaceContext()
Returns the current namespace context of the underlying XML event writer, if
|
java.lang.String |
getPrefix(java.lang.String uri) |
void |
setDefaultNamespace(java.lang.String uri) |
void |
setNamespaceContext(javax.xml.namespace.NamespaceContext context) |
void |
setPrefix(java.lang.String prefix,
java.lang.String uri) |
getReceiver, getUnderlyingXMLWriter
public MetaXMLEventWriter(JPhyloIOEventReceiver receiver, javax.xml.stream.XMLStreamWriter underlyingXMLWriter)
receiver
- the event receiver to write the JPhyloIO events created by this writer topublic void add(javax.xml.stream.events.XMLEvent event) throws javax.xml.stream.XMLStreamException
add
in interface javax.xml.stream.util.XMLEventConsumer
add
in interface javax.xml.stream.XMLEventWriter
javax.xml.stream.XMLStreamException
public void add(javax.xml.stream.XMLEventReader xmlReader) throws javax.xml.stream.XMLStreamException
add
in interface javax.xml.stream.XMLEventWriter
javax.xml.stream.XMLStreamException
public void close() throws javax.xml.stream.XMLStreamException
close
in interface javax.xml.stream.XMLEventWriter
javax.xml.stream.XMLStreamException
public void flush() throws javax.xml.stream.XMLStreamException
JPhyloIOEventWriter
does not implement a flush() method.flush
in interface javax.xml.stream.XMLEventWriter
javax.xml.stream.XMLStreamException
public javax.xml.namespace.NamespaceContext getNamespaceContext()
getNamespaceContext
in interface javax.xml.stream.XMLEventWriter
XMLEventWriter.getNamespaceContext()
public java.lang.String getPrefix(java.lang.String uri) throws javax.xml.stream.XMLStreamException
getPrefix
in interface javax.xml.stream.XMLEventWriter
javax.xml.stream.XMLStreamException
public void setDefaultNamespace(java.lang.String uri) throws javax.xml.stream.XMLStreamException
setDefaultNamespace
in interface javax.xml.stream.XMLEventWriter
javax.xml.stream.XMLStreamException
public void setNamespaceContext(javax.xml.namespace.NamespaceContext context) throws javax.xml.stream.XMLStreamException
setNamespaceContext
in interface javax.xml.stream.XMLEventWriter
javax.xml.stream.XMLStreamException
public void setPrefix(java.lang.String prefix, java.lang.String uri) throws javax.xml.stream.XMLStreamException
setPrefix
in interface javax.xml.stream.XMLEventWriter
javax.xml.stream.XMLStreamException