XML Considered Harmful

2QdxY4RzWzUUiLuE at potatochowder.com 2QdxY4RzWzUUiLuE at potatochowder.com
Sat Sep 25 17:48:48 EDT 2021


On 2021-09-25 at 15:20:19 -0500,
"Michael F. Stemper" <michael.stemper at gmail.com> wrote:

> ... For instance, if
> I modeled a fuel like this:
> 
>   <Fuel name="Montana Sub-Bituminous">
>     <uom>ton</uom>
>     <price>21.96</price>
>     <heat_content>18.2</heat_content>
>   </Fuel>
> 
> and a generating unit like this:
> 
>   <Generator name="Skunk Creek 1">
>     <IHRcurve name="normal">
>       <point P="63" IHR="8.513"/>
>       <point P="105" IHR="8.907"/>
>       <point P="241" IHR="9.411"/>
>       <point P="455" IHR="10.202"/>
>     </IHRcurve>
>     <IHRcurve name="constrained">
>       <point P="63" IHR="8.514"/>
>       <point P="103" IHR="9.022"/>
>       <point P="223" IHR="9.511"/>
>       <point P="415" IHR="10.102"/>
>     </IHRcurve>
>   </Generator>
> 
> why would the fact that I could have chosen, instead, to model
> the unit of measure as an attribute of the fuel, or its name
> as a sub-element matter? Once the modeling decision has been
> made, all of the decisions that might have been would seem to
> be irrelevant.

Disclaimer:  I am not a big XML fan, for a number of reasons
already stated in this thread.

That said, please do include units in elements like heat_content,
whether or not it's Joules/kilogram/K, and price, even if is the
local currency in the only country to which your data applies.
If there's a standard for your industry, or your company, or on
some other level, then at least document what it is and that
you're using it, so that the next person (which may be you a
year from now) doesn't have to guess.

You also never know when someone else on the other side of the
planet will notice your work and try to duplicate it and/or
update it (again, even if it's you).  The fewer assumptions
that person has to make, the better.


More information about the Python-list mailing list