From 5424c9635fc66907e2a3613e718b6600ed6fecc5 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 17 Jun 2017 11:41:35 +0200 Subject: [PATCH] Add XmlStringBuilder.optXmlLangAttribute(String) --- .../org/jivesoftware/smack/util/XmlStringBuilder.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java index 1ffcd8d0c..2579bf522 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java @@ -1,6 +1,6 @@ /** * - * Copyright 2014-2015 Florian Schmaus + * Copyright 2014-2017 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -360,6 +360,13 @@ public class XmlStringBuilder implements Appendable, CharSequence { return this; } + public XmlStringBuilder optXmlLangAttribute(String lang) { + if (lang != null) { + xmllangAttribute(lang); + } + return this; + } + public XmlStringBuilder escape(String text) { assert text != null; sb.append(StringUtils.escapeForXml(text));