bug-gnu-emacs
[Top][All Lists]
Advanced

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

Re: unclear behaviour of xml.el


From: Stefan Monnier
Subject: Re: unclear behaviour of xml.el
Date: 01 Nov 2001 19:51:17 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1.50

>>>>> "David" == David Kuehling <address@hidden> writes:
> files. But I currently have a problem with whitespace-handling of xml.el
> (the XML parser that luckily came with emacs21): Whitespaces after
> closing tags `</tag>' and empty-element tags `<tag/>' are removed:
> ----file: test.xml--------------------------------------------
> <test>
>    123 <a/> 456
> </test>
> --------------------------------------------------------------
> (xml-parse-file "test.xml")
> ===>
> ((test nil "123 " (a nil "") "456
> "))
[...]
> In `xml.el' a comment says:
>       ;; Clean up the string (no newline characters)
>       ;; Not done, since as per XML specifications, the XML processor
>       ;; should always pass the whole string to the application.
> Does this mean, the current implementation of `xml.el' is not standard
> compliant (which would justify a change of that behaviour)?

I believe you are right.  The patch below fixes the behavior for
your particular example, although there are several more places
in the code where (skip-chars-forward " \t\n") and some of them
should also be removed.
Emmanuel, could you look into that ?


        Stefan


Index: xml.el
===================================================================
RCS file: /cvs/emacs/lisp/xml.el,v
retrieving revision 1.8
diff -u -u -b -r1.8 xml.el
--- xml.el      2001/10/18 20:22:53     1.8
+++ xml.el      2001/11/02 00:47:41
@@ -226,14 +226,14 @@
       (if (looking-at "/>")
          (progn
            (forward-char 2)
-           (skip-chars-forward " \t\n")
+           ;; (skip-chars-forward " \t\n")
            (append children '("")))
 
        ;; is this a valid start tag ?
        (if (eq (char-after) ?>)
            (progn
              (forward-char 1)
-             (skip-chars-forward " \t\n")
+             ;; (skip-chars-forward " \t\n")
              ;;  Now check that we have the right end-tag. Note that this one 
might
              ;;  contain spaces after the tag name
              (while (not (looking-at (concat "</" node-name "[ \t\n]*>")))



reply via email to

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