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

Uche Ogbuji uche.ogbuji@fourthought.com
Mon, 08 Jul 2002 22:19:23 -0600


> 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, g=
iven =

> my goals (please don't mistake these for criticisms - see the first poi=
nt).  =

> 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.

If you folow the CVS install instructions for 4Suite, 4xml is a full comm=
and =

on your path.  You don't even have to explicitly invoke Python.


>     * 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.

4xml does this: errors to stderr, any proper XML output to stdout.

>     * Make validation an option, rather than a separate command

Yep: -v option

>     * 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)

Yep.  -h or --help


>     * 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.

Not yet.  Again if you make a feature request, should be easy to add.

>     * 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.

Yes.  And even uses -o, as you say.

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

Not yet.  This is so trivial that no feature request is needed.  I'll add=
 it =

now in CVS.


-- =

Uche Ogbuji                                    Fourthought, Inc.
http://uche.ogbuji.net    http://4Suite.org    http://fourthought.com
Track chair, XML/Web Services One Boston: http://www.xmlconference.com/
The many heads of XML modeling - http://adtmag.com/article.asp?id=3D6393
Will XML live up to its promise? - http://www-106.ibm.com/developerworks/=
xml/library/x-think11.html