The XML document.

Hierarchy (View Summary)

Accessors

  • get root(): XmlElement
  • The root element of the document. If the document is newly created and hasn’t been set up with a root, an XmlError will be thrown.

    Returns XmlElement

  • set root(value: XmlElement): void
  • Set the root element of the document.

    Parameters

    • value: XmlElement

      The new root. If the node is from another document, it and its subtree will be removed from the previous document.

    Returns void

Methods

  • Dispose the object.

    It releases the managed resource and unregisters it from FinalizationRegistry. This ensures that the release of the managed resource doesn’t have to wait until the object is garbage collected.

    To avoid resource leaks, explicitly call the Dispose method or use the using declaration to declare the object.

    Returns void

  • Create the root element.

    Parameters

    • name: string

      The name of the root element.

    • Optionalnamespace: string

      The namespace of the root element.

    • Optionalprefix: string

      The prefix of the root node that represents the given namespace. If not provided, the given namespace will be the default.

    Returns XmlElement

  • Find all the descendant nodes of root element matching the given compiled xpath selector.

    Parameters

    Returns XmlNode[]

    An empty array if the provided XPath is invalid or if no nodes are found.

  • Find all the descendant nodes of root element matching the given xpath selector.

    Parameters

    • xpath: string

      XPath selector

    • Optionalnamespaces: NamespaceMap

      mapping between prefix and the namespace URI, used in the XPath

    Returns XmlNode[]

    An empty array if the provided XPath is invalid or if no nodes are found.