/** * XML Path Query Engine * * Simplified path expressions for querying XML DOM trees. * Covers the most common query patterns without the complexity of full XPath. * * Supported syntax: * - `a/b/c` — match child `a`, then child `b`, then child `c` * - `a/b[@id='1']` — match child `b` with attribute `id` equal to `"1"` * - `a/*​/c` — wildcard: any element name at that level * - `a//c` — recursive descent: `c` at any depth under `a` * - `a/b[0]` — index: first matching `b` under each parent `a` * * Functions: * - `query(el, path)` — first match or undefined * - `queryAll(el, path)` — all matches */ import type { XmlElement } from "./types.js"; /** * Find the first element matching a path expression. * * @param element - The context element to search from. * @param path - Simplified path expression. * @returns The first matching element, or undefined. * * @example * ```ts * const cell = query(doc.root, "sheetData/row/c[@r='A1']"); * const value = query(doc.root, "sheetData/row/c/v"); * const any = query(doc.root, "sheetData//v"); // recursive descent * ``` */ declare function query(element: XmlElement, path: string): XmlElement | undefined; /** * Find all elements matching a path expression. * * @param element - The context element to search from. * @param path - Simplified path expression. * @returns Array of all matching elements (may be empty). * * @example * ```ts * const rows = queryAll(doc.root, "sheetData/row"); * const cells = queryAll(doc.root, "sheetData/row/c"); * const allValues = queryAll(doc.root, "sheetData//v"); * ``` */ declare function queryAll(element: XmlElement, path: string): XmlElement[]; export { query, queryAll };