vlocode-project - v1.40.0-beta-4
    Preparing search index...

    Interface XMLParseOptions

    interface XMLParseOptions {
        arrayMode?: boolean | ((nodePath: string) => any);
        attributeNode?: string;
        ignoreAttributes?: boolean;
        ignoreNamespacePrefix?: boolean;
        skipValidation?: boolean;
        trimValues?: boolean;
        valueProcessor?: (value: string, nodePath: string) => any;
    }
    Index

    Properties

    arrayMode?: boolean | ((nodePath: string) => 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.

    attributeNode?: string

    Defines the name of the node under which attributes in the JSON output are grouped. The default is $ for attributes groups.

    For example { attributeNode: '@attributes' } with the following XML:

    <innerTag attr="value" />
    

    Will result in the following JSON:

    "tag": {
    "@attributes": {
    "attr": "value"
    }
    }
    ignoreAttributes?: boolean

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

    false
    
    ignoreNamespacePrefix?: boolean

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

    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.

    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.

    \r\n is normalized to \n

    true
    
    valueProcessor?: (value: string, nodePath: string) => 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.

    Type Declaration

      • (value: string, nodePath: string): any
      • 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