emacs-devel
[Top][All Lists]
Advanced

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

Re: Drop toplevel XML-comments in libxml-parse-(xml|html)-region?


From: Ulf Jasper
Subject: Re: Drop toplevel XML-comments in libxml-parse-(xml|html)-region?
Date: Wed, 12 Nov 2014 21:24:27 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Lars Magne Ingebrigtsen <address@hidden> writes:

> Lars Magne Ingebrigtsen <address@hidden> writes:
>
>> But the only problematic comment is the top-level one, because that
>> makes the structure different than if the comment wasn't there.  Perhaps
>> we could just cheat and push any top-level comments one step down in the
>> DOM?  I mean, it's gross, but I don't think anybody would actually
>> notice in real life.
>
> It would mean that
>
> <?xml version="1.0" encoding="UTF-8"?>
>   <foo>bar</foo>
> <!--ignore me-->
>
> would turn into
>
> <?xml version="1.0" encoding="UTF-8"?>
>   <foo>bar</foo>
>   <!--ignore me-->
>
> where indentation represents where in the DOM the element appears.  Sort
> of.

In that case we would get

  (foo nil (comment nil "level 0")
           (comment nil "level 1")
           (bar nil (comment nil "level 2"))))

instead of

  (top nil (comment nil "level 0")
           (foo nil (comment nil "level 1")
                    (bar nil (comment nil "level 2"))))

for this xml

<?xml version="1.0" encoding="UTF-8"?>
<!--level 0-->
<foo><!--level 1-->
  <bar><!--level 2-->
  </bar>
</foo>
That would work but seems a bit strange.  I think I would vote for
Stefan's idea to introduce an optional parameter which controls removal
of all comments.  That would result in

  (foo nil (bar nil))

which does not look so bad.


reply via email to

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