mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 17:49:38 +02:00
Improve StringUtils.escapeForXml()
This commit is contained in:
parent
f2a748db9a
commit
e6a9027cc6
11 changed files with 169 additions and 43 deletions
|
@ -332,7 +332,7 @@ public class StreamInitiation extends IQ {
|
|||
.append(getNamespace()).append("\" ");
|
||||
|
||||
if (getName() != null) {
|
||||
buffer.append("name=\"").append(StringUtils.escapeForXML(getName())).append("\" ");
|
||||
buffer.append("name=\"").append(StringUtils.escapeForXmlAttribute(getName())).append("\" ");
|
||||
}
|
||||
|
||||
if (getSize() > 0) {
|
||||
|
@ -350,7 +350,7 @@ public class StreamInitiation extends IQ {
|
|||
if ((desc != null && desc.length() > 0) || isRanged) {
|
||||
buffer.append('>');
|
||||
if (getDesc() != null && desc.length() > 0) {
|
||||
buffer.append("<desc>").append(StringUtils.escapeForXML(getDesc())).append("</desc>");
|
||||
buffer.append("<desc>").append(StringUtils.escapeForXmlText(getDesc())).append("</desc>");
|
||||
}
|
||||
if (isRanged()) {
|
||||
buffer.append("<range/>");
|
||||
|
|
|
@ -525,13 +525,13 @@ public class VCard extends IQ {
|
|||
private void updateFN() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (firstName != null) {
|
||||
sb.append(StringUtils.escapeForXML(firstName)).append(' ');
|
||||
sb.append(StringUtils.escapeForXml(firstName)).append(' ');
|
||||
}
|
||||
if (middleName != null) {
|
||||
sb.append(StringUtils.escapeForXML(middleName)).append(' ');
|
||||
sb.append(StringUtils.escapeForXml(middleName)).append(' ');
|
||||
}
|
||||
if (lastName != null) {
|
||||
sb.append(StringUtils.escapeForXML(lastName));
|
||||
sb.append(StringUtils.escapeForXml(lastName));
|
||||
}
|
||||
setField("FN", sb.toString());
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public class DataLayoutTest {
|
|||
+ "<text>SectionText - & \u00E9 \u00E1 </text>"
|
||||
+ "</section>"
|
||||
+ "<text>PageText - & \u00E9 \u00E1 </text>"
|
||||
+ "<section label='<html>Number of Persons by<br/> Nationality and Status</html>'>"
|
||||
+ "<section label='<html>Number of Persons by<br/> Nationality and Status</html>'>"
|
||||
+ "<reportedref/>"
|
||||
+ "</section>"
|
||||
+ "<text><html><font color='red'><em>DO NOT DELAY</em></font><br/>supply further information</html></text>"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</section>
|
||||
<text>PageText - & é á </text>
|
||||
<section
|
||||
label='<html>Number of Persons by<br/> Nationality and Status</html>'>
|
||||
label='<html>Number of Persons by<br/> Nationality and Status</html>'>
|
||||
<reportedref />
|
||||
</section>
|
||||
<text><![CDATA[<html><font color='red'><em>DO NOT DELAY</em></font><br/>supply further information</html>]]></text>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue