Options
All
  • Public
  • Public/Protected
  • All
Menu

js2xmlparser

Index

Functions

Private getHandler

  • getHandler(value: unknown, options: Options): ((value: unknown) => unknown) | undefined
  • Gets the type handler associated with a value.

    Parameters

    Returns ((value: unknown) => unknown) | undefined

Private isArray

  • isArray(val: unknown): val is unknown[]
  • Parameters

    • val: unknown

    Returns val is unknown[]

Private isFunction

  • isFunction(val: unknown): val is Function
  • Parameters

    • val: unknown

    Returns val is Function

Private isMap

  • isMap(val: unknown): val is Map<unknown, unknown>
  • Parameters

    • val: unknown

    Returns val is Map<unknown, unknown>

Private isNull

  • isNull(val: unknown): val is null
  • Parameters

    • val: unknown

    Returns val is null

Private isObject

  • isObject(val: unknown): val is Record<string, unknown>
  • Parameters

    • val: unknown

    Returns val is Record<string, unknown>

Private isSet

  • isSet(val: unknown): val is Set<unknown>
  • Parameters

    • val: unknown

    Returns val is Set<unknown>

Private isUndefined

  • isUndefined(val: unknown): val is undefined
  • Parameters

    • val: unknown

    Returns val is undefined

parse

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

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

    Parameters

    • root: string
    • object: unknown
    • Optional options: IOptions

    Returns string

Private parseArrayOrSet

  • parseArrayOrSet(key: string, arrayOrSet: unknown[] | Set<unknown>, parentElement: XmlElement<unknown>, options: Options): void
  • Parses an array or Set into XML and adds it to the parent element.

    Parameters

    • key: string
    • arrayOrSet: unknown[] | Set<unknown>
    • parentElement: XmlElement<unknown>
    • options: Options

    Returns void

Private parseAttribute

  • parseAttribute(name: string, value: string, parentElement: XmlElement<unknown>, options: Options): void
  • Parses an attribute into XML and adds it to the parent element.

    Parameters

    • name: string
    • value: string
    • parentElement: XmlElement<unknown>
    • options: Options

    Returns void

Private parseObjectOrMap

  • parseObjectOrMap(objectOrMap: Record<string, unknown> | Map<unknown, unknown>, parentElement: XmlElement<unknown>, options: Options): void
  • Parses an Object or Map into XML and adds it to the parent element.

    Parameters

    • objectOrMap: Record<string, unknown> | Map<unknown, unknown>
    • parentElement: XmlElement<unknown>
    • options: Options

    Returns void

Private parseObjectOrMapEntry

  • parseObjectOrMapEntry(key: string, value: unknown, parentElement: XmlElement<unknown>, options: Options): void
  • Parses an object or Map entry into XML and adds it to the parent element.

    Parameters

    • key: string
    • value: unknown
    • parentElement: XmlElement<unknown>
    • options: Options

    Returns void

Private parseString

  • parseString(str: string, parentElement: XmlAttribute<unknown> | XmlElement<unknown>, options: Options): void
  • Parses a string into XML and adds it to the parent element or attribute.

    Parameters

    • str: string
    • parentElement: XmlAttribute<unknown> | XmlElement<unknown>
    • options: Options

    Returns void

parseToExistingElement

  • parseToExistingElement(element: XmlElement<unknown>, object: unknown, options?: IOptions): void
  • Converts the specified object to XML and adds the XML representation to the specified XmlDocument object using the specified options.

    This function does not add a root element. In addition, it does not add an XML declaration or DTD, and the associated options in IOptions are ignored. If desired, these must be added manually.

    Parameters

    • element: XmlElement<unknown>
    • object: unknown
    • Optional options: IOptions

    Returns void

Private parseValue

  • parseValue(key: string, value: unknown, parentElement: XmlElement<unknown>, options: Options): void
  • Parses an arbitrary JavaScript value into XML and adds it to the parent element.

    Parameters

    • key: string
    • value: unknown
    • parentElement: XmlElement<unknown>
    • options: Options

    Returns void

Private stringify

  • stringify(value: any): string
  • Returns a string representation of the specified value, as given by the value's toString() method (if it has one) or the global String() function (if it does not).

    Parameters

    • value: any

      The value to convert to a string.

    Returns string

    A string representation of the specified value.

Generated using TypeDoc