* Get child elements, optionally filtered by localName (namespace-agnostic). * If no localName is given, returns all direct child elements.
(localName?: string)
| 48 | * If no localName is given, returns all direct child elements. |
| 49 | */ |
| 50 | children(localName?: string): SafeXmlNode[] { |
| 51 | if (!this.el) return [] |
| 52 | const result: SafeXmlNode[] = [] |
| 53 | const children = this.el.children |
| 54 | for (let i = 0; i < children.length; i++) { |
| 55 | if (localName === undefined || children[i].localName === localName) { |
| 56 | result.push(new SafeXmlNode(children[i])) |
| 57 | } |
| 58 | } |
| 59 | return result |
| 60 | } |
| 61 | |
| 62 | /** Get the text content, or empty string if the element is missing. */ |
| 63 | text(): string { |
no test coverage detected