lmi
[Top][All Lists]
Advanced

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

[lmi] Annotation: xml attribute or element?


From: Greg Chicares
Subject: [lmi] Annotation: xml attribute or element?
Date: Tue, 06 Apr 2010 14:39:20 +0000
User-agent: Thunderbird 2.0.0.24 (Windows/20100228)

Sometimes we need to annotate a "property" in a product file. We don't do
it often, but when we do, it's important. For example, one product has:

    // Annotation in C++ comment...
    Add(TDBValue(DB_GuarMandE, 0.0));

in (proprietary) source code that generates a '.db4' file, along with an
annotation explaining that the product's specifications give a different
value, but zero is correct for this particular variant. It's crucial that
we preserve these important annotations.

How should we annotate the corresponding xml? It looks like this now:

    <value>
      <key>GuarMandE</key>
      [...]
      <data_values>
        <item>0</item>
      </data_values>
    </value>

I can think of two ways (we'd only want to annotate at the <value>
level, never anywhere else):

-   <value>
+   <value annotation="FIRST ANNOTATION STYLE">

or

    <value>
+     <annotation>SECOND ANNOTATION STYLE</annotation>
      <key>GuarMandE</key>

The first style is more compact, because annotations are infrequent.
The second seems simpler--if everything's an element, then we don't
need logic to look for anything that isn't an element. (And we do
want to read these elements: even if we don't have a use for them
in the program today, someday we'll want them to be displayed in
the product editor.)

Am I right in supposing that this is really an arbitrary choice
between two alternatives that are equally good from a technical POV?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]