Function followPath

  • Walk through a path into an XML (or similar) document.

    Note that tag names must be unique. If you have an element like

      <parent>
    <twin />
    <twin />
    <unique />
    </parent>

    and you say followPath(parent, "twin") the result will be undefined because we don't know which twin to return. followPath(parent, "unique") will return the last child element.

    Returns

    The requested Element, or undefined if there were any problems.

    Parameters

    • from: undefined | Element

      Start from this element.

    • Rest ...path: readonly (string | number)[]

      A list of instructions, like 0 to take the first child element or a string to look for an element with that tag name.

    Returns Element | undefined

Generated using TypeDoc