unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17964: 24.3; xml-print inserts spurious whitespace
@ 2014-07-07 12:54 Juliusz Chroboczek
  2016-03-01  6:14 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Juliusz Chroboczek @ 2014-07-07 12:54 UTC (permalink / raw)
  To: 17964

Hi.

I'm trying to use Emacs' XML parser to parse Atom feeds, and I'm finding
that xml-print inserts spurious whitespace in the XHTML content, which
breaks formatting.  Here's a pretty minimal example:

(require 'xml)

(defun xml-parse-from-string (s)
  (with-temp-buffer
    (insert s)
    (xml-parse-region (point-min) (point-max))))

(defun xml-print-to-string (x)
  (with-temp-buffer
    (xml-print x)
    (buffer-substring (point-min) (point-max))))

(xml-print-to-string (xml-parse-from-string "<p>[<a>foo</a>]</p>"))
"<p>[
  <a>foo</a>]
</p>"





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#17964: 24.3; xml-print inserts spurious whitespace
  2014-07-07 12:54 bug#17964: 24.3; xml-print inserts spurious whitespace Juliusz Chroboczek
@ 2016-03-01  6:14 ` Lars Ingebrigtsen
  2016-03-01 17:16   ` Ulf Jasper
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2016-03-01  6:14 UTC (permalink / raw)
  To: Juliusz Chroboczek; +Cc: 17964

Juliusz Chroboczek <jch@pps.univ-paris-diderot.fr> writes:

> I'm trying to use Emacs' XML parser to parse Atom feeds, and I'm finding
> that xml-print inserts spurious whitespace in the XHTML content, which
> breaks formatting.  Here's a pretty minimal example:
>
> (require 'xml)
>
> (defun xml-parse-from-string (s)
>   (with-temp-buffer
>     (insert s)
>     (xml-parse-region (point-min) (point-max))))
>
> (defun xml-print-to-string (x)
>   (with-temp-buffer
>     (xml-print x)
>     (buffer-substring (point-min) (point-max))))
>
> (xml-print-to-string (xml-parse-from-string "<p>[<a>foo</a>]</p>"))
> "<p>[
>   <a>foo</a>]
> </p>"

I can confirm that this is still an issue on the Emacs trunk.  However,
our XML reader does not retain information about whitespace (or the lack
of it).  And

<p>[
   <a>foo</a>]
 </p>

is perfectly valid XML.  I don't really think there's a way to "fix"
this, if it's considered a bug, which is kinda isn't.  So I'm closing
this as "wontfix".

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#17964: 24.3; xml-print inserts spurious whitespace
  2016-03-01  6:14 ` Lars Ingebrigtsen
@ 2016-03-01 17:16   ` Ulf Jasper
  0 siblings, 0 replies; 3+ messages in thread
From: Ulf Jasper @ 2016-03-01 17:16 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 17964, Juliusz Chroboczek

Hi Juliusz,

Am 01.03.2016 um 17:14 (+1100) schrieb Lars Ingebrigtsen:
> Juliusz Chroboczek <jch@pps.univ-paris-diderot.fr> writes:
>
>> I'm trying to use Emacs' XML parser to parse Atom feeds, and I'm finding
>> that xml-print inserts spurious whitespace in the XHTML content, which
>> breaks formatting.

[Not directly related to the bug report but maybe helpful:]

'newsticker.el' already does parsing of different Atom and RSS feeds.
Maybe you can re-use some of that functionality.  Please have a look at
newst-backend.el.

Best,
Ulf





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-01 17:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-07 12:54 bug#17964: 24.3; xml-print inserts spurious whitespace Juliusz Chroboczek
2016-03-01  6:14 ` Lars Ingebrigtsen
2016-03-01 17:16   ` Ulf Jasper

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).