The approach this library uses is totally wrong.
|
// 去掉两端空格和注释 |
|
xml = xml.trim() |
|
xml = xml.replace(/<!--[\s\S]*?-->/g, "") |
For a minimal test case like below,
<a attr="<!--not a comment-->"></a>
The expected result is
{ name: "a", attributes: { attr: "<!--not a comment-->" } }
However, the actual result is
{ name: "a", attributes: { attr: "" } }
The approach this library uses is totally wrong.
ts-xml-parser/src/parser.ts
Lines 38 to 40 in b7e21b3
For a minimal test case like below,
The expected result is
However, the actual result is