| 410 | |
| 411 | //this function returns the line number for the character at the given index |
| 412 | function getLineNumberForPosition(xmlData, index) { |
| 413 | const lines = xmlData.substring(0, index).split(/\r?\n/); |
| 414 | return { |
| 415 | line: lines.length, |
| 416 | |
| 417 | // column number is last line's length + 1, because column numbering starts at 1: |
| 418 | col: lines[lines.length - 1].length + 1 |
| 419 | }; |
| 420 | } |
| 421 | |
| 422 | //this function returns the position of the first character of match within attrStr |
| 423 | function getPositionFromMatch(match) { |