mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-23 02:58:00 +01:00
Re-escape XML text in parseContentDepth()
SMACK-680.
This commit is contained in:
parent
a9741a8b10
commit
e6a403fb1c
1 changed files with 7 additions and 2 deletions
|
@ -481,7 +481,7 @@ public class PacketParserUtils {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XmlPullParser.TEXT:
|
case XmlPullParser.TEXT:
|
||||||
xml.append(parser.getText());
|
xml.escape(parser.getText());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
event = parser.next();
|
event = parser.next();
|
||||||
|
@ -497,7 +497,12 @@ public class PacketParserUtils {
|
||||||
// Only append the text if the parser is not on on an empty element' start tag. Empty elements are reported
|
// Only append the text if the parser is not on on an empty element' start tag. Empty elements are reported
|
||||||
// twice, so in order to prevent duplication we only add their text when we are on their end tag.
|
// twice, so in order to prevent duplication we only add their text when we are on their end tag.
|
||||||
if (!(event == XmlPullParser.START_TAG && parser.isEmptyElementTag())) {
|
if (!(event == XmlPullParser.START_TAG && parser.isEmptyElementTag())) {
|
||||||
sb.append(parser.getText());
|
CharSequence text = parser.getText();
|
||||||
|
if (event == XmlPullParser.TEXT) {
|
||||||
|
// TODO the toString() can be removed in Smack 4.2.
|
||||||
|
text = StringUtils.escapeForXML(text.toString());
|
||||||
|
}
|
||||||
|
sb.append(text);
|
||||||
}
|
}
|
||||||
if (event == XmlPullParser.END_TAG && parser.getDepth() <= depth) {
|
if (event == XmlPullParser.END_TAG && parser.getDepth() <= depth) {
|
||||||
break outerloop;
|
break outerloop;
|
||||||
|
|
Loading…
Reference in a new issue