public static class XmlGenerator.XmlElementGenerator extends java.lang.Object implements XmlGenerator.ElementGenerator
interface
. It will generate start and end
elements based directly on the element metadata, attributes, and value.Constructor and Description |
---|
XmlGenerator.XmlElementGenerator() |
Modifier and Type | Method and Description |
---|---|
void |
endElement(XmlWriter xw,
Element e,
ElementMetadata<?,?> metadata)
End an element, writing a close tag if needed.
|
protected java.util.List<XmlWriter.Attribute> |
getAttributes(Element e,
ElementMetadata<?,?> metadata)
Get a list of attributes for the given element.
|
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 . |
protected java.util.Collection<XmlNamespace> |
getNamespaces(Element parent,
Element e,
ElementMetadata<?,?> metadata)
Get a collection of namespaces for the current element and parent.
|
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.
|
public boolean startElement(XmlWriter xw, Element parent, Element e, ElementMetadata<?,?> metadata) throws java.io.IOException
XmlGenerator.ElementGenerator
false
to indicate that textContent
and child elements should not be added.startElement
in interface XmlGenerator.ElementGenerator
xw
- the xml writer to write to.parent
- the parent element.e
- the element to start.metadata
- the metadata for the elementjava.io.IOException
- if an error occurs while writing to the writer.protected QName getName(Element e, ElementMetadata<?,?> metadata)
null
.protected java.util.Collection<XmlNamespace> getNamespaces(Element parent, Element e, ElementMetadata<?,?> metadata)
protected java.util.List<XmlWriter.Attribute> getAttributes(Element e, ElementMetadata<?,?> metadata)
public void textContent(XmlWriter xw, Element e, ElementMetadata<?,?> metadata) throws java.io.IOException
XmlGenerator.ElementGenerator
textContent
in interface XmlGenerator.ElementGenerator
java.io.IOException
public void endElement(XmlWriter xw, Element e, ElementMetadata<?,?> metadata) throws java.io.IOException
XmlGenerator.ElementGenerator
endElement
in interface XmlGenerator.ElementGenerator
java.io.IOException