|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gdata.wireformats.XmlGenerator
public class XmlGenerator
XML generator that outputs a tree of Element
objects
using the XML wire format.
Nested Class Summary | |
---|---|
static interface |
XmlGenerator.ElementGenerator
The ElementGenerator interface is implemented by helper classes that will generate the start element, text content, and end element syntax for an Element to an XmlWriter . |
static class |
XmlGenerator.XmlElementGenerator
The XmlElementGenerator class provides the default implementation of the interface . |
Nested classes/interfaces inherited from interface com.google.gdata.model.ElementVisitor |
---|
ElementVisitor.StoppedException |
Constructor Summary | |
---|---|
XmlGenerator(StreamProperties props,
java.io.Writer w,
java.nio.charset.Charset cs,
boolean prettyPrint)
Creates a new xml generator for generating xml output. |
|
XmlGenerator(StreamProperties props,
java.io.Writer w,
java.nio.charset.Charset cs,
boolean prettyPrint,
XmlNamespace defaultNamespace)
Creates a new xml generator for generating xml output, using the given namespace as the default namespace. |
Method Summary | |
---|---|
void |
generate(Element element)
Generate wire content for tree rooted at root . |
void |
generate(Element element,
ElementMetadata<?,?> metadata)
|
boolean |
visit(Element parent,
Element e,
ElementMetadata<?,?> metadata)
Called during Element tree traversal to allow the visitor instance to process an element in the tree. |
void |
visitComplete(Element parent,
Element e,
ElementMetadata<?,?> metadata)
The visitComplete method is called when traversal for an Element and all of its nested children has been completed. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XmlGenerator(StreamProperties props, java.io.Writer w, java.nio.charset.Charset cs, boolean prettyPrint)
#XmlGenerator(OutputProperties, Writer, Charset, boolean, XmlNamespace)
with the namespace that should be used as the default.
public XmlGenerator(StreamProperties props, java.io.Writer w, java.nio.charset.Charset cs, boolean prettyPrint, XmlNamespace defaultNamespace)
Method Detail |
---|
public void generate(Element element) throws java.io.IOException
WireFormatGenerator
root
.
generate
in interface WireFormatGenerator
element
- root of tree
java.io.IOException
- if content generation failedpublic void generate(Element element, ElementMetadata<?,?> metadata) throws java.io.IOException
java.io.IOException
public boolean visit(Element parent, Element e, ElementMetadata<?,?> metadata) throws ElementVisitor.StoppedException
ElementVisitor
visit
in interface ElementVisitor
parent
- the parent of the target elemente
- the target element being visitedmetadata
- the metadata for the target element
ElementVisitor.StoppedException
- if the data model traversal should be stopped
immediately. This may be the result of an unexpected error, or some
visitor implementations may extend this exception type to signal
specific exit conditions.public void visitComplete(Element parent, Element e, ElementMetadata<?,?> metadata) throws ElementVisitor.StoppedException
ElementVisitor
visitComplete
in interface ElementVisitor
parent
- the parent of the target elemente
- the visited elementmetadata
- the metadata for the target element
ElementVisitor.StoppedException
- if the data model traversal should be stopped
immediately. This may be the result of an unexpected error, or some
visitor implementations may extend this exception type to signal
specific exit conditions.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |