1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 14:22:05 +01:00

Re-escape XML text in parseContentDepth()

SMACK-680.
This commit is contained in:
Florian Schmaus 2015-07-02 09:16:21 +02:00
parent a9741a8b10
commit e6a403fb1c

View file

@ -481,7 +481,7 @@ public class PacketParserUtils {
}
break;
case XmlPullParser.TEXT:
xml.append(parser.getText());
xml.escape(parser.getText());
break;
}
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
// 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())) {
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) {
break outerloop;