| 502 | |
| 503 | //this function returns the line number for the character at the given index |
| 504 | function getLineNumberForPosition(xmlData, index) { |
| 505 | const lines = xmlData.substring(0, index).split(/\r?\n/); |
| 506 | return { |
| 507 | line: lines.length, |
| 508 | |
| 509 | // column number is last line's length + 1, because column numbering starts at 1: |
| 510 | col: lines[lines.length - 1].length + 1 |
| 511 | }; |
| 512 | } |
| 513 | |
| 514 | //this function returns the position of the first character of match within attrStr |
| 515 | function getPositionFromMatch(match) { |