[
Lists Home |
Date Index |
Thread Index
]
Simon St.Laurent wrote:
>...
> >
> >I don't see why this is any problem at all. Can you be more specific?
>
> I'm just typing this up with random data, but hopefully you'll get the
> idea:
>
> <table>
> <row item="0001452A" time="08:08.72PM EST" quantity="3" discount="20%"
> tax="7%" base_price="19.99" />
> <row item="1356352A" time="08:09.81PM EST" quantity="1" discount="10%"
> tax="3.5%" base_price="4.99" />
> <row item="BC758333" time="08:12.14PM EST" quantity="1" discount="50%"
> tax="7%" base_price="19.99" />
> <row item="0001452A" time="08:14.09PM EST" quantity="7" discount="0%"
> tax="3.5%" price="1.99" />
> </table>
>
> Is the initial data. I run a transformation on it which only modifies
> entries with discounts 20% and over, and I might get:
>
> <table>
> <row base_price="19.99" discount="20%" item="0001452A" quantity="3"
> tax="7%" time="08:08.72PM EST" color="pink" />
> <row item="1356352A" time="08:09.81PM EST" quantity="1" discount="10%"
> tax="3.5%" base_price="4.99" />
> <row base_price="19.99" discount="50%" item="BC758333" time="08:12.14PM
> EST" quantity="1" tax="7%" color="red" />
> <row item="0001452A" time="08:14.09PM EST" quantity="7" discount="0%"
> tax="3.5%" price="1.99" />
> </table>
>
> That's not even that big a change, but finding things in that just got a
> lot harder. (Try it with a thousand rows, twenty attributes, and
> multiple choices of attribute sequence.) Instead of using the
> pattern-matching abilities that humans come with, I now get to write
> code if I want to figure out what's changed.
>
This is an excellent example (I am always willing to be convinced by
concrete evidence :-)
I guess Dare's comment is apropos: Generally 'XML' assumes that human
readable content will be in elements, not attributes. Attributes are
certainly second class citizens in this world.
Perhaps you are correct: there is a use case for an API that preserves more
of the original structure of the XML document, not just attribute order, but
whitespace, delimeters etc. The price you'll have to pay in order to gain
this capabilty is that you'll either have to figure out how to use (and
implement) something like XSLT on top of your API, or else you'll have to
design and implement a new transformation language designed to work under
these conditions. Either way there are issues, and so we are back to the
cost/benefit ratio.
Another option is to write and use an editor designed to work with tabular
datasets contained in XML documents, or else write stylesheets specific to
each dataset i.e. explicitly place the attributes where you want them.
Lots of choices but I better understand your frustration.
Jonathan
|