[XML-SIG] Proposal: command-line interface to parser

Matt G. matt_g_@hotmail.com
Sun, 07 Jul 2002 15:19:15 +0000


>From: "Thomas B. Passin" <tpassin@comcast.net>
>To: xml-sig@python.org
>Subject: Re: [XML-SIG] Proposal: command-line interface to parser
>Date: Sun, 07 Jul 2002 01:22:23 -0400

Thanks for the prompt reply.


>[Matt G.]
>
> > A quick search (i.e. 'find PyXML-0.7.1 -perm +111') doesn't turn up any
> > general-purpose applications of the sort I'm looking for - sorry if it's
> > there and I missed it (but why not 'chmod +x' it?).
> >
> > Anyhow, I think it'd be immensely useful to include a command-line tool
> > that performs at least the following functions:
>
>Did you not find xpcmd.py and xvcmd.py ( in 7.0, I admit, but surely they
>are still there)?  On my Python 2.1.3 Win2000 system they got installed in
>Python21\xmldoc\demo\xmlproc.  They give you at least the first of the 
>three
>items.

I'm not exactly sure how you're counting (i.e. whether you mean bullet 
points or what), but there are a number of things I'd do differently, given 
my goals (please don't mistake these for criticisms - see the first point).  
Some of these are:

    * Locate the source in an 'apps' directory - putting it in
      'demo' implies that its primary purpose is as an example,
      rather than being intrinsically useful.  This distinction
      is important, since it affects the tradeoffs of simplicity
      vs. functionality.

    * Set the default permissions to executable (I think the
      original author intended this, since they both have
      '#!/usr/bin/python', at the top of the file)

    * Print the status, warning, and error messages to stderr.  I
      think this is best done by having the parser throw an
      exception object (with all the relevant information about
      the error or warning), which the application catches.  I'm
      a bit lost on the benefit of registering an error handler.

    * Make validation an option, rather than a separate command

    * Improve the usage info to say a little more about the
      program.  Add a '--help'.  Also, include a statement about
      the conformance goals (perhaps this is too much information
      for --help output, but then the user should be directed to
      a document containing more info)

    * Supply an option to use an SGML catalog file (support
      exists for both, right?), though I suppose you could
      try to parse a catalog as an SGML catalog file, when it
      fails validation as an XML Catalog file.

    * Add -o/--output, for writing the parsed document to a file.
      This sort of implies that the number of documents per
      invocation would be limited to 1.  Unless '-n' is supplied,
      the parsed document should be written to stdout (which is
      one reason status/warning/error messages shouldn't be
      written there).  Actually, I could go either way, on the
      subject of whether this should really be the default
      behavior.

    * Add -q, for suppressing status, so that you can get output
      only in the case of a warning or error


In addition to those, there are still some unfulfilled requirements, in my 
original list.

Is anyone unconvinced that another application is warranted or of the value 
of including such an application in PyXML?  I think it would provide 
substantial benefit, to some users, with only nominal up-front and ongoing 
costs to the XML-SIG.  I think it's justified, given the magnitude of the 
ratio of how annoying it would be to install a separate package to the 
minimal size and complexity of such an application.


Thanks for considering my position.


Matt Gruenke


_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com