all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ulf Jasper <ulf.jasper@web.de>
To: Lars Magne Ingebrigtsen <larsi@gnus.org>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
	emacs-devel <emacs-devel@gnu.org>
Subject: Re: Drop toplevel XML-comments in libxml-parse-(xml|html)-region?
Date: Wed, 12 Nov 2014 21:24:27 +0100	[thread overview]
Message-ID: <87r3x86ubo.fsf@web.de> (raw)
In-Reply-To: m3k331xv4u.fsf@stories.gnus.org

[-- Attachment #1: Type: text/plain, Size: 1018 bytes --]

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Lars Magne Ingebrigtsen <larsi@gnus.org> 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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/xml, Size: 112 bytes --]

<?xml version="1.0" encoding="UTF-8"?>
<!--level 0-->
<foo><!--level 1-->
  <bar><!--level 2-->
  </bar>
</foo>

[-- Attachment #3: Type: text/plain, Size: 232 bytes --]


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	other threads:[~2014-11-12 20:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-28 20:36 Drop toplevel XML-comments in libxml-parse-(xml|html)-region? Ulf Jasper
2014-11-11 16:28 ` Lars Magne Ingebrigtsen
     [not found]   ` <87tx25o8pu.fsf@web.de>
2014-11-11 19:13     ` Lars Magne Ingebrigtsen
2014-11-11 19:29     ` Ulf Jasper
2014-11-11 21:40   ` Stefan Monnier
2014-11-11 21:48     ` Lars Magne Ingebrigtsen
2014-11-11 21:52       ` Lars Magne Ingebrigtsen
2014-11-12 20:24         ` Ulf Jasper [this message]
2014-11-21 15:49           ` Ulf Jasper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r3x86ubo.fsf@web.de \
    --to=ulf.jasper@web.de \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.