Options
All
  • Public
  • Public/Protected
  • All
Menu

js2xmlparser

Index

Functions

Private isType

  • isType(val: any, ...types: string[]): boolean
  • Returns true if the specified value are of any of the specified types, as determined by the Object.prototype.toString.call function.

    Parameters

    • val: any

      The specified value.

    • Rest ...types: string[]

      The specified types.

    Returns boolean

    Whether or not the specified value are of any of the specified types.

parse

  • parse(root: string, object: any, options?: IOptions): string
  • Returns a XML string representation of the specified object.

    Parameters

    • root: string

      The name of the root XML element. When the object is converted to XML, it will be a child of this root element.

    • object: any

      The object to convert to XML.

    • Default value options: IOptions = {}

    Returns string

    An XML string representation of the specified object.

Private parseArrayOrSet

  • parseArrayOrSet(key: string, arrayOrSet: any, parentElement: XmlElement, options: IOptions): void
  • Parses an array or Set into XML.

    Parameters

    • key: string

      The key associated with the array or set to parse into XML.

    • arrayOrSet: any

      The array or set to parse into XML.

    • parentElement: XmlElement

      The XML element that will contain the function.

    • options: IOptions

      Options for parsing the array or set into XML.

    Returns void

Private parseAttribute

  • parseAttribute(name: string, value: string, parentElement: XmlElement, options: IOptions): void
  • Parses an attribute into XML.

    Parameters

    • name: string

      The name of the attribute.

    • value: string

      The value of the attribute.

    • parentElement: XmlElement

      The XML element that will contain the string.

    • options: IOptions

      Options for parsing the attribute into XML.

    Returns void

Private parseObjectOrMap

  • parseObjectOrMap(objectOrMap: any, parentElement: XmlElement, options: IOptions): void
  • Parses an Object or Map into XML.

    Parameters

    • objectOrMap: any

      The object or map to parse into XML.

    • parentElement: XmlElement

      The XML element that will contain the object.

    • options: IOptions

      Options for parsing the object into XML.

    Returns void

Private parseObjectOrMapEntry

  • parseObjectOrMapEntry(key: string, value: any, parentElement: XmlElement, options: IOptions): void
  • Parses an object or Map entry into XML.

    Parameters

    • key: string

      The key associated with the object or Map entry.

    • value: any

      The object or map entry.

    • parentElement: XmlElement

      The XML element that will contain the object or map entry.

    • options: IOptions

      Options for parsing the object or map entry into XML.

    Returns void

Private parseString

  • parseString(str: string, parentElement: XmlAttribute | XmlElement, options: IOptions): void
  • Parses a string into XML.

    Parameters

    • str: string

      The string to parse into XML.

    • parentElement: XmlAttribute | XmlElement

      The XML element or attribute that will contain the string.

    • options: IOptions

      Options for parsing the string into XML.

    Returns void

Private parseToDocument

  • parseToDocument(root: string, value: any, options: IOptions): XmlDocument
  • Returns a XML document corresponding to the specified value.

    Parameters

    • root: string

      The name of the root XML element. When the value is converted to XML, it will be a child of this root element.

    • value: any

      The value to convert to XML.

    • options: IOptions

      Options for parsing the value into XML.

    Returns XmlDocument

    An XML document corresponding to the specified value.

Private parseValue

  • parseValue(key: string, value: any, parentElement: XmlElement, options: IOptions): void
  • Parses an arbitrary JavaScript value into XML.

    Parameters

    • key: string

      The key associated with the value to parse into XML.

    • value: any

      The value to parse into XML.

    • parentElement: XmlElement

      The XML element that will contain the value.

    • options: IOptions

      Options for parsing the value into XML.

    Returns void

Private stringify

  • stringify(value: any): string
  • Converts a value into a string.

    Parameters

    • value: any

      The value to convert to a string.

    Returns string

    The string representation of the specified value.

Private validateCdataKeys

  • validateCdataKeys(cdataKeys: string[]): string[]
  • Validates the cdataKeys property of an options object.

    Parameters

    • cdataKeys: string[]

      The cdataKeys object.

    Returns string[]

    The updated cdataKeys object.

Private validateDecl

  • Validates the declaration property of an options object.

    Parameters

    Returns IDeclarationOptions

    The updated declaration object.

Private validateDtd

  • Validates the dtd property of an options object.

    Parameters

    Returns IDtdOptions

    The updated dtd object.

Private validateOptions

  • Validates an options object and replaces undefined values with their appropriate defaults.

    Parameters

    • options: IOptions

      The options object to validate.

    Returns IOptions

    The updated options object.

Private validateTypeHandlers

  • Validates the typeHandlers property of an options object.

    Parameters

    Returns ITypeHandlers

    The updated typeHandlers object.

Private validateWrapHandlers

  • Validates the wrapHandlers property of an options object.

    Parameters

    Returns IWrapHandlers

    The updated wrapHandlers object.

Object literals

Private defaults

defaults: object

aliasString

aliasString: string = "="

attributeString

attributeString: string = "@"

cdataInvalidChars

cdataInvalidChars: boolean = false

cdataKeys

cdataKeys: Array<undefined> = []

format

format: object

Type declaration

typeHandlers

typeHandlers: object

Type declaration

valueString

valueString: string = "#"

wrapHandlers

wrapHandlers: object

Type declaration

declaration

declaration: object

include

include: boolean = true

dtd

dtd: object

include

include: boolean = false

Generated using TypeDoc