Lists Home |
Date Index |
- From: "Tolkin, Steve" <Steve.Tolkin@FMR.COM>
- To: "'email@example.com'" <firstname.lastname@example.org>
- Date: Fri, 20 Oct 2000 12:01:20 -0400
I am looking for advice about the best way to store rounded numbers, in
addition to the actual numbers, in an XML document.
We need both the actual and the rounded number because some consumers of the
XML require one, and some require the other. We want to store this
(redundant) information so that the process used to render the output, e.g.
stylesheet, can be kept simple. The program that produces the XML is
already reasonably complex, and extending it to emit the rounded numbers
would not be hard.
Th actual numbers are stored as element content. The rounded number could
be stored either as a separate element, or as an attribute of that element.
However I generally use the principle "use elements for data, and attributes
for metadata" and so favor using elements.
Note that we are rounding to the nearest 1000 (as per an SEC reporting
But I can imagine a document that would have different levels, and in that
case we might need to specify the grain of the rounding. This seems to be
best done as an attribute, e.g.
RoundingLevel="1000". This is compatible with any of the possibilities
Plan 1. An attribute
Plan 2a. A separate element, in the same name space
Plan 2b A minor variation here would be to use a name with a "separator"
Plan 3: A separate element, in a separate namespace
This does not seem better than the above, but I include it for completeness.
Does it add any value?
P.S. Note that there are many other cases where redundant information might
carried in an XML document. Are there general principles for this that have
already been stated?
Steven Tolkin email@example.com 617-563-0516
Fidelity Investments 82 Devonshire St. V10D Boston MA 02109
There is nothing so practical as a good theory. Comments are by me,
not Fidelity Investments, its subsidiaries or affiliates.