Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
正在查找node.js的XML缩小器_Xml_Minify - Fatal编程技术网

正在查找node.js的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"> <!--

我想在这个网站上为node.js寻找一个xml迷你程序

什么也找不到。 谢谢

不知道会这么容易。解决了。

查看我的NPM软件包。它允许您轻松快速地缩小XML:

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 &lt; 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 &lt; must always be encoded)
    </used:NamespaceTag>
 
    <![CDATA[<FakeTag attr = "content in CDATA tags is not minified"></FakeTag>]]>
</Tag>`;
 
console.log(minifyXML(xml));