tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Davidson" <>
Subject Re: XML configuration revisited
Date Wed, 13 Oct 1999 04:06:02 GMT
> I kinda like the approach but ...
> a) How do you use it if you aren't writing Java?

Just use DOM --

    get rool element (verify it's "project")
    get the target elements
    for each target, get it's children tags
       for each child tag, do something that was associated
       with that name

You should be able to do that much with a C based XML parser

> b) Where does it tell me about att1/att2 in the example above?

Unfortunatly, that's where my example is Java specific -- I'm using
reflection to pipe those straight into the class... For example,

    <newtask att1="foo" att2="bar"/>

I'd reflect into an instance of the class that is associated with "newtask"
(in my previous email org.apache.reallycool.TaskClass) and use JavaBeans
setter methods -- this means that I can use the java.beans.* library to find
the method for setAtt1(String s) and setAtt2(String s) from that instance
class without knowing its exact type. I set the attributes, and then, at the
appropriate time (as it is a build system) I call an exec method that fires
and uses whatever configuration was reflected into it to do it's job.

I don't know how to do this last part in C as I'm *not* a good C hacker (I
had a different background that led me into Java...)

The problem of course with this example is that this isn't exactly the same
way you'd do things for a server configuration file -- but I wanted to make
sure that people aren't limiting themselves to "XML...must...have...DTD"


View raw message