Skip to content

Documentation / @sw-file-lib/xml / xml-schema / SwXmlPath

Type Alias: SwXmlPath ​

ts
type SwXmlPath = readonly {
  index: number;
  tag: string;
}[];

Defined in: packages/xml/src/xml-schema/types.ts:50

A path identifying an element in an XML document.

Each segment contains the zero-based index of the element among its sibling elements and the element's tag name.

The path starts with the root element.

Example ​

For the following XML:

xml
<root>
  <a/>
  <b>
    <c/>
  </b>
</root>

the path to <c> is:

ts
[
  { index: 0, tag: "root" },
  { index: 1, tag: "b" },
  { index: 0, tag: "c" },
]