Optimize XmlStringBuilder.element() for the empty element case

For example RSM (XEP-0059) gives <before/> a different semantic as
<before>UID</before>.
This commit is contained in:
Florian Schmaus 2018-06-07 17:15:16 +02:00
parent a3cf1ab0ca
commit 414d730962
1 changed files with 3 additions and 1 deletions

View File

@ -75,7 +75,9 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
* @return the XmlStringBuilder
*/
public XmlStringBuilder element(String name, String content) {
assert content != null;
if (content.isEmpty()) {
return emptyElement(name);
}
openElement(name);
escape(content);
closeElement(name);