Type Alias ParserOptions

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

Type declaration

  • OptionalignoreUndefinedEntities?: boolean

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

    false
    
  • OptionalincludeOffsets?: 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
    
  • OptionalpreserveCdata?: 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
    
  • OptionalpreserveComments?: boolean

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

    false
    
  • OptionalpreserveDocumentType?: 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
    
  • OptionalpreserveXmlDeclaration?: 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
    
  • OptionalresolveUndefinedEntity?: ((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).

      • (entity): string | null | undefined
      • Parameters

        • entity: string

        Returns string | null | undefined

  • OptionalsortAttributes?: 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