xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Bertola <bbert...@promedix.com>
Subject Re: USES
Date Thu, 17 Feb 2000 18:38:02 GMT
I am actually working on a system wide configuration service using XML.
I agree that if you are doing something simple, your regular .properties file
is probably better, but in our system we needed a central location for all of
our service configurations.   The XML properties that I have written have
extended functionality above a regular properties file such as setting global
variables, where you can then call <include global="DB_INFO"/> and the global
with the name DB_INFO will be placed in your document in place of the
include.  It also allows you to set different runlevels and have your document
contain runlevel-specific options - such as production, development, staging.
At runtime an application connects to an EJB, and calls getProperties and
passes a Service Name, the config service returns back the properties for this
particular service.  For the include functionality and runlevel functionality
I actually use a XSL stylesheet, and I tie into it using EJB.  My application
actually returns an Element, but I have seen another Open Source XML
properties library that will return you a regular Properties object.
Thanks,
Ben

Stefano Mazzocchi wrote:

> Paul.Waugh@wdr.com wrote:
> >
> >      Interesting thread,
> >
> >      Just as an aside, has anyone started to put property files in an XML
> >      format.
> >
> >      I was just wondering if there is an advantage moving from a property
> >      file or .ini file that was the format.
> >
> >      name=something
> >      windowsize=anything
> >      blahblah=somethingelse
> >
> >      to a guess below
> >
> >      <propertyset>
> >         <property>
> >                 <name>something</name>
> >         </property>
> >         <property>
> >                 <windowsize>something</windowsize>
> >         </property>
> >         <property>
> >                 <blahblah>somethingelse</blahblah>
> >         </property>
> >      <propertyset>
> >
> >      Would this allow you to have shared property stuff rather than
> >      multiple property files ??
> >
> >      Is there any other advantages that anyone else can see ??
>
> XML has a major advantage over other properties syntaxes: it's not flat.
>
> If you do something like the above, you are probably driven by the xml
> hype and you
>
>  - loose readability
>  - increase verbosity
>  - increase parsing overhead
>  - increase the size of your program
>  - increase the software development costs
>
> why? because flat files (.ini, .properties) do the job perfectly.
>
> But if you need to do more complex things, like nested configurations,
> then you _have_ to pay the XML price otherwise the complexity of your
> flat files increases too much.
>
> Look at java.properties files, it is possible to "structure" them like
> this
>
> server.name="pippo"
>
> pippo.port=80
> pippo.name="whatever"
> pippo.directories="one, two, three"
>
> one.indexFile="index.html"
> one.mount="/home/www/one"
>
> .... (and so on)
>
> where the XML equivalent is _much_ more readable
>
>  <server name="pippo">
>   <port>80</port>
>   <name>whatever</name>
>   <directory name="one">
>    <indexFile>index.html</indexFile>
>    <mount>/home/www/one</mount>
>   </directory>
>   ....
>  </server>
>
> So, like anything else, the use of XML depends on what you want to do.
>
> My rule of thumb is: simple lists -> flat files, tree structured -> XML.
>
> But you mileage may vary. :)
>
> --
> Stefano Mazzocchi      One must still have chaos in oneself to be
>                           able to give birth to a dancing star.
> <stefano@apache.org>                             Friedrich Nietzsche
> --------------------------------------------------------------------
>  Come to the first official Apache Software Foundation Conference!
> ------------------------- http://ApacheCon.Com ---------------------


Mime
View raw message