Java Utililty Methods XMLStreamWriter

List of utility methods to do XMLStreamWriter

Description

The list of methods to do XMLStreamWriter are organized into topic(s).

Method

voidwriteEndElement(XMLStreamWriter out, QName name)
write End Element
if (name == null)
    return;
out.writeEndElement();
voidwriteFloat(String name, float value, XMLStreamWriter writer)
write Float
if (!Float.isNaN(value)) {
    writer.writeAttribute(name, Float.toString(value));
voidwriteFooter(XMLStreamWriter w)
write Footer
w.writeEndElement(); 
w.writeEndElement(); 
w.writeEndElement(); 
voidwriteIndent(XMLStreamWriter xmlsw, String indent)
write Indent
xmlsw.writeCharacters(indent);
voidwriteInsertPos(XMLStreamWriter w, boolean isBefore, int[] pos)
write Insert Pos
if (isBefore)
    w.writeEmptyElement("before");
else
    w.writeEmptyElement("after");
w.writeAttribute("begin_line", Integer.toString(pos[0]));
w.writeAttribute("begin_col", Integer.toString(pos[1]));
w.writeAttribute("end_line", Integer.toString(pos[0]));
w.writeAttribute("end_col", Integer.toString(pos[1]));
...
voidwritePath(XMLStreamWriter w, Supplier cssClass, Supplier fill, Supplier stroke, Supplier path)
Write an SVG Path element

try {
    w.writeStartElement("path");
    writeSvgAttributes(w, cssClass, fill, stroke);
    w.writeAttribute("d", path.get());
    w.writeEndElement();
} catch (XMLStreamException ex) {
    throw new RuntimeException(ex);
voidwriteSimpleTag(XMLStreamWriter writer, String tag, Object value, boolean asCData)
Write a "simple" tag
writer.writeStartElement(tag);
if (asCData)
    writer.writeCData(String.valueOf(value));
else
    writer.writeCharacters(String.valueOf(value));
writer.writeEndElement();
voidwriteStartElement(XMLStreamWriter writer, QName name)
Write a start element.
String ns = name.getNamespaceURI();
if (ns != null && !ns.isEmpty()) {
    writer.writeStartElement(name.getNamespaceURI(), name.getLocalPart());
} else {
    writer.writeStartElement(name.getLocalPart());
voidwriteTag(XMLStreamWriter xmlWriter, String tag, Object value)
write Tag
if (value == null) {
    xmlWriter.writeEmptyElement(tag);
} else {
    xmlWriter.writeStartElement(tag);
    xmlWriter.writeCData(value.toString());
    xmlWriter.writeEndElement();
voidwriteWithCharacters(XMLStreamWriter w, String localName, String text)
write With Characters
w.writeStartElement(localName);
w.writeCharacters(text);
w.writeEndElement();