Package jadex.xml.writer
Class Writer
- java.lang.Object
-
- jadex.xml.writer.AWriter
-
- jadex.xml.writer.Writer
-
public class Writer extends AWriter
XML writer for conversion of objects to XML.
-
-
Field Summary
Fields Modifier and Type Field Description protected static javax.xml.stream.XMLOutputFactory
FACTORY
The xml output factory.protected boolean
genids
Control flag for generating ids.protected boolean
indent
Control flag for generating indention.protected boolean
newline
Control flag for generating newlines.-
Fields inherited from class jadex.xml.writer.AWriter
XML_INCLUDE_FIELDS
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static javax.xml.stream.XMLStreamWriter
getWriter(AWriteContext context)
protected QName[]
getXMLPath(java.util.List<StackElement> stack)
Get the xml path for a stack.void
write(IObjectWriterHandler handler, java.lang.Object object, java.io.OutputStream out, java.lang.ClassLoader classloader, java.lang.Object context)
Write the properties to an xml.void
write(IObjectWriterHandler handler, java.lang.Object object, java.lang.String encoding, java.io.OutputStream out, java.lang.ClassLoader classloader, java.lang.Object context)
Write the properties to an xml.protected void
writeEndObject(javax.xml.stream.XMLStreamWriter writer, int level)
Write the end of an object.protected void
writeIndentation(javax.xml.stream.XMLStreamWriter writer, int level)
Write the indentation.protected void
writeNewline(javax.xml.stream.XMLStreamWriter writer)
protected void
writeObject(WriteContextDesktop wc, java.lang.Object object, QName tag)
Write an object to xml.protected void
writeStartObject(javax.xml.stream.XMLStreamWriter writer, QName tag, int level)
Write the start of an object.protected void
writeSubobjects(WriteContextDesktop wc, TreeNode node, TypeInfo typeinfo)
Write the subobjects of an object.-
Methods inherited from class jadex.xml.writer.AWriter
objectToByteArray, objectToByteArray, objectToByteArray, objectToOutputStream, objectToXML, objectToXML
-
-
-
-
Field Detail
-
FACTORY
protected static final javax.xml.stream.XMLOutputFactory FACTORY
The xml output factory.
-
genids
protected boolean genids
Control flag for generating ids.
-
indent
protected boolean indent
Control flag for generating indention.
-
newline
protected boolean newline
Control flag for generating newlines.
-
-
Constructor Detail
-
Writer
public Writer()
Create a new reader (with genids=true and indent=true).- Parameters:
readerhandler
- The handler.
-
Writer
public Writer(boolean genids)
Create a new reader (with genids=true and indent=true).- Parameters:
readerhandler
- The handler.
-
Writer
public Writer(boolean genids, boolean indent, boolean newline)
Create a new reader.- Parameters:
readerhandler
- The handler.
-
-
Method Detail
-
write
public void write(IObjectWriterHandler handler, java.lang.Object object, java.io.OutputStream out, java.lang.ClassLoader classloader, java.lang.Object context) throws java.lang.Exception
Write the properties to an xml.
-
write
public void write(IObjectWriterHandler handler, java.lang.Object object, java.lang.String encoding, java.io.OutputStream out, java.lang.ClassLoader classloader, java.lang.Object context) throws java.lang.Exception
Write the properties to an xml.
-
writeObject
protected void writeObject(WriteContextDesktop wc, java.lang.Object object, QName tag) throws java.lang.Exception
Write an object to xml. Note: Must have tag parameter to support writing an object using an arbitrary tag. Cannot write tag in beforehand, because it must be written in one pass.- Throws:
java.lang.Exception
-
writeSubobjects
protected void writeSubobjects(WriteContextDesktop wc, TreeNode node, TypeInfo typeinfo) throws java.lang.Exception
Write the subobjects of an object.- Throws:
java.lang.Exception
-
writeStartObject
protected void writeStartObject(javax.xml.stream.XMLStreamWriter writer, QName tag, int level) throws java.lang.Exception
Write the start of an object.- Throws:
java.lang.Exception
-
writeEndObject
protected void writeEndObject(javax.xml.stream.XMLStreamWriter writer, int level) throws java.lang.Exception
Write the end of an object.- Throws:
java.lang.Exception
-
writeIndentation
protected void writeIndentation(javax.xml.stream.XMLStreamWriter writer, int level) throws java.lang.Exception
Write the indentation.- Throws:
java.lang.Exception
-
writeNewline
protected void writeNewline(javax.xml.stream.XMLStreamWriter writer) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getXMLPath
protected QName[] getXMLPath(java.util.List<StackElement> stack)
Get the xml path for a stack.- Parameters:
stack
- The stack.- Returns:
- The string representig the xml stack (e.g. tag1/tag2/tag3)
-
getWriter
public static javax.xml.stream.XMLStreamWriter getWriter(AWriteContext context)
-
-