> From: Logan Owen >Sent: Friday, February 24, 2012 10:13 AM > Dave, > > First off, I want to say that I really appreciate the work you have > done. generateDS has made my life so much easier. >
Logan - Thanks for that comment. It's rewarding to learn that generateDS.py has been useful. And, saving time for users is what this kind of work is all about. > One minor "short coming" that I have encountered, is the lack of > ability to switch between pretty printing (newlines and indents) and > "compressed" output when exporting generated XML. I use generateDS > in a distributed fashion to create a fairly high volume of XML > messages sent through a message broker, and in production I would > like to strip down the messages as much as possible. > > If this is something you also believe to be a useful feature, I will > put together a patch and pass it on to you. Yes, I also believe that would be a useful feature. And, I agree that generating XML transactions or structured data to be sent across the wire for machine processing (as opposed to being read by human eyes) is one class of use cases that generateDS.py should support. And, now that you mention it, I wish I had thought of it myself. And, a patch or bit of code would be great. You're likely to steer me in the direction of something that is more useful to you. But, until I find the time to put that in, here are a couple of alternatives, although I suspect you may have tried them already yourself: 1. Replace the function showIndent in a generated module with a function that does not write out whitespace. You will still have carriage returns, but eliminating the blanks will reduce the size significantly. If your app/script is importing the module generated by generateDS.py, this is easy to do. I've attached an example that does it. 2. I'm not sure whether it would fit in with your tool chain and its processing, but you could try post-processing your generated output. It would be reasonably easy to write a simple post processing script yourself, in Python, of course, although it might be fooled if your exported XML contains character content that spans lines. A better solution would be to use xmllint with the --noblanks option. Examples: $ xmllint --noblanks -o out_doc.xml in_doc.xml $ python my_gds_module.py in_doc.xml | xmllint --noblanks - | ... The dash tells xmllint to read from stdin. For info about xmllint and xmlsoft, see: http://en.wikipedia.org/wiki/Libxml2 Hopes this helps. - Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman
test2.py
Description: Binary data
------------------------------------------------------------------------------ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________ generateds-users mailing list generateds-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/generateds-users