Class StaxStartDocument

All Implemented Interfaces:
AdaptrisComponent, ComponentLifecycle, ComponentLifecycleExtension, MessageEventGenerator, Service, StateManagedComponent

@ComponentProfile(summary="Prepare for writing large XML output via STaX", tag="service,transform,xml", since="3.6.6") public class StaxStartDocument extends StaxXmlOutput
Prepare ourselves for writing some large XML output via STaX.

For this service to work, the underlying AdaptrisMessageFactory associated with the AdaptrisMessage instance must be a FileBackedMessageFactory and subsequent processing should include multiple instances of StaxWriteElement to write XML elements and finally StaxEndDocument to commit the output; so effectively your processing chain should be

 
   <stax-xml-start-document/>
     ... 0 or more instances of <stax-xml-write-element/>
   <stax-xml-end-document/>
 
 

See Also:

In the adapter configuration file this class is aliased as stax-xml-start-document which is the preferred alternative to the fully qualified classname when building your configuration.

  • Field Details

  • Constructor Details

    • StaxStartDocument

      public StaxStartDocument()
    • StaxStartDocument

      public StaxStartDocument(String rootElement)
  • Method Details

    • doService

      public void doService(AdaptrisMessage msg) throws ServiceException
      Throws:
      ServiceException
    • getOutputMessageEncoding

      public String getOutputMessageEncoding()
    • setOutputMessageEncoding

      public void setOutputMessageEncoding(String encoding)
      Set the encoding for the resulting XML document.

      If not specified the following rules will be applied:

      1. If the AdaptrisMessage.getCharEncoding() is non-null then that will be used.
      2. UTF-8

      As a result; the character encoding on the message is always set using AdaptrisMessage.setCharEncoding(String).

      Parameters:
      encoding - the character
    • getRootElement

      public String getRootElement()
    • setRootElement

      public void setRootElement(String s)
      Set the root element for the XML document.
      Parameters:
      s - the root element, default is "root" if not specified.
    • getPrefix

      public String getPrefix()
      Returns:
      the prefix
    • setPrefix

      public void setPrefix(String prefix)
      Parameters:
      prefix - the prefix to set
    • getNamespaceUri

      public String getNamespaceUri()
      Returns:
      the namespaceUri
    • setNamespaceUri

      public void setNamespaceUri(String s)
      Parameters:
      s - the namespaceUri to set