Showing posts with label XML. Show all posts
Showing posts with label XML. Show all posts

Tuesday, April 1, 2014

XML Formatting in Edit Plus

I was thinking of writing a macro to help me format XML in Edit Plus. Fortunately, someone else already came up with a better solution 5 years ago.

In case this link ever dies, here's the code he used:
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));
This is why I love the internet.

Wednesday, March 5, 2014

Baby Steps

I am working on a pretty big C++ project to take XML, parse out certain fields in it, and then use it to populate various tables.
My first few efforts in writing this class were akin to giving a mouse a drink from a firehouse -- extremely frustrating, and not particularly enjoyable or profitable. It dampened my fur, to say the least.

But then I remembered some of the best programming advice I ever received, and that has helped things to go better.

When in doubt, remember Bob's method: baby steps. It'll make you feel much better.