info.bioinfweb.jphyloio.formats.xml

## Class AbstractXMLEventWriter<P extends XMLWriterStreamDataProvider<? extends AbstractXMLEventWriter<P>>>

- java.lang.Object
- - info.bioinfweb.jphyloio.AbstractEventWriter<P>
  - - info.bioinfweb.jphyloio.formats.xml.AbstractXMLEventWriter<P>

- All Implemented Interfaces:
    JPhyloIOXMLEventWriter, JPhyloIOEventWriter, JPhyloIOFormatSpecificObject
  Direct Known Subclasses:
    NeXMLEventWriter, PhyloXMLEventWriter

      public abstract class AbstractXMLEventWriter<P extends XMLWriterStreamDataProvider<? extends AbstractXMLEventWriter<P>>>
      extends AbstractEventWriter<P>
      implements JPhyloIOXMLEventWriter

  Implements shared functionality for writing XML formats.
  Since:
    0.0.0
  Author:
    Ben Stöver, Sarah Wiechers

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class info.bioinfweb.jphyloio.AbstractEventWriter

      `AbstractEventWriter.NoEditUniqueLabelHandler, AbstractEventWriter.UniqueLabelHandler`

  - ### Field Summary

    - ### Fields inherited from class info.bioinfweb.jphyloio.AbstractEventWriter

      `EDITED_LABEL_SEPARATOR`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractXMLEventWriter()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `javax.xml.stream.XMLEventWriter` | `createMetaXMLEventWriter(JPhyloIOEventReceiver receiver)` Creates a new `XMLEventWriter` that allows to write events of XML content of literal metadata to this JPhyloIO event writer instance through that interface.
    `javax.xml.stream.XMLStreamWriter` | `createMetaXMLStreamWriter(JPhyloIOEventReceiver receiver)` Creates a new `XMLStreamWriter` that allows to write events of XML content of literal metadata to this JPhyloIO event writer instance through that interface.
    `protected abstract void` | `doWriteDocument()`
    `protected void` | `doWriteDocument(DocumentDataAdapter document, java.io.Writer writer, ReadWriteParameterMap parameters)`
    `protected DocumentDataAdapter` | `getDocument()`
    `protected ApplicationLogger` | `getLogger()`
    `javax.xml.namespace.NamespaceContext` | `getNamespaceContext()` Returns the currently valid namespace context of the writer.
    `protected ReadWriteParameterMap` | `getParameters()`
    `protected javax.xml.stream.XMLStreamWriter` | `getXMLWriter()`

    - ### Methods inherited from class info.bioinfweb.jphyloio.AbstractEventWriter

      `createStreamDataProvider, createUniqueLabel, createUniqueLabel, createUniqueLabel, createUniqueLinkedOTULabel, decreaseIndention, determineMaxSequenceLength, extendSequence, getFileStartInfo, getIndention, getLabeledIDName, getLinkedOTUNameOTUFirst, getLinkedOTUNameOwnFirst, getReferencedOTUList, getStreamDataProvider, increaseIndention, logIngnoredOTULists, writeDocument, writeDocument, writeDocument, writeLineBreak, writeLineStart`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface info.bioinfweb.jphyloio.JPhyloIOEventWriter

      `writeDocument, writeDocument, writeDocument`

    - ### Methods inherited from interface info.bioinfweb.jphyloio.JPhyloIOFormatSpecificObject

      `getFormatID`

- - ### Constructor Detail

    - #### AbstractXMLEventWriter

          public AbstractXMLEventWriter()

  - ### Method Detail

    - #### getXMLWriter

          protected javax.xml.stream.XMLStreamWriter getXMLWriter()

    - #### getParameters

          protected ReadWriteParameterMap getParameters()

    - #### getLogger

          protected ApplicationLogger getLogger()

    - #### getDocument

          protected DocumentDataAdapter getDocument()

    - #### getNamespaceContext

          public javax.xml.namespace.NamespaceContext getNamespaceContext()

      Description copied from interface: `JPhyloIOXMLEventWriter`
      Returns the currently valid namespace context of the writer.
      Specified by:
        `getNamespaceContext` in interface `JPhyloIOXMLEventWriter`
      Returns:
        the currently valid `NamespaceContext` object

    - #### doWriteDocument

          protected abstract void doWriteDocument()
                                           throws java.io.IOException,
                                                  javax.xml.stream.XMLStreamException

      Throws:
        `java.io.IOException`
        `javax.xml.stream.XMLStreamException`

    - #### doWriteDocument

          protected void doWriteDocument(DocumentDataAdapter document,
                                         java.io.Writer writer,
                                         ReadWriteParameterMap parameters)
                                  throws java.io.IOException

      Specified by:
        `doWriteDocument` in class `AbstractEventWriter<P extends XMLWriterStreamDataProvider<? extends AbstractXMLEventWriter<P>>>`
      Throws:
        `java.io.IOException`

    - #### createMetaXMLEventWriter

          public javax.xml.stream.XMLEventWriter createMetaXMLEventWriter(JPhyloIOEventReceiver receiver)
                                                                   throws java.lang.IllegalStateException

      Description copied from interface: `JPhyloIOXMLEventWriter`
      Creates a new `XMLEventWriter` that allows to write events of XML content of literal metadata to this JPhyloIO event writer instance through that interface. Instances can be created any time, while this instance is located inside a literal metadata subsequence with the `LiteralContentSequenceType.XML`, but not outside of such a sequence.

      In principle this method may be called multiple times within the same literal metadata event subsequence, which would result in having multiple XML event writer instances delegating to the same JPhyloIO reader, although that is not recommended.

      In implementations of this interface that are part of JPhyloIO, the returned writer is an instance of `MetaXMLEventWriter`. You can have a look at its documentation for furthter details in how the returned instance behaves. (Note that third party implementations might return a different implementation of `XMLEventWriter` here.)

      Specified by:
        `createMetaXMLEventWriter` in interface `JPhyloIOXMLEventWriter`
      Parameters:
        `receiver` - the receiver to write events to (Each `XMLEvent` will be translated into a `LiteralMetadataContentEvent`.)
      Returns:
        the new writer instance
      Throws:
        `java.lang.IllegalStateException` - if no writer can be created at the current position (outside of a literal metadata event subsequence with type `LiteralContentSequenceType.XML`)

    - #### createMetaXMLStreamWriter

          public javax.xml.stream.XMLStreamWriter createMetaXMLStreamWriter(JPhyloIOEventReceiver receiver)
                                                                     throws java.lang.IllegalStateException

      Description copied from interface: `JPhyloIOXMLEventWriter`
      Creates a new `XMLStreamWriter` that allows to write events of XML content of literal metadata to this JPhyloIO event writer instance through that interface. Instances can be created any time, while this instance is located inside a literal metadata subsequence with the `LiteralContentSequenceType.XML`, but not outside of such a sequence.

      In theory this method may be called multiple times within the same literal metadata event subsequence, which would result in having multiple XML event writer instances delegating to the same JPhyloIO reader, although that is not recommended.

      In implementations of this interface that are part of JPhyloIO, the returned writer is an instance of `MetaXMLStreamWriter`. You can have a look at its documentation for furthter details in how the returned instance behaves. (Note that third party implementations might return a different implementation of `XMLStreamWriter` here.)

      Specified by:
        `createMetaXMLStreamWriter` in interface `JPhyloIOXMLEventWriter`
      Parameters:
        `receiver` - the receiver to write events to (Each writing operation will be translated into a `LiteralMetadataContentEvent`.)
      Returns:
        the new writer instance
      Throws:
        `java.lang.IllegalStateException` - if no writer can be created at the current position (outside of a literal metadata event subsequence with type `LiteralContentSequenceType.XML`)