Re: config library



> <Object Name = "SimpleMTA">
> 	<OBJECT NAME = "PERSONALITY" > 
> 		<ATTRIBUTE NAME = "REALNAME"> JOSH </ATTRIBUTE>
> 		<ATTRIBUTE NAME = "SERVER"> mail.dimensional.com</attribute>
> 		<ATTRIBUTE NAME = "CONNECT_TIME" TYPE = INT>12</attribute>
> 	</OBJECT>
> 	<OBJECT NAME = "CORBA CALLBACK">
> 		<ATTRIBUTE NAME = "SOME IDENTIFIER">
> 	</OBJECT>
> </OBJECT>

  Ok, I will be just a bit pedantic :-\ 
This is not XML, any XML parser will choke on TYPE = INT without double quote
or the absence of the closing / in <ATTRIBUTE NAME = "SOME IDENTIFIER">

  To avoid getting that kind of problem, I really suggest that an
implementation reuse either the Perl or Python XML libraries (using expat
the C parser from James Clark) or gnome-xml. If you plan on using gnome-xml
I suggest you look at gnome-xml/tree.h the API makes fairy simple building
this kind of XML trees and dumping the result to a file.

  Another point I would raise is that you should distinguish what's an
attribute at your configuration level and how to encode it in XML. My point
is that it would be a good idea if your library consider equivalent

   <OBJECT NAME = "PERSONALITY" >
      <ATTRIBUTE NAME = "REALNAME"> JOSH </ATTRIBUTE>
   </OBJECT>

and 
   <OBJECT>
      <NAME>PERSONALITY</NAME>
      <ATTRIBUTE>
          <NAME>REALNAME</NAME>
	  <VALUE>JOSH</VALUE>
      </ATTRIBUTE>
   </OBJECT>

  Our work at W3C on RDF (metadata encoding) showed that it's important
to separate the conceptual relationship of the things you want to store in
XML and how you encode it. Being able to transparently express
subinformation either as a new XML element or as an XML attribute of the
parent is important. Example you may consider that an information is short
and decide encoding it as an XML attribute, but as time goes and the complexity
increase, it appears that this information becomes 1000bytes long, it's better
to have the library doing the encoding/decoding of the information handle
transparently the change in the tructure if you decide to now encode it as
a separate element.
 
   Also I suggest people interested on the topic of saving this kind of
registry information to have a look at RDF the metadata encoding proposal
from W3C ( http://www.w3.org/Metadata/ ) it's not an easy reading but it
may help avoiding a couple of pitfall.

  Daniel

-- 
Daniel.Veillard@w3.org | W3C  MIT/LCS  NE43-344  | Today's Bookmarks :
Tel: +1 617 253 5884  | 545 Technology Square   | Linux, WWW, rpm2html,
Fax: +1 617 258 5999  | Cambridge, MA 02139 USA | badminton, Kaffe,
http://www.w3.org/People/W3Cpeople.html#Veillard | HTTP-NG and Amaya.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]