Class XMLFormatter
- java.lang.Object
-
- com.adaptris.adapter.edistream.formatter.AbstractFormatter
-
- com.adaptris.adapter.edistream.formatter.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 Summary
Fields Modifier and Type Field Description protected boolean
ignoreEmptyFields
protected IXMLTagnames
tagnames
protected javax.xml.stream.XMLStreamWriter
xmlStreamWriter
-
Constructor Summary
Constructors Constructor Description XMLFormatter(IXMLTagnames tagnames)
Constructor that allows you to choose the XML tagnames used in the output
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeEnclosingTag(EdiElement element)
Used to create close an enclosing tag in the output.void
closeStream()
Flush and close the XML writer.void
format(Composite element)
void
format(Composite ruleElement, Composite dataElement)
void
format(Field element)
void
format(Field ruleElement, Field dataElement)
void
format(LoopSegment element)
void
format(LoopSegment ruleElement, LoopSegment dataElement)
void
format(Message element)
void
format(Message ruleElement, Message dataElement)
void
format(Segment element)
void
format(Segment ruleElement, Segment dataElement)
void
formatCompositeField(Field element)
void
formatCompositeField(Field ruleElement, Field dataElement)
boolean
isIgnoreEmptyFields()
void
openEnclosingTag(EdiElement element)
Used to create an open enclosing tag in the output.void
setIgnoreEmptyFields(boolean ignoreEmptyFields)
void
setTagnames(IXMLTagnames tagnames)
void
setXMLStreamWriter(javax.xml.stream.XMLStreamWriter xmlw)
-
Methods inherited from class com.adaptris.adapter.edistream.formatter.AbstractFormatter
format, format
-
-
-
-
Field Detail
-
tagnames
protected IXMLTagnames tagnames
-
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 classAbstractFormatter
- Throws:
java.io.IOException
-
format
public void format(LoopSegment element) throws java.io.IOException
- Specified by:
format
in classAbstractFormatter
- Throws:
java.io.IOException
-
format
public void format(Segment element) throws java.io.IOException
- Specified by:
format
in classAbstractFormatter
- Throws:
java.io.IOException
-
format
public void format(Composite element) throws java.io.IOException
- Specified by:
format
in classAbstractFormatter
- Throws:
java.io.IOException
-
format
public void format(Field element) throws java.io.IOException
- Specified by:
format
in classAbstractFormatter
- Throws:
java.io.IOException
-
formatCompositeField
public void formatCompositeField(Field element) throws java.io.IOException
- Throws:
java.io.IOException
-
format
public void format(Message ruleElement, Message dataElement) throws java.io.IOException
- Specified by:
format
in classAbstractFormatter
- Throws:
java.io.IOException
-
format
public void format(LoopSegment ruleElement, LoopSegment dataElement) throws java.io.IOException
- Specified by:
format
in classAbstractFormatter
- Throws:
java.io.IOException
-
format
public void format(Segment ruleElement, Segment dataElement) throws java.io.IOException
- Specified by:
format
in classAbstractFormatter
- Throws:
java.io.IOException
-
format
public void format(Composite ruleElement, Composite dataElement) throws java.io.IOException
- Specified by:
format
in classAbstractFormatter
- Throws:
java.io.IOException
-
format
public void format(Field ruleElement, Field dataElement) throws java.io.IOException
- Specified by:
format
in classAbstractFormatter
- 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
-
-