BaseParseOptions
import { BaseParseOptions } from "jsr:@ende/xml";interface
interface BaseParseOptionsBase options shared by parsing functions.
Properties
ignoreWhitespace
readonly ignoreWhitespace?: booleanIf true, text nodes containing only whitespace are not emitted/included.
Default: false
ignoreComments
readonly ignoreComments?: booleanIf true, comments are not emitted/included.
Default: false
trackPosition
readonly trackPosition?: booleanIf true, track line/column positions for events and error messages. Disabling improves performance but makes debugging harder.
disallowDoctype
readonly disallowDoctype?: booleanIf true, DOCTYPE declarations are rejected immediately with an
XmlSyntaxError, before any internal subset is parsed.
This prevents resource exhaustion attacks via hostile DTD content.
Set to false to tolerate DOCTYPE declarations in trusted input (e.g.
legacy XHTML or RSS feeds). DTD contents are still not processed: custom
entity declarations are ignored, and external DTDs are never fetched.
Default: true
maxDepth
readonly maxDepth?: numberMaximum element nesting depth. Exceeding this throws
XmlSyntaxError. Prevents stack exhaustion from
deeply nested documents.
Default: Infinity
maxAttributes
readonly maxAttributes?: numberMaximum number of attributes per element. Exceeding this throws
XmlSyntaxError. Prevents memory exhaustion from
elements with huge attribute lists.
Default: Infinity
xmlVersion
readonly xmlVersion?: "1.0" | "1.1"XML version to use for character and line-ending validation.
When "1.1", the parser applies XML 1.1 rules:
- Character references to C0 controls (
–except�) are accepted - Literal C1 controls (
#x7F–#x9Fexcept#x85) are rejected - NEL (
#x85) and Unicode line separator (#x2028) are normalized to LF - Namespace prefix unbinding (
xmlns:prefix="") is allowed
This option is independent of the <?xml version="..."> declaration
in the document. Set it explicitly to handle documents that declare
version="1.0" but contain XML 1.1-style character references.
Default: "1.0"