1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-12-18 11:01:08 +01:00

Rework XML Element hierarchy and XmlStringBuilder

- Reduce the amount of types that are subtypes of NamedElement. See
javadoc of NamedElement for rationale.
- Work more with XmlEnvironment in XmlStringBuilder.
- Some minor changes to XmlStringBuilder API.
This commit is contained in:
Florian Schmaus 2019-09-07 18:17:08 +02:00
parent e9bcdf3e6d
commit 65576cf3c2
74 changed files with 653 additions and 523 deletions

View file

@ -417,7 +417,7 @@ public final class FormField implements FullyQualifiedElement {
} else {
buf.rightAngleBracket();
buf.append(formFieldChildElements, enclosingNamespace);
buf.append(formFieldChildElements);
buf.closeElement(this);
}

View file

@ -325,15 +325,10 @@ public class DataForm implements ExtensionElement {
@Override
public XmlStringBuilder toXML(XmlEnvironment xmlEnvironment) {
XmlStringBuilder buf = new XmlStringBuilder(this);
XmlStringBuilder buf = new XmlStringBuilder(this, xmlEnvironment);
buf.attribute("type", getType());
buf.rightAngleBracket();
XmlEnvironment dataFormxmlEnvironment = XmlEnvironment.builder()
.withNamespace(NAMESPACE)
.withNext(xmlEnvironment)
.build();
buf.optElement("title", getTitle());
for (String instruction : getInstructions()) {
buf.element("instructions", instruction);
@ -347,7 +342,7 @@ public class DataForm implements ExtensionElement {
buf.append(item.toXML());
}
// Add all form fields.
buf.append(getFields(), dataFormxmlEnvironment);
buf.append(getFields());
for (Element element : extensionElements) {
buf.append(element.toXML());
}