Repository navigation
Added
- Added a new
maxElementDepthparser option, which limits how deeply elements may be nested. A document that exceeds the limit is rejected with anXmlError. The default limit is 256, so documents with elements nested more deeply than that will now be rejected unless you raise the limit. Previously, a deeply nested document could cause the parser, or recursive traversal of the resulting node tree, to throw aRangeErrorby exhausting the call stack. #54
Fixed
-
An XML declaration with no whitespace between the encoding declaration and the standalone declaration (e.g.
<?xml version="1.0" encoding="UTF-8"standalone="yes"?>) is now rejected, as required by the XML spec. #53 -
An XML declaration with an empty or incomplete encoding or standalone declaration (e.g.
encoding="",encoding=, orstandalonewithout a value) is now rejected. Previously, the invalid declaration was silently ignored. -
A doctype declaration with no whitespace before its system identifier (e.g.
<!DOCTYPE a SYSTEM"a.dtd">or<!DOCTYPE a PUBLIC "a""a.dtd">) is now rejected, as required by the XML spec. -
Parsing a text node, CDATA section, comment, or processing instruction that contains many carriage returns is no longer extremely slow. Line break normalization previously took time proportional to the square of the number of carriage returns, so a document containing a few hundred kilobytes of carriage returns could take many seconds to parse.
-
XmlNode#documentandXmlNode#isRootNodeno longer recurse up the node tree, so they can no longer exhaust the call stack in a deeply nested tree.isRootNodeis also faster, which speeds uptoJSON().
Full Changelog: v5.1.0...v5.2.0