JS achieve XML format online, compression, verification, XML transfer tool toolfk online Programmer toolbox - hubs/toolfk GitHub Wiki
This paper to recommend [ToolFk] is a programmers often use a free online test kit, ToolFk feature is focused on everyday programmer development tools, without having to install any software, as long as the content execution affixed by a button, able to obtain the contents of the desired results.ToolFk also supports BarCode Barcode generated online , QueryList collector , PHP code is run online , PHP confusion, encryption, decryption , Python code is run online , JavaScript online operation ,YAML formatting tools , HTTP simulation query tool , HTML online toolbox , JavaScript online Toolbox ,CSS online toolbox , JSON online toolbox , unixtime timestamp conversion , Base64 / the URL of / native2ascii conversion , CSV conversion kit , XML online toolbox , the WebSocket online tools , Markdown online toolbox , Htaccess2nginx conversion, Hex conversion online , online encryption toolkit ,online pseudo-original tools , online APK decompile , online web screenshot tool , online random password generation , online generate two-dimensional code qrcode , online Crontab Expression Builder ,the online short URL Generator , Online calculator tool . And more than 20 daily programmer development tools, can be considered a very comprehensive website programmer's toolbox.
Site name: ToolFk
website links: https://www.toolfk.com/
Tools link: https://www.toolfk.com/tool-format-xml
Teaching Code
This tool [JS achieve? XML format online, compression, verification, XML JSON transfer tool]?-Dependent code base is https://github.com/nashwaan/xml-js
STEP 1
STEP 2
? THE CORE CODE IS AS FOLLOWS
var xt = "", h3OK = 1;
function checkXML (e) {
var t, o, i = e.nodeName;
if ( "h3" == i) {
if (0 == h3OK)
return;
h3OK = 0
}
for ( "#text" == i && (xt = xt + e.nodeValue + "\ n"),
t = e.childNodes.length,
o = 0; o <t; o ++)
checkXML (e.childNodes [o])
}
xml_2_json: function (options) {
if (toolfk.beautify_default.beautify_in_progress) {
return;
}
var opts = $ .extend ({}, toolfk.beautify_default, options);
var source = opts.source.getValue ();
if (source == '') {
return layer.msg (NOT_EMPTY);
}
if (source.indexOf ( 'encoding = "UTF-8"') <0) {
source = '<xml version = "1.0" encoding = "UTF-8"??>' + source;
}
toolfk.beautify_default.beautify_in_progress = true;
var lastResult = xml2json (source, {compact: true, spaces: 4});
opts.target.setValue (lastResult);
toolfk.report ( 'xml_2_json', lastResult);
toolfk.beautify_default.beautify_in_progress = false;
},
beautify_xml: function (options) {
if (toolfk.beautify_default.beautify_in_progress) {
return;
}
var opts = $ .extend ({}, toolfk.beautify_default, options);
var source = opts.source.getValue ();
if (source == '') {
return layer.msg (NOT_EMPTY);
}
toolfk.beautify_default.beautify_in_progress = true;
var value = format (source, {method: 'xml'});
opts.target.setValue (value);
toolfk.report ( 'beautify_xml', value);
toolfk.beautify_default.beautify_in_progress = false;
},
It is worth a try for three reasons:
-
Integrate various programmers often used in development and testing tools.
-
Simple and beautiful atmosphere of the site pages
-
Online support formatting code execution, APK online decompile, online high-strength password generator, two dozen screenshots online web tools service
-
Also recommend its sister network www.videofk.com video download Toolbox
