[web-devel] Cannot control order of XML attributes

Michael Snoyman michael at snoyman.com
Sun Apr 3 13:43:22 CEST 2011


On Sun, Apr 3, 2011 at 2:23 PM, Yitzchak Gale <gale at sefer.org> wrote:

> After upgrading to xml-enumerator 0.2.1 and xml-types 0.2,
> I can no longer control the order of attributes in rendered XML.
>
> The XML specification specifically allows this - you can
> change the order of attributes with affecting the semantics
> of the document. I need the attributes to be in a sane order
> for reading by humans so that the XML will pass my
> customer's acceptance testing.
>
> Earlier versions of xml-types supported this, but 0.2 introduced
> an API change which forces attribute sets to be expressed as
> a Data.Map.
>
> Why not just use association lists? That seems like a perfect
> fit. Or just go back to the old API.
>
> Thanks,
> Yitz
>

For the record, I would like to see this change too. I'm less concerned
about attribute ordering (just because I don't think any human ever reads my
XML output... at least I hope for their sake they aren't), but it's a little
more difficult to code against the current API than if we used an assoc
list. I'm also not certain that we're gaining any performance by using Map,
since there are rarely any significant numbers of attributes used that the
difference between O(n) lookups for assoc lists and O(log n) for Maps will
make a significant difference.

Just my 2 cents.

Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20110403/9baeaab5/attachment.htm>


More information about the web-devel mailing list