mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-15 15:31:08 +01:00
Introduce XmlEnvironment
This commit is contained in:
parent
dc780ffd6c
commit
fee3ed81ca
229 changed files with 715 additions and 526 deletions
|
|
@ -24,6 +24,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.jivesoftware.smack.packet.NamedElement;
|
||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||
|
||||
|
|
@ -433,7 +434,7 @@ public class FormField implements NamedElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
public XmlStringBuilder toXML(XmlEnvironment enclosingNamespace) {
|
||||
XmlStringBuilder buf = new XmlStringBuilder(this);
|
||||
// Add attributes
|
||||
buf.optAttribute("label", getLabel());
|
||||
|
|
@ -449,7 +450,7 @@ public class FormField implements NamedElement {
|
|||
}
|
||||
// Loop through all the values and append them to the string buffer
|
||||
for (Option option : getOptions()) {
|
||||
buf.append(option.toXML(null));
|
||||
buf.append(option.toXML());
|
||||
}
|
||||
buf.optElement(validateElement);
|
||||
buf.closeElement(this);
|
||||
|
|
@ -467,12 +468,12 @@ public class FormField implements NamedElement {
|
|||
|
||||
FormField other = (FormField) obj;
|
||||
|
||||
return toXML(null).equals(other.toXML(null));
|
||||
return toXML().toString().equals(other.toXML().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return toXML(null).hashCode();
|
||||
return toXML().toString().hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -525,7 +526,7 @@ public class FormField implements NamedElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
// Add attribute
|
||||
xml.optAttribute("label", getLabel());
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ public class DataForm implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
|
||||
XmlStringBuilder buf = new XmlStringBuilder(this);
|
||||
buf.attribute("type", getType());
|
||||
buf.rightAngleBracket();
|
||||
|
|
@ -331,10 +331,10 @@ public class DataForm implements ExtensionElement {
|
|||
}
|
||||
// Loop through all the form fields and append them to the string buffer
|
||||
for (FormField field : getFields()) {
|
||||
buf.append(field.toXML(null));
|
||||
buf.append(field.toXML());
|
||||
}
|
||||
for (Element element : extensionElements) {
|
||||
buf.append(element.toXML(null));
|
||||
buf.append(element.toXML());
|
||||
}
|
||||
buf.closeElement(this);
|
||||
return buf;
|
||||
|
|
@ -379,7 +379,7 @@ public class DataForm implements ExtensionElement {
|
|||
buf.openElement(ELEMENT);
|
||||
// Loop through all the form items and append them to the string buffer
|
||||
for (FormField field : getFields()) {
|
||||
buf.append(field.toXML(null));
|
||||
buf.append(field.toXML());
|
||||
}
|
||||
buf.closeElement(ELEMENT);
|
||||
return buf;
|
||||
|
|
@ -415,7 +415,7 @@ public class DataForm implements ExtensionElement {
|
|||
buf.openElement(ELEMENT);
|
||||
// Loop through all the form items and append them to the string buffer
|
||||
for (FormField field : getFields()) {
|
||||
buf.append(field.toXML(null));
|
||||
buf.append(field.toXML());
|
||||
}
|
||||
buf.closeElement(ELEMENT);
|
||||
return buf;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue