httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <>
Subject Re: XML configuration revisited
Date Tue, 12 Oct 1999 20:01:39 GMT
James Davidson wrote:
> > The major issue I see is that Apache's configuration is extensible, but
> > DTDs are not (at least, as far as I understand them). So, some kind of
> > XDTD (to coin an acronym) is needed. I believe such things do exist, but
> > I don't know much about them. However, the fact that they are plural
> > worries me :-)
> XML is extensible even if the DTD can be rigid. For example, in Ant (a
> little build tool that we are using over in Tomcat land), the first two
> levels of the config file are set, but the next level down is dynamically
> mapped to wherever it needs to go.. Let me give an example:
> The build.xml file is structured like:
>     <project name="Tomcat">
>       <target name="main" depends="foo">
>         <[taskname] [taskattribute=value]/>
>       </target>
>     </project>
> The taskname is resolved to a class, and instance of that class is created
> and the attributes of the task are reflected into that class via beans
> setter methods to configure it.
> This lets us do the following:
>     <project name="foo">
>       <taskdef name="newtask" class="org.apache.reallycool.TaskClass"/>
>       <target name="main">
>         <newtask att1="foo" att2="bar"/>
>       </target>
>     </project>
> So at runtime, I've created extensibility on the fly using this. In ant, the
> definition of what the task tags can look like is driven by a set of
> defaults and added to by in xml taskdefs -- in some other application such
> as configuration -- the configuration could be read in a central location
> and only the various components interested in particular parts of the config
> file need ask for what they want.
> I'm sure that people who think that everything should have a DTD are going
> to choke over this approach, but it gives Ant amazing on the fly flexibility
> to deal with things, lets people writing the config files use a well defined
> easy to read common syntax, and lets the progam itself use standard XML
> libraries to do business.

I kinda like the approach but ...

a) How do you use it if you aren't writing Java?
b) Where does it tell me about att1/att2 in the example above?




"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
     - Indira Gandhi

View raw message