emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with xml-parse-string


From: Lars Magne Ingebrigtsen
Subject: Re: Problems with xml-parse-string
Date: Fri, 24 Sep 2010 00:21:49 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

Chong Yidong <address@hidden> writes:

> The main differences in the "new" format are (i) listing attributes as
> (:foo bar) inside the element list, rather than in an alist after the
> element name, (ii) listing text as (text "foo") rather than "foo", and
> (iii) the as-yet-unresolved issue with XML namespaces, which probably
> needs to be fixed in xml.c.
>
> Point (i) is a broken design choice, as I already pointed out.

Well, yes and no.  Attributes are (:foo . bar).  Nodes can (as you
pointed out, and I didn't know) have names like :foo in XML, but they
can't be (:foo . bar).  They'll always have a list as the cdr.  (They
list may be nil, but it's still a list.)

The main point of having the : before the attribute names is mainly an
over-determination of what we're looking at when we're looking at stuff
visually, as we have a tendency to do when we're trying to make heads or
tails of the crappy HTML and XML people give us.

As for the :foo node names, we can map them to anything else if
required.  Pick an invalid XML character -- any one will do, if this is
important.

> As for (ii), it is a little nicer to take the cdr of each list member
> without checking for stringp.  If others thing this is a really good
> change, I won't object, though it seems pretty trivial to me.

It seems trivial, but as someone who's dealing with this stuff daily, I
assure you that it's really really annoying never being able to say
`assq' or just looping over the stuff without having the extra `if'
everywhere.  It's just annoying and makes the code unclear and
error-prone. 

> We can add an optional flag to the xml-* functions to toggle between
> the two representations.

Yes, that would be fine by me.

-- 
(domestic pets only, the antidote for overdose, milk.)
  address@hidden * Lars Magne Ingebrigtsen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]