tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@algroup.co.uk>
Subject Re: XML configuration revisited
Date Wed, 13 Oct 1999 09:05:17 GMT
James Davidson wrote:
> 
> > 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

Well, it was the linking to a Java class I was really referring to. I
suppose you could make it CORBA or such-like, but that's starting to get
a bit heavyweight. Worth considering though...

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

Well, there isn't a standardised way to do this in C (but see above:
there is in CORBA, I'm pretty sure - and that would be language
independent).

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

I think everyone agrees that the position is CAN'T have DTD!

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html

"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

Mime
View raw message