Class XMLFormatter


  • public class XMLFormatter
    extends AbstractFormatter
    Main class responsible for the generation of xml text from an internal object structure. The class allows configurable XML tagnames to customise the output xml.
    • Field Detail

      • xmlStreamWriter

        protected javax.xml.stream.XMLStreamWriter xmlStreamWriter
      • ignoreEmptyFields

        protected boolean ignoreEmptyFields
    • Constructor Detail

      • XMLFormatter

        public XMLFormatter​(IXMLTagnames tagnames)
        Constructor that allows you to choose the XML tagnames used in the output
        Parameters:
        tagnames - - Tagnames to be used
    • Method Detail

      • setTagnames

        public void setTagnames​(IXMLTagnames tagnames)
      • setXMLStreamWriter

        public void setXMLStreamWriter​(javax.xml.stream.XMLStreamWriter xmlw)
      • format

        public void format​(Message element)
                    throws java.io.IOException
        Specified by:
        format in class AbstractFormatter
        Throws:
        java.io.IOException
      • format

        public void format​(Segment element)
                    throws java.io.IOException
        Specified by:
        format in class AbstractFormatter
        Throws:
        java.io.IOException
      • format

        public void format​(Field element)
                    throws java.io.IOException
        Specified by:
        format in class AbstractFormatter
        Throws:
        java.io.IOException
      • formatCompositeField

        public void formatCompositeField​(Field element)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • format

        public void format​(Field ruleElement,
                           Field dataElement)
                    throws java.io.IOException
        Specified by:
        format in class AbstractFormatter
        Throws:
        java.io.IOException
      • formatCompositeField

        public void formatCompositeField​(Field ruleElement,
                                         Field dataElement)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • openEnclosingTag

        public void openEnclosingTag​(EdiElement element)
                              throws java.io.IOException
        Used to create an open enclosing tag in the output.
        Parameters:
        element - - Type of element to output
        Throws:
        java.io.IOException
      • closeEnclosingTag

        public void closeEnclosingTag​(EdiElement element)
                               throws java.io.IOException
        Used to create close an enclosing tag in the output.
        Parameters:
        element - - type of element to output
        Throws:
        java.io.IOException
      • isIgnoreEmptyFields

        public boolean isIgnoreEmptyFields()
      • setIgnoreEmptyFields

        public void setIgnoreEmptyFields​(boolean ignoreEmptyFields)
      • closeStream

        public void closeStream()
                         throws javax.xml.stream.XMLStreamException
        Flush and close the XML writer.
        Throws:
        javax.xml.stream.XMLStreamException