| 1422 | |
| 1423 | // Find the ns:elem elements and check their URIs |
| 1424 | function findElement( |
| 1425 | children: readonly import("./types.ts").XmlNode[], |
| 1426 | name: string, |
| 1427 | ): import("./types.ts").XmlElement | undefined { |
| 1428 | for (const child of children) { |
| 1429 | if (child.type === "element") { |
| 1430 | if (child.name.local === name) return child; |
| 1431 | const found = findElement(child.children, name); |
| 1432 | if (found) return found; |
| 1433 | } |
| 1434 | } |
| 1435 | return undefined; |
| 1436 | } |
| 1437 | |
| 1438 | const elem1 = findElement(doc.root.children, "elem1"); |
| 1439 | const elem2 = findElement(doc.root.children, "elem2"); |