我正在尝试使用 fast-xml-parser 在 React 应用程序中动态验证一些输入 xml。我只是使用开箱即用的默认选项,当我尝试 <test></test
时它返回为有效。
这里我输出我正在运行的文本 parser.validate()
以及它到控制台的返回值:
不要无礼,但我是否在选项中错过了“做正确且明显的事情”开关或其他内容?我之所以问这个问题,是因为我想发布一个问题,并且必须首先向 Stackoverflow 询问。
最佳答案
这显然是一个错误...
Not to be rude, but am I missing a "do the right and obvious thing" switch in the options or something? I'm asking because I want to post an issue, and asking Stackoverflow first is a requirement.
你没有无礼。 粗鲁是期望SO对错误报告进行分类(令人尴尬是要求通过这样的政策更多地关注错误)。
另请注意
fast-xml-parser
的作者滥用术语有效。
请参阅Well-formed vs Valid XML .
...但这比孤立的错误更糟糕:
来自 fast-xml-parser
limitations section :
Limitations
Currently FXP fails to parse XML with attributes has ">" in the value. This problem is left open as change in regex for its fix is degrading the performance. And the parser become very slow in case of long attrbute [sic] names.
- 任何基于正则表达式的 XML“解析器”都是一个玩具,不应该用于专业用途。
底线:这比孤立的错误更严重。这只是 fast-xml-parser
中严重设计缺陷的冰山一 Angular 。 建议:避免。
关于javascript - fast-xml-parser 认为结束标签在没有结束括号的情况下也是有效的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57980770/