* find paired tag for a stop node * @param {string} xmlData * @param {string} tagName * @param {number} i
(xmlData, tagName, i)
| 751 | * @param {number} i |
| 752 | */ |
| 753 | function readStopNodeData(xmlData, tagName, i) { |
| 754 | const startIndex = i; |
| 755 | // Starting at 1 since we already have an open tag |
| 756 | let openTagCount = 1; |
| 757 | |
| 758 | const xmllen = xmlData.length; |
| 759 | for (; i < xmllen; i++) { |
| 760 | if (xmlData[i] === "<") { |
| 761 | const c1 = xmlData.charCodeAt(i + 1); |
| 762 | if (c1 === 47) {//close tag '/' |
| 763 | const closeIndex = findClosingChar(xmlData, ">", i, `${tagName} is not closed`); |
| 764 | let closeTagName = xmlData.substring(i + 2, closeIndex).trim(); |
| 765 | if (closeTagName === tagName) { |
| 766 | openTagCount--; |
| 767 | if (openTagCount === 0) { |
| 768 | return { |
| 769 | tagContent: xmlData.substring(startIndex, i), |
| 770 | i: closeIndex |
| 771 | } |
| 772 | } |
| 773 | } |
| 774 | i = closeIndex; |
| 775 | } else if (c1 === 63) { //? |
| 776 | const closeIndex = findClosingIndex(xmlData, "?>", i + 1, "StopNode is not closed.") |
| 777 | i = closeIndex; |
| 778 | } else if (c1 === 33 |
| 779 | && xmlData.charCodeAt(i + 2) === 45 |
| 780 | && xmlData.charCodeAt(i + 3) === 45) { // '!--' |
| 781 | const closeIndex = findClosingIndex(xmlData, "-->", i + 3, "StopNode is not closed.") |
| 782 | i = closeIndex; |
| 783 | } else if (c1 === 33 |
| 784 | && xmlData.charCodeAt(i + 2) === 91) { // '![' |
| 785 | const closeIndex = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2; |
| 786 | i = closeIndex; |
| 787 | } else { |
| 788 | const tagData = readTagExp(xmlData, i, false) |
| 789 | |
| 790 | if (tagData) { |
| 791 | const openTagName = tagData && tagData.tagName; |
| 792 | if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length - 1] !== "/") { |
| 793 | openTagCount++; |
| 794 | } |
| 795 | i = tagData.closeIndex; |
| 796 | } |
| 797 | } |
| 798 | } |
| 799 | }//end for loop |
| 800 | } |
| 801 | |
| 802 | function parseValue(val, shouldParse, options) { |
| 803 | if (shouldParse && typeof val === 'string') { |
nothing calls this directly
no test coverage detected