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