[
Lists Home |
Date Index |
Thread Index
]
- From: "Tolkin, Steve" <Steve.Tolkin@FMR.COM>
- To: "'xml-dev@lists.xml.org'" <xml-dev@lists.xml.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
requirement.)
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
below.
Plan 1. An attribute
<netAssets rounded="568000">567890</netAssets>
Plan 2a. A separate element, in the same name space
<netAssets>567890</netAssets>
<netAssetsRounded>568000</netAssetsRounded>
Plan 2b A minor variation here would be to use a name with a "separator"
character, e.g.
<netAssets.Rounded>
Plan 3: A separate element, in a separate namespace
<netAssets>567890</netAssets>
<Rounded:netAssets>568000</Rounded:netAssets>
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
be
carried in an XML document. Are there general principles for this that have
already been stated?
Thanks,
Steve
--
Steven Tolkin steve.tolkin@fmr.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.
|