fix(serialize-xml): Don't require ending semicolon of reference when lenient in NativeXmlReader
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Johannes Frohnmeyer 2024-04-20 23:18:24 +02:00
parent ca746c05a4
commit 12aec5bfda
Signed by: Johannes
GPG Key ID: E76429612C2929F4

View File

@ -378,14 +378,18 @@ public class NativeXmlReader implements Closeable {
// read the entity reference
// we don't support these, so just handle them like a normal string
String result = nextName();
if (buffer[pos] != ';') throw syntaxError("Missing ';' in entity reference");
pos++;
if (result.equals("apos")) return "'";
if (result.equals("quot")) return "\"";
if (result.equals("amp")) return "&";
if (result.equals("lt")) return "<";
if (result.equals("gt")) return ">";
return "&" + result + ";";
if (buffer[pos] != ';') {
if (!lenient) throw syntaxError("Missing ';' in entity reference");
return "&" + result;
} else {
pos++;
if (result.equals("apos")) return "'";
if (result.equals("quot")) return "\"";
if (result.equals("amp")) return "&";
if (result.equals("lt")) return "<";
if (result.equals("gt")) return ">";
return "&" + result + ";";
}
}
}