Add XmlStringBuilder.optXmlLangAttribute(String)

This commit is contained in:
Florian Schmaus 2017-06-17 11:41:35 +02:00
parent 8038b7a3e1
commit 5424c9635f
1 changed files with 8 additions and 1 deletions

View File

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2014-2015 Florian Schmaus * Copyright 2014-2017 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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; return this;
} }
public XmlStringBuilder optXmlLangAttribute(String lang) {
if (lang != null) {
xmllangAttribute(lang);
}
return this;
}
public XmlStringBuilder escape(String text) { public XmlStringBuilder escape(String text) {
assert text != null; assert text != null;
sb.append(StringUtils.escapeForXml(text)); sb.append(StringUtils.escapeForXml(text));