Interface XMLParseOptions

Hierarchy

  • XMLParseOptions

Properties

arrayMode?: boolean | ((nodePath) => any)

When true always return arrays for nodes even if there is only one child node. If false return the node as an object when there is only one child node. Or use a function to determine if the node should be an array or not.

Type declaration

    • (nodePath): any
    • Parameters

      • nodePath: string

      Returns any

ignoreAttributes?: boolean

When true the parser will ignore attributes and only parse the node name and value.

Default

false
ignoreNamespacePrefix?: boolean

When true the parser will ignore namespace prefixes in tags and attributes. The returned object will not contain any namespace prefixes.

Default

false
skipValidation?: boolean

When true the passed string will not be checked if it is a valid XML string. Set to true when you know the string is valid XML and you want to skip the validation. allowing for faster parsing of the XML.

Default

false
trimValues?: boolean

When true the parser will trim white spaces values of text nodes. When not set defaults to true. When false all whitespace characters from the text node are preserved.

Remark

\r\n is normalized to \n

Default

true
valueProcessor?: ((value, nodePath) => any)

Type declaration

    • (value, nodePath): any
    • Process the value of a node before returning it to the node. Useful for converting values to a specific type. If you return undefined the node is ignored.

      Parameters

      • value: string

        Value of the node

      • nodePath: string

        full path of the node seperated by dots, i.e. rootTag.innerTag. For attributes the path is prefixed with @, i.e. rootTag.innerTag.@attr

      Returns any