Sitemaps and selector trees

What a sitemap contains

A sitemap stores the start URLs and selectors required to navigate a website and extract structured records. It is not the same as a website XML sitemap.

  • Start URLs define the initial pages.
  • Navigation selectors discover or open additional pages.
  • Element selectors define repeated record boundaries.
  • Data selectors extract fields.
  • Parent-child relationships define execution context.

The root selector

_root represents each start URL. Selectors attached to _root run on every start page.

Parent and child selectors

A child selector can only access the page or element returned by its parent. For example, a Text selector placed below an Element selector extracts text inside each repeated item. A Text selector placed below a Link selector runs on the destination page opened by that link.

Selector execution order

Selectors with the same parent execute from top to bottom in the order shown in the selector tree. This order matters when one selector changes the page before another selector extracts data.

For example, if an Element Click selector reveals a phone number, place the click selector above the Text selector that extracts the phone number. If the Text selector runs first, the phone number is not yet available and will not be extracted.

link
├── Full Name
├── click
└── Phone Number

Reorder selectors when an interaction, navigation or page-state change must happen before a dependent selector runs.

Record boundaries

Use a repeated wrapper element to define one output record per item. Add individual field selectors beneath that wrapper. This prevents values from separate products, properties, jobs or directory entries from being combined incorrectly.

Navigation branches

A sitemap can contain more than one branch. Branches are appropriate when the same start page leads to different independent datasets. Do not create parallel multiple-value selectors when the fields are expected to remain paired. Use a common wrapper instead.

Design checklist

  • Start URLs are as specific as practical.
  • Every repeated dataset has an explicit record wrapper.
  • Selectors have stable names suitable for output columns.
  • Data Preview returns a consistent schema.

Related