I'm looking for a solution that doesn't use extra dependencies if possible, just the code to do it.
(我正在寻找一种解决方案,如果可能的话,它不会使用额外的依赖关系,而只是使用代码即可。)
The use case is that I need to grab some user input from the browser that will be in XML format.
(用例是我需要从浏览器中获取一些XML格式的用户输入。)
Then I need to minify that XML (pending), then escape it (done), and store it in a DB.(然后,我需要缩小该XML(待处理),然后对其进行转义(完成),并将其存储在DB中。)
I've searched around a bunch but haven't been able to find a code snippet to do this.
(我已经搜索了一堆,但是还没有找到执行此操作的代码段。)
If I have some XML like:
(如果我有一些类似的XML:)
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
I'd like to convert it in my JavaScript program to be:
(我想将其在我的JavaScript程序中转换为:)
<note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></note>
Much in the same way like if I was using VSCode and the XML Tool and clicked "Minify XML".
(就像我使用VSCode和XML Tool并单击“缩小XML”一样。)
ask by SuperCow translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…