Fix reserved childNodes attribute check in JSONML
JSONML object-form parsing uses "childNodes" to store child elements, but the reserved-attribute check incorrectly used "childNode". This rejected ordinary "childNode" attributes while accepting "childNodes" attributes, whose values could then be overwritten by the element's children. Correct the reserved-attribute check to use "childNodes" and add JUnit 4 regression tests covering: - Rejection of reserved "childNodes" attributes in object-form parsing - Preservation of ordinary "childNode" attributes and child content - Continued rejection of reserved "tagName" attributes - Preservation of both attribute names in array-form parsing Verify each scenario with keepStrings enabled and disabled. Validation: - All 40 JSONML tests pass - Full test suite: 807 passed, 6 skipped on Java 11 with Gradle 8.13 - Both bug regression tests fail against the original implementation Fixes #1080
This commit is contained in:
@@ -205,7 +205,7 @@ public class JSONML {
|
||||
// attribute = value
|
||||
|
||||
attribute = (String)token;
|
||||
if (!arrayForm && ("tagName".equals(attribute) || "childNode".equals(attribute))) {
|
||||
if (!arrayForm && ("tagName".equals(attribute) || "childNodes".equals(attribute))) {
|
||||
throw x.syntaxError("Reserved attribute.");
|
||||
}
|
||||
token = x.nextToken();
|
||||
|
||||
Reference in New Issue
Block a user