@rgrove/parse-xml - v5.2.0
    Preparing search index...

    Type Alias ParserOptions

    type ParserOptions = {
        ignoreUndefinedEntities?: boolean;
        includeOffsets?: boolean;
        maxElementDepth?: number;
        preserveCdata?: boolean;
        preserveComments?: boolean;
        preserveDocumentType?: boolean;
        preserveXmlDeclaration?: boolean;
        rejectAttributeListDeclarations?: boolean;
        resolveUndefinedEntity?: (entity: string) => string | null | undefined;
        sortAttributes?: boolean;
    }
    Index
    ignoreUndefinedEntities?: boolean

    When true, an undefined named entity (like "&bogus;") will be left in the output as is instead of causing a parse error.

    false
    
    includeOffsets?: boolean

    When true, the starting and ending byte offsets of each node in the input string will be made available via start and end properties on the node.

    false
    
    maxElementDepth?: number

    Maximum depth to which elements may be nested. The root element has a depth of 1. A document with elements nested more deeply than this will be rejected with a parse error.

    This limit prevents a deeply nested document from exhausting the call stack while it's being parsed, as well as when the resulting node tree is traversed recursively (including by toJSON() and JSON.stringify()). libxml2 uses a similar default limit.

    Set this to Infinity to disable the limit, but beware that parsing a deeply nested document or recursively traversing the resulting node tree may then throw a RangeError by exhausting the call stack.

    256
    
    preserveCdata?: boolean

    When true, CDATA sections will be preserved in the document as XmlCdata nodes. Otherwise CDATA sections will be represented as XmlText nodes, which keeps the node tree simpler and easier to work with.

    false
    
    preserveComments?: boolean

    When true, comments will be preserved in the document as XmlComment nodes. Otherwise comments will not be included in the node tree.

    false
    
    preserveDocumentType?: boolean

    When true, a document type declaration (if present) will be preserved in the document as an XmlDocumentType node. Otherwise the declaration will not be included in the node tree.

    Note that when this is true and a document type declaration is present, the DTD will precede the root node in the node tree (normally the root node would be first).

    false
    
    preserveXmlDeclaration?: boolean

    When true, an XML declaration (if present) will be preserved in the document as an XmlDeclaration node. Otherwise the declaration will not be included in the node tree.

    Note that when this is true and an XML declaration is present, the XML declaration will be the first child of the document (normally the root node would be first).

    false
    
    rejectAttributeListDeclarations?: boolean

    When true, a document will be rejected with a parse error if its DTD internal subset contains an attribute-list declaration (<!ATTLIST ...>) or a parameter entity reference (like %foo;), since parse-xml doesn't expand parameter entities and the replacement text of one could contain an attribute-list declaration.

    parse-xml ignores attribute-list declarations. Other XML parsers may use them to add default attribute values to elements or to normalize the whitespace in attribute values, so they could see different attributes than parse-xml sees in the same document. Enable this option if your application relies on parse-xml and another XML parser interpreting the same untrusted document the same way.

    This option doesn't affect external DTDs. parse-xml never loads them, but other XML parsers may.

    false
    
    resolveUndefinedEntity?: (entity: string) => string | null | undefined

    When an undefined named entity is encountered, this function will be called with the entity as its only argument. It should return a string value with which to replace the entity, or null or undefined to treat the entity as undefined (which may result in a parse error depending on the value of ignoreUndefinedEntities).

    sortAttributes?: boolean

    When true, attributes in an element's attributes object will be sorted in alphanumeric order by name. Otherwise they'll retain their original order as found in the XML.

    false