Options
All
  • Public
  • Public/Protected
  • All
Menu

@azure/core-xml

Package version

Index

Variables

Const XML_ATTRKEY

XML_ATTRKEY: "$" = "$"

Default key used to access the XML attributes.

Const XML_CHARKEY

XML_CHARKEY: "_" = "_"

Default key used to access the XML value content.

Const doc

doc: Document = document.implementation.createDocument(null, null, null)

Let errorNS

errorNS: string | undefined

Const parser

parser: DOMParser = new DOMParser()

Const serializer

serializer: XMLSerializer = new XMLSerializer()

Const xml2jsBuilderSettings

xml2jsBuilderSettings: any = Object.assign({}, xml2jsDefaultOptionsV2)

Const xml2jsParserSettings

xml2jsParserSettings: any = Object.assign({}, xml2jsDefaultOptionsV2)

Functions

asElementWithAttributes

  • asElementWithAttributes(node: Node): Element | undefined
  • Get the Element-typed version of the provided Node if the provided node is an element with attributes. If it isn't, then undefined is returned.

    Parameters

    • node: Node

    Returns Element | undefined

buildAttributes

  • buildAttributes(attrs: {}): Attr[]
  • Parameters

    • attrs: {}
      • [key: string]: { toString: any }

    Returns Attr[]

buildNode

  • buildNode(obj: any, elementName: string, options: Required<XmlOptions>): Node[]

domToObject

  • domToObject(node: Node, options: Required<XmlOptions>): any

getErrorNamespace

  • getErrorNamespace(): string

isElement

  • isElement(node: Node): node is Element

parseXML

  • parseXML(str: string, opts?: XmlOptions): Promise<any>
  • Converts given XML string into JSON

    Parameters

    • str: string

      String containing the XML content to be parsed into JSON

    • Default value opts: XmlOptions = {}

      Options that govern the parsing of given xml string includeRoot indicates whether the root element is to be included or not in the output

    Returns Promise<any>

stringifyXML

  • stringifyXML(obj: any, opts?: XmlOptions): string
  • Converts given JSON object to XML string

    Parameters

    • obj: any

      JSON object to be converted into XML string

    • Default value opts: XmlOptions = {}

      Options that govern the XML building of given JSON object rootName indicates the name of the root element in the resulting XML

    Returns string

throwIfError

  • throwIfError(dom: Document): void

Object literals

Const xml2jsDefaultOptionsV2

xml2jsDefaultOptionsV2: object

async

async: boolean = false

attrNameProcessors

attrNameProcessors: undefined = undefined

attrValueProcessors

attrValueProcessors: undefined = undefined

attrkey

attrkey: string = XML_ATTRKEY

cdata

cdata: boolean = false

charsAsChildren

charsAsChildren: boolean = false

childkey

childkey: string = "$$"

chunkSize

chunkSize: number = 10000

doctype

doctype: undefined = undefined

emptyTag

emptyTag: string = ""

explicitArray

explicitArray: boolean = true

explicitCharkey

explicitCharkey: boolean = false

explicitChildren

explicitChildren: boolean = false

explicitRoot

explicitRoot: boolean = true

headless

headless: boolean = false

ignoreAttrs

ignoreAttrs: boolean = false

includeWhiteChars

includeWhiteChars: boolean = false

mergeAttrs

mergeAttrs: boolean = false

normalize

normalize: boolean = false

normalizeTags

normalizeTags: boolean = false

preserveChildrenOrder

preserveChildrenOrder: boolean = false

rootName

rootName: string = "root"

strict

strict: boolean = true

tagNameProcessors

tagNameProcessors: undefined = undefined

trim

trim: boolean = false

validator

validator: undefined = undefined

valueProcessors

valueProcessors: undefined = undefined

xmlns

xmlns: boolean = false

renderOpts

renderOpts: object

indent

indent: string = " "

newline

newline: string = ""

pretty

pretty: boolean = true

xmldec

xmldec: object

encoding

encoding: string = "UTF-8"

standalone

standalone: boolean = true

version

version: string = "1.0"

Generated using TypeDoc