simsong / dfxml

Digital Forensics XML project and library
http://www.forensicswiki.org/wiki/Category:Digital_Forensics_XML
Other
66 stars 22 forks source link

Added options for manual indentation of xml #6

Closed geoffblack closed 11 years ago

ajnelson commented 11 years ago

Sorry, but no to this version. A few reasons:

  1. Running the program shows nothing actually gets the indentation going. (E.g.: python python/dfxml_tool.py --allprovenance --sha1 --md5 .) Everything's still flush left.
  2. Not every element gets an indentation treatment. For instance, --allprovenance creates a block that didn't get an indent parameter.
  3. Really, the proper way to manage indentation is with an XML writer-scoped, stack-height-aware state machine (counter). A propagated variable becomes programming baggage pretty quickly.

In light of 3, indentation may be more trouble than it's worth. Does xmllint --format not suffice for your needs? It works fine as a generic pretty-printer, and XML-validates your output as a bonus.

geoffblack commented 11 years ago

That's reasonable. I may eventually try to switch from using over to something like lxml or another library instead of borrowing dfxml_tool's xml class. I just don't have time to deal with it right now, and I don't really have any desire to call other command line tools to fix the output so it's readable.

ajnelson commented 11 years ago

You could pitch it to yourself as validating your output and getting indented readability for free.

There's also Hashdeep, which generates pretty much the same contents, though without the same annotation options. I forget what Hashdeep does about whitespace niceties, though.

geoffblack commented 11 years ago

That's a good point. :) I may just stick with the slightly modified version of class xml in a separate file for now until I can come back to it and do something better. Thanks!

simsong commented 11 years ago

hashdeep is using a pre-release version of the DFXML source file. It would be better for it to use a subproject, but that would complicate things on the hashdeep side.

On Sep 26, 2013, at 8:37 PM, Alex Nelson notifications@github.com wrote:

You could pitch it to yourself as validating your output and getting indented readability for free.

There's also Hashdeep, which generates pretty much the same contents, though without the same annotation options. I forget what Hashdeep does about whitespace niceties, though.

— Reply to this email directly or view it on GitHub.