/** * XML helpers that tolerate namespace prefixes. * * OOXML serialisers are allowed to write `` or `` — * both are legal in the same schema. All validator checks must therefore * match on the **local name**, not the prefixed name. These helpers also * tolerate namespaced attributes like `r:id` vs `ns0:id`. */ import { findChildren } from "../../../xml/dom.js"; import type { XmlDocument, XmlElement } from "../../../xml/types.js"; /** * Extract the local name from a tag name, i.e. the part after the last `:`. * For `drawing` returns `drawing`; for `x:drawing` returns `drawing`. */ export declare function localName(name: string): string; /** Namespace-insensitive element-name equality. */ export declare function matchesLocal(name: string, target: string): boolean; /** Find first child element with matching **local** name. */ export declare function findChildLocal(el: XmlElement, local: string): XmlElement | undefined; /** Find all child elements with matching **local** name. */ export declare function findChildrenLocal(el: XmlElement, local: string): XmlElement[]; /** `true` when any descendant (or self) has matching local name. */ export declare function hasDescendantLocal(root: XmlElement, local: string): boolean; /** Collect all descendants (including self) matching local name. */ export declare function collectDescendantsLocal(root: XmlElement, local: string): XmlElement[]; /** * Read an attribute by local name. The OOXML convention is to use * namespaced attributes like `r:id` but some serialisers strip or * renumber the prefix. We match by suffix `:` or exact `local`. */ export declare function attrByLocalName(el: XmlElement, local: string): string | undefined; /** * Parse an XML string into a DOM tree. Returns `undefined` and records the * failure as a malformed XML problem via `onMalformed`. We don't throw * because validators must continue after a parse failure. */ export declare function tryParseXml(xml: string, onMalformed: (err: Error) => void): XmlDocument | undefined; export { findChildren };