[Kalzium] Kalziums datastructure
Inge Wallin
inge at lysator.liu.se
Wed Sep 14 09:19:55 CEST 2005
Regarding the XML DTD for the elements:
The XML schema for the elements in Kalzium has been developed during a long
time with multiple additions, and is somewhat ad-hoc. This was fine when it
was developed, and when there was only one program using the data.
However, if we want to make this a standard, we might want to take the time to
do it right, now that we have the experience. There is a very simple
principle when designing XML schemas:
1. "Things" that there is only one of, and where the order of it, in
comparison with other similar properties, should be attributes of a tag.
2. "Things" that there can be many of, or where the order matters, should be
subtags.
This suggest the following:
On Tuesday 13 September 2005 14.40, Carsten Niehaus wrote:
> The element starts
> <element>
>
> The number of the element (# of protons)
> <number>1</number>
Should probably be an attribute ( <element number="1" symbol="H">).
> Name and origin of the name of the element
> <name origin="Greek 'hydro' and 'gennao' for 'forms
> water'">Hydrogen</name>
Ok, I would say, but see also below.
> Symbol
> <symbol>H</symbol>
Should be an attribute
> Period of the element
> <period>1</period>
Should be an attribute
...and so on. I won't go throught it all in this mail, since that is not the
point I'm trying to make.
One thing that we should take special care of is the issue of
internationalization and localization. Some of these values are generic, like
the number of the element and the symbol. Others need to be localized, like
the name - the swedish name for Hydrogen is Väte - and the origin.
I don't know how if there is an established way of doing this for XML files,
but I think we should be careful. One way to do it would be to split the XML
file in two parts: the generic one and the i18n:ed one. That is probably not
so easy to get right.
Another way is to include the equivalent of the KDE call i18n() that indicates
that a string should be translated. In that case, we need to create a format
for XML data that contains only the translated strings - sort of like the .po
and .mo files for strings in programs. The program that uses the XML file
then has to do the translation on the fly when it presents the data to the
user.
I'll stop here, but I strongly urge you all to take into account these issues
before you start to put things together.
-Inge
--
Inge Wallin | Thus spake the master programmer: |
| "After three days without programming, |
inge at lysator.liu.se | life becomes meaningless." |
| Geoffrey James: The Tao of Programming. |
More information about the Kalzium
mailing list