create domdocument.xml with xml writer 4

This commit is contained in:
honfika@gmail.com
2016-03-10 19:57:47 +01:00
parent 4ff323aa2e
commit 58f58b584b
2 changed files with 762 additions and 694 deletions

View File

@@ -54,36 +54,7 @@ public class XFLXmlWriter implements XMLStreamWriter {
return this;
}
// todo: remove
public XFLXmlWriter append(StringBuilder stringBuilder) {
sb.append(stringBuilder);
newLine = false;
return this;
}
// todo: remove
public XFLXmlWriter append(int value) {
sb.append(value);
newLine = false;
return this;
}
// todo: remove
public XFLXmlWriter append(float value) {
sb.append(value);
newLine = false;
return this;
}
// todo: remove
public XFLXmlWriter append(double value) {
sb.append(value);
newLine = false;
return this;
}
// todo: make this private
public XFLXmlWriter append(String text) {
private XFLXmlWriter append(String text) {
sb.append(text);
newLine = false;
return this;
@@ -207,6 +178,10 @@ public class XFLXmlWriter implements XMLStreamWriter {
writeEndElement();
}
public void writeElementValue(String localName, float value) throws XMLStreamException {
writeElementValue(localName, Float.toString(value));
}
public void writeElementValue(String localName, double value) throws XMLStreamException {
writeElementValue(localName, Double.toString(value));
}
@@ -215,6 +190,10 @@ public class XFLXmlWriter implements XMLStreamWriter {
writeElementValue(localName, Integer.toString(value));
}
public void writeElementValue(String localName, long value) throws XMLStreamException {
writeElementValue(localName, Long.toString(value));
}
public void writeElementValueRaw(String localName, String value) throws XMLStreamException {
writeStartElement(localName);
writeCharactersRaw(value);
@@ -245,6 +224,10 @@ public class XFLXmlWriter implements XMLStreamWriter {
append(' ').append(localName).append("=\"").append(escapeAttribute(value)).append('"');
}
public void writeAttribute(String localName, float value) throws XMLStreamException {
writeAttribute(localName, Float.toString(value));
}
public void writeAttribute(String localName, double value) throws XMLStreamException {
writeAttribute(localName, Double.toString(value));
}
@@ -253,6 +236,14 @@ public class XFLXmlWriter implements XMLStreamWriter {
writeAttribute(localName, Integer.toString(value));
}
public void writeAttribute(String localName, long value) throws XMLStreamException {
writeAttribute(localName, Long.toString(value));
}
public void writeAttribute(String localName, boolean value) throws XMLStreamException {
writeAttribute(localName, value ? "true" : "false");
}
@Override
public void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException {
setPrefix(prefix, namespaceURI);
@@ -389,7 +380,11 @@ public class XFLXmlWriter implements XMLStreamWriter {
}
// todo: remove
void setLength(int newLength) {
public void setLength(int newLength) {
sb.setLength(newLength);
}
public boolean isEmpty() {
return sb.length() == 0;
}
}