mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-22 18:48:00 +01:00
Make parseElementText handle empty string elements
ie. elements which only content is the empty string, for example <body></body>. Fixes SMACK-598
This commit is contained in:
parent
9eb5c2a49d
commit
1e5f0eb749
1 changed files with 11 additions and 2 deletions
|
@ -182,8 +182,17 @@ public class PacketParserUtils {
|
|||
// Advance to the text of the Element
|
||||
int event = parser.next();
|
||||
if (event != XmlPullParser.TEXT) {
|
||||
throw new XmlPullParserException(
|
||||
"Non-empty element tag not followed by text, while Mixed Content (XML 3.2.2) is disallowed");
|
||||
if (event == XmlPullParser.END_TAG) {
|
||||
// Assume this is the end tag of the start tag at the
|
||||
// beginning of this method. Typical examples where this
|
||||
// happens are body elements containing the empty string,
|
||||
// ie. <body></body>, which appears to be valid XMPP, or a
|
||||
// least it's not explicitly forbidden by RFC 6121 5.2.3
|
||||
return "";
|
||||
} else {
|
||||
throw new XmlPullParserException(
|
||||
"Non-empty element tag not followed by text, while Mixed Content (XML 3.2.2) is disallowed");
|
||||
}
|
||||
}
|
||||
res = parser.getText();
|
||||
event = parser.next();
|
||||
|
|
Loading…
Reference in a new issue