[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Newbie question: XML design for configuration file
- From: Erin O'Neill <Eon@kp.org>
- To: xml-dev <xml-dev@lists.xml.org>
- Date: Mon, 23 Jul 2001 10:54:02 -0700
Hi all!
I'm a newbie to XML (and java, tho I have more java experience & training). Currently we have an app that needs extensive & complex configuration. It seems logical to put the configuration into several xml docs. There is no one inhouse with xml experience but the experienced java programmer seems to think I should "Super" generalize the xml doc.
The configurations will ultimately endup in a HashMap containing a string key & a value that can be either a string, hashtable, arrayList, etc. He thinks I should basically do something like this:
...
<section name="global">
<conf key="logDir">/var/logs</conf>
<conf key="notify">eon@kp.org</conf>
</section>
<section name="server">
<conf key="RunAsDaemon">0</conf>
<conf key="username">eon</conf>
</section>
<section name="Fields" type="hashtable">
<conf key="fullName">A1</conf>
<conf key="SSN">A5</conf>
<conf key="Dept">HR</conf>
</section>
<section name="Auth" type="ArrayList">
<conf key="SSN"/>
<conf key="employeeNumber"/>
<conf key="fullName"/>
</section>
...
something like that. The DTD would be fairly easy to write & a Schema could be written to set up data restrictions.
However, in the Java & XML book & the tutorials I've taken, it seems to me, that this might be too general of an XML design (it does parse as a well formed XML document). So I'm confused as to how to design the documentation. It's primary use if for a Java Class but we could add some HTML tags & then have a java class turn it into HTML documentation (wow 2 uses for one doc!).
Should I instead make if more specific?? with something like:
...
<myXML:section name="global">
<myXML:notify>eon@kp.org</myXML:notify>
<myXML:logDir>/var/logs</myXML:logDir>
</myXML:section>
<myXML:section name="server">
<myXML:RunAsDaemon>0</myXML:RunAsDeamon>
<myXML:username>eon</myXML:username>
</myXML:section>
<myXML:section name="Fields" type="hashtable">
<myXML:fullName>A1</myXML:fullName>
<myXML:SSN>A5</myXML:SSN>
<myXML:Dept>HR</myXML:Dept>
</section>
<section name="Auth" type="ArrayList">
<myXML:SSN/>
<myXML:employeeNumber/>
<myXML:fullName/>
</section>
...
It does seem like the more general is more java like & the more specific seems more HTML like. I'm confused!
thanks in advance.
erin