Parse xml with metadata capture on and return a Map of rawTagName -> raw text span.
(xml)
| 20 | |
| 21 | /** Parse xml with metadata capture on and return a Map of rawTagName -> raw text span. */ |
| 22 | function parseSpans(xml) { |
| 23 | const parser = new XMLParser({ preserveOrder: true, ignoreAttributes: false, captureMetaData: true }); |
| 24 | const result = parser.parse(xml); |
| 25 | return new Map(collectMeta(result).map(([tag, m]) => [tag, xml.slice(m.startIndex, m.endIndex)])); |
| 26 | } |
| 27 | |
| 28 | describe("XMLParser captureMetaData endIndex", function () { |
| 29 | it("does not add metadata (start or end) when captureMetaData is off", function () { |
no test coverage detected