Are you tried of formatting the xml ? Here the solution to automate the process in Editplus.
Download the latest version of Editplus.
Step 1 : Save the below script as xmlformattingscript.js.
var stdin = WScript.StdIn;
var stdout = WScript.StdOut;
var xml = WScript.createObject("MSXML2.DomDocument");
xml.loadXML(stdin.ReadAll().replace(/\t/g, '').replace(/\r|\n/g, '').replace(/\>\</g, '>\n<'));
stdout.Write(xml.xml.substr(0, xml.xml.length-2));
Step 2 : Open Editplus and navigate to Tools –> Configure user tools… –> Add tools –> Program
Step 3 : In Menu text box type XML Formatter
Step 4 : In Command box type
cscript //NoLogo “path to xmlformattingscript.js”
Step 5 : Check the “Run as text filter”.
Step 6 : Apply and OK.
Testing the tool
1) Open unformatted xml file.
Example
<root><text>
</text> </root>
2) Tools –> XML Formatter
Formatted xml
<root>
<test>
</test>
</root>
Reference http://editplus.info/wiki/Writing_a_text_filter
Enjoy ;)
~Barath.
25 comments:
Thank you so much!! you saved my lot of time
Chetan!!
ektasoftwares.com
Excellent ! THANKS
Excellent ! THANKS
Great! thanks
Extremely simple to setup and very useful for me to debug some Soap logs.. Thanks a million!!
AWESOME!.. thanks so much for this. Exactly what I was looking for and beautifully simple description of how to do it.
A couple of things, related with the new Editplus 3:
1.- You've got to save the JavaScript file under Editplus' installation folder; the program starts searching the script from there. And
2.- In the User Tool command definition, you must insert this code: "cscript //NoLogo //E:jscript [path_to_script]", select: "Current Line Text" or "Current Selection", acording with your needs, and "Run as text filter (Replace)".
Thanks anyway for the script; wonderful!
Thank you. It worked and helped me.
Just Awesome
Superb Amigo...It Helps a lot
Great tool; thank you for sharing!
I am using EditPlus v3.51 (463) and the instructions in the post worked perfectly.
The only difference I noticed was the need to select "Run as text filter (Replace)" from the dropdown instead of clicking the "Run as text filter" checkbox.
Dude,
You just made my day!
I had use your instruction and Arturo Garcia Martin's instruction to get it working.
Commmand:
cscript //NoLogo "C:\Program Files (x86)\EditPlus 3\xmlformattingscript.js"
Argument: $(CurSel)
save and then select the xml file you want to format before running the tool.
Much Gratitude to Mr. BARATH. Very helpful tool.
I'm getting a strange result. If I open a 6MB XML file and then select the entire file (Edit > Select > Select All or just type Ctrl+A) and then run the script, I get:
Cannot create process.
The filename or extension is too long.
But... if I open the 6MB XML file and don't select any of the text and then run the script, then it works and produces a beautiful 230,411 line long XML document.
Thank you so much. You saved my day (and a lot of time)
Thank you so much. Very good tool!
Another thing...
New HTML5 Header TAG is unrecognizable: ""
An improved version:
var stdin = WScript.StdIn;
var stdout = WScript.StdOut;
var xmlDoc = WScript.createObject("Msxml2.DOMDocument.6.0");
var text = stdin.ReadAll();
// First pass...
text = text.replace(/\t/g, '');
// Second pass...
text = text.replace(/\r|\n/g, '');
// Third pass...
text = text.replace(/\>\\n<');
// Load...
xmlDoc.loadXML( text );
// Output
if (xmlDoc.parseError.errorCode != 0) {
var myErr = xmlDoc.parseError;
WScript.Echo("You have error " + myErr.reason);
} else {
stdout.Write( xmlDoc.xml.substr(0, xmlDoc.xml.length-2) );
}
Excellent! You saved my day, Sir!
Thank you so much! :)
Excellent. Very Helpful. Thanks
Works Great, Thank you!
Thanks a lot for this nice script !
I'm getting :
Cannot create process.
The filename or extension is too long.
God bless you ..awesome !
Great set of tips from the master himself. Excellent ideas. Anyone wishing to take their blogging forward must read these tips. Thank you .EditPlus Crack 5.3 Build 3080 With Serial Key Free Download
Input Error: There is no script engine for file extension ".js"".
Post a Comment