com.google.gdata.wireformats
Class XmlGenerator.XmlElementGenerator

java.lang.Object
  extended by com.google.gdata.wireformats.XmlGenerator.XmlElementGenerator
All Implemented Interfaces:
XmlGenerator.ElementGenerator
Enclosing class:
XmlGenerator

public static class XmlGenerator.XmlElementGenerator
extends java.lang.Object
implements XmlGenerator.ElementGenerator

The XmlElementGenerator class provides the default implementation of the interface. It will generate start and end elements based directly on the element metadata, attributes, and value.


Constructor Summary
XmlGenerator.XmlElementGenerator()
           
 
Method Summary
 void endElement(XmlWriter xw, Element e, ElementMetadata<?,?> metadata)
          End an element, writing a close tag if needed.
 boolean startElement(XmlWriter xw, Element parent, Element e, ElementMetadata<?,?> metadata)
          Start an element.
 void textContent(XmlWriter xw, Element e, ElementMetadata<?,?> metadata)
          Write the text content for an element.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlGenerator.XmlElementGenerator

public XmlGenerator.XmlElementGenerator()
Method Detail

startElement

public boolean startElement(XmlWriter xw,
                            Element parent,
                            Element e,
                            ElementMetadata<?,?> metadata)
                     throws java.io.IOException
Description copied from interface: XmlGenerator.ElementGenerator
Start an element. If an ElementGenerator instances writes a full element tag, it should return false to indicate that textContent and child elements should not be added.

Specified by:
startElement in interface XmlGenerator.ElementGenerator
Parameters:
xw - the xml writer to write to.
parent - the parent element.
e - the element to start.
metadata - the metadata for the element
Returns:
true if child elements should be written, false if the element was fully written.
Throws:
java.io.IOException - if an error occurs while writing to the writer.

textContent

public void textContent(XmlWriter xw,
                        Element e,
                        ElementMetadata<?,?> metadata)
                 throws java.io.IOException
Description copied from interface: XmlGenerator.ElementGenerator
Write the text content for an element.

Specified by:
textContent in interface XmlGenerator.ElementGenerator
Throws:
java.io.IOException

endElement

public void endElement(XmlWriter xw,
                       Element e,
                       ElementMetadata<?,?> metadata)
                throws java.io.IOException
Description copied from interface: XmlGenerator.ElementGenerator
End an element, writing a close tag if needed.

Specified by:
endElement in interface XmlGenerator.ElementGenerator
Throws:
java.io.IOException