public static class

XmlGenerator.XmlElementGenerator

extends Object
implements XmlGenerator.ElementGenerator
java.lang.Object
   ↳ com.google.gdata.wireformats.XmlGenerator.XmlElementGenerator

Class Overview

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.

Summary

Public Constructors
XmlGenerator.XmlElementGenerator()
Public Methods
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.
Protected Methods
List<XmlWriter.Attribute> getAttributes(Element e, ElementMetadata<?, ?> metadata)
Get a list of attributes for the given element.
QName getName(Element e, ElementMetadata<?, ?> metadata)
Returns the QName of an element, possibly using the given metadata for the name if it is not null.
Collection<XmlNamespace> getNamespaces(Element parent, Element e, ElementMetadata<?, ?> metadata)
Get a collection of namespaces for the current element and parent.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.google.gdata.wireformats.XmlGenerator.ElementGenerator

Public Constructors

public XmlGenerator.XmlElementGenerator ()

Public Methods

public void endElement (XmlWriter xw, Element e, ElementMetadata<?, ?> metadata)

End an element, writing a close tag if needed.

Parameters
xw
e
metadata
Throws
IOException

public boolean startElement (XmlWriter xw, Element parent, Element e, ElementMetadata<?, ?> metadata)

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.

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
IOException

public void textContent (XmlWriter xw, Element e, ElementMetadata<?, ?> metadata)

Write the text content for an element.

Parameters
xw
e
metadata
Throws
IOException

Protected Methods

protected List<XmlWriter.Attribute> getAttributes (Element e, ElementMetadata<?, ?> metadata)

Get a list of attributes for the given element.

Parameters
e
metadata

protected QName getName (Element e, ElementMetadata<?, ?> metadata)

Returns the QName of an element, possibly using the given metadata for the name if it is not null.

Parameters
e
metadata

protected Collection<XmlNamespace> getNamespaces (Element parent, Element e, ElementMetadata<?, ?> metadata)

Get a collection of namespaces for the current element and parent. This will only return namespaces for the root element, because we bubble all namespaces up to the root for wire efficiency.

Parameters
parent
e
metadata