Hi Donald,
In my case, I created a small adapter class and almost any XML parser
can be used to parse the XML files(right now, I allow Java Project X and
Xerces). On the other hand, if you meant "do you have to read the values
and interpret the configuration yourself?" The answer is yes. As Craig
mentioned, The parsers gives you back either a DOM tree or a series or
SAX events and you have to configure your controller servlet from that.
AFAIK, there's no tool that will create your configuration objects from
the xml file, yet.
So your next question could be "why use XML instead of a property file
if I have to read the configuration anyway?". Well, you usually go
through the hassle of writing a DTD and your configuration in XML for
various reasons, among others, the first that come to my mind are:
.- The config file should be more human readable with XML and with
complicated config files this becomes more important. You can also have
a nice view of your config files through an XML viewer, or edit them
with XML editors...
.- The DTD imposes some rules upon yor configuration so the parser, if
configured to do so, can validate some of the conditions that you want
to impose upon your files, so you don't have to do it yourself in your
code. For example, checking that values are in a defined range,
mandatory options...
The key point, IMHO, is that XML is a standard which is plattform and
language independent so you have lots of things that have already been
done for you (editors, viewers, parsers...) so you can save some work.
Regards,
Dan
PD: Resources
Java Project X from Sun http://java.sun.com/xml/
Xerces from Apache http://xml.apache.org/xerces-j/
-------------------------------------------
Daniel Lopez Janariz ([EMAIL PROTECTED])
Web Services
Computer Center
Balearic Islands University
-------------------------------------------
"Craig R. McClanahan" wrote:
>
> Forgot to "reply all".
>
> "Craig R. McClanahan" wrote:
>
> > "Donald E. Vandenbeld" wrote:
> >
> > > I implemented something similar in that I have an Action parameter that gets
> > > looked up in a hashtable to get the destination URL. I currently read this
> > > hashtable from a properties file. Can you tell us what was involved in
> > > using XML files to configure your application? Did you write your own
> > > classes to read/interpret the XML file?
> > >
> >
> > No, I used the same XML parser classes that Tomcat uses to read server.xml and
> > web.xml. This code happened to be the Java Software "Project X" parser, but any
> > XML parser should be able to do something as simple as this. What you get out of
> > the parser is either a document tree using the Document Object Model (from the W3C)
> > or a series of SAX (Simple API for XML parsing, I think) events -- depends on your
> > preference. Using a simple case like this to learn about XML parsing is actually a
> > pretty useful exercize.
> >
> > One place to go for more info (there are lots of others):
> > <http://java.sun.com/xml>.
> >
> > Craig
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets