正在查找node.js的XML缩小器
我想在这个网站上为node.js寻找一个xml迷你程序 什么也找不到。 谢谢 不知道会这么容易。解决了。查看我的NPM软件包。它允许您轻松快速地缩小XML:正在查找node.js的XML缩小器,xml,minify,Xml,Minify,我想在这个网站上为node.js寻找一个xml迷你程序 什么也找不到。 谢谢 不知道会这么容易。解决了。查看我的NPM软件包。它允许您轻松快速地缩小XML: const minifyXML = require("minify-xml").minify; const xml = `<Tag xmlns:used="used_ns" xmlns:unused="unused_ns"> <!--
const minifyXML = require("minify-xml").minify;
const xml = `<Tag xmlns:used="used_ns" xmlns:unused="unused_ns">
<!--
With the default options all comments will be removed, whitespace in
tags, like spaces between attributes, will be collapsed / removed and
elements without any content will be collapsed to empty tag elements
-->
<AnotherTag attributeA = "..." attributeB = "..." ></AnotherTag>
<!-- By default any unused namespaces will be removed from the tags: -->
<used:NamespaceTag used:attribute = "...">
any valid element content is left unaffected (strangely enough = " ... "
and even > are valid characters in XML, only < must always be encoded)
</used:NamespaceTag>
<![CDATA[<FakeTag attr = "content in CDATA tags is not minified"></FakeTag>]]>
</Tag>`;
console.log(minifyXML(xml));
在常用的XML缩略站点上,minify XML还可以缩略属性,并删除未使用的XML命名空间。这将删除CDATA块中的重要空白,而不会使用开始标记/结束标记语法替换空元素和自动关闭标记语法。
const minifyXML = require("minify-xml").minify;
const xml = `<Tag xmlns:used="used_ns" xmlns:unused="unused_ns">
<!--
With the default options all comments will be removed, whitespace in
tags, like spaces between attributes, will be collapsed / removed and
elements without any content will be collapsed to empty tag elements
-->
<AnotherTag attributeA = "..." attributeB = "..." ></AnotherTag>
<!-- By default any unused namespaces will be removed from the tags: -->
<used:NamespaceTag used:attribute = "...">
any valid element content is left unaffected (strangely enough = " ... "
and even > are valid characters in XML, only < must always be encoded)
</used:NamespaceTag>
<![CDATA[<FakeTag attr = "content in CDATA tags is not minified"></FakeTag>]]>
</Tag>`;
console.log(minifyXML(xml));