You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Gary Gregory <gg...@seagullsw.com> on 2003/08/08 18:12:40 UTC

RE: [CLI] XML -> CLI (was Re: Three month contribution to Commons ?)

Hi,

My thought was for an xml2cli dev-time mechanism.

At dev-time, I create an XML file, run an xlat tool that creates a Java
class using CLI. The class has a nice Javadoc of course. Internally, maybe
the tool runs one xlat to gen the CLI code, and a second to gen the Javadoc.
Maybe there is also a gen-an-HTML-doc-page option...

Here is a quick and very dirty XSD based on what CLI 1.0 looks like:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:element name="cli">
        <xs:annotation>
            <xs:documentation>Comment describing your root
element</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="option"/>
                <xs:element name="optionGroup">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element ref="option"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="option">
        <xs:complexType>
            <xs:attribute name="longName" type="xs:NCName"/>
            <xs:attribute name="type" type="xs:Name" use="optional"
default="xs:string"/>
            <xs:attribute name="help" type="xs:normalizedString"
use="optional"/>
            <xs:attribute name="shortName" type="xs:NCName"/>
            <xs:attribute name="argName" type="xs:normalizedString"
use="optional"/>
            <xs:attribute name="argCount" type="xs:byte" use="optional"
default="1"/>
            <xs:attribute name="argOptional" type="xs:boolean"
use="optional" default="false"/>
            <xs:attribute name="valueSeparator" type="xs:NCName"
use="optional"/>
        </xs:complexType>
    </xs:element>
</xs:schema>

With a dummy auto-generated example:

<?xml version="1.0" encoding="UTF-8"?>
<cli xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="C:\Documents and Settings\ggregory\My
Documents\xml2cli.xsd">
    <option longName="NCName" type="xs:string" help="normalizedString"
shortName="NCName" argName="normalizedString" argCount="1"
argOptional="false" valueSeparator="NCName"/>
    <optionGroup>
        <option longName="NCName" type="xs:string" help="normalizedString"
shortName="NCName" argName="normalizedString" argCount="1"
argOptional="false" valueSeparator="NCName"/>
    </optionGroup>
</cli>

-----Original Message-----
From: Rob Oxspring [mailto:roxspring@imapmail.org] 
Sent: Friday, August 08, 2003 05:41
To: Jakarta Commons Developers List
Subject: [CLI] XML -> CLI (was Re: Three month contribution to Commons?)

There has been talk on a few occasions that there should be a way to get
build a CLI interface from an XML definition but this is
the first time I've thought about it in any detail.  I'd always figured that
the xml->cli transformation would take place at runtime
but the comment from Gary seems to suggest otherwise.  So what do people
have in mind?

Is the xml2cli transformation people are thinking of a compile-time or
runtime operation?

What sort of functionality should be produced by the transformation? - would
the transformed code just present a CommandLine object
for the client code to query or would the code call specified methods on the
client code?

Does anyone have an example of the sort of xml fragment they might expect to
use?


I mainly just want to ponder briefly about what would be needed by the core
API and see if my cli2 proposal will be able to cope.
(I'm aiming to have a new drop of my proposal ready sometime over the
weekend so I'll let people play with the new ideas and pass
comment then).

Rob

----- Original Message ----- 
From: "Gary Gregory" <gg...@seagullsw.com>
To: "'Jakarta Commons Developers List'" <co...@jakarta.apache.org>;
<ep...@upstate.com>
Sent: Thursday, August 07, 2003 7:26 PM
Subject: RE: Three month contribution to Commons?


> As you mentioned CLI, if you look at CLI messages yesterday or the day
> before on this list you'll see that there is a CLI 2.0 in the works but it
> seems that there are two main branches and approaches. I have not done
work
> deep in CLI but I use it (version 1.0).
>
> Perhaps there is something there for you to do? Perhaps the two authors of
> CLI branches would like to comment or get help from you?
>
> From my end, one thing I would like a future CLI to be able to do is to
> define a CLI from an XML file such that CLI can generate Java code,
Javadoc
> and HTML docs. But I'm just dreamin' here... ;-)
>
> Gary
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org