From: Juanma Barranquero Date: Fri, 10 Jan 2003 08:34:04 +0000 (+0000) Subject: (xml-parse-tag, xml-parse-attlist, xml-skip-dtd, xml-parse-dtd, X-Git-Tag: ttn-vms-21-2-B4~11753 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=adb266eff0b91f44706d593ec87b67253325fd32;p=emacs.git (xml-parse-tag, xml-parse-attlist, xml-skip-dtd, xml-parse-dtd, xml-parse-elem-type): Be more flexible in recognizing empty elements. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6c61f98edc8..aade4d68813 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,14 @@ +2003-01-10 Mark A. Hershberger + + * xml.el (xml-parse-tag, xml-parse-attlist, xml-skip-dtd) + (xml-parse-dtd, xml-parse-elem-type): Be more flexible in recognizing + empty elements. + +2003-01-10 Luc Teirlinck + + * progmodes/sh-script.el (sh-set-shell): Make sh-shell-file the default + shell. + 2003-01-09 John Wiegley * pcomplete.el (pcomplete-termination-string): Added a variable @@ -6,7 +17,7 @@ 2003-01-09 Karl Berry - * sort.el (sort-regexp-fields): pass noerror to re-search-forward, + * sort.el (sort-regexp-fields): Pass noerror to re-search-forward, so that we don't fail if no records match record-regexp. 2003-01-09 Markus Rost @@ -35,7 +46,7 @@ * mail/mh-alias.el, mail/mh-customize.el, mail/mh-identity.el, mail/mh-loaddefs.el, toolbar/alias.pbm, toolbar/alias.xpm: Added. - + * mail/mh-comp.el, mail/mh-e.el, mail/mh-funcs.el, mail/mh-index.el, mail/mh-mime.el, mail/mh-pick.el, mail/mh-seq.el, mail/mh-speed.el, mail/mh-utils.el, diff --git a/lisp/xml.el b/lisp/xml.el index 0e7bf98df1d..0464cac92f5 100644 --- a/lisp/xml.el +++ b/lisp/xml.el @@ -184,7 +184,7 @@ Returns one of: ;; beginning of a document) ((looking-at "<\\?") (search-forward "?>" end) - (skip-chars-forward " \t\n") + (goto-char (- (re-search-forward "[^[:space:]]") 1)) (xml-parse-tag end)) ;; Character data (CDATA) sections, in which no tag should be interpreted ((looking-at " \t\n]+\\)") + ((looking-at "<\\([^/>[:space:]]+\\)") (goto-char (match-end 1)) (let* ((case-fold-search nil) ;; XML is case-sensitive. (node-name (match-string 1)) @@ -219,7 +219,7 @@ Returns one of: pos) ;; is this an empty element ? - (if (looking-at "/[ \t\n]*>") + (if (looking-at "/[[:space:]]*>") (progn (forward-char 2) (nreverse (cons '("") children))) @@ -230,7 +230,7 @@ Returns one of: (forward-char 1) ;; 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 ""))) + (while (not (looking-at (concat ""))) (cond ((looking-at " (point) end) (error "XML: end of attribute list not found before end of region")) ) @@ -318,14 +318,14 @@ The DTD must end before the position END in the current buffer. The point must be just before the starting tag of the DTD. This follows the rule [28] in the XML specifications." (forward-char (length "") + (if (looking-at "[[:space:]]*>") (error "XML: invalid DTD (excepting name of the document)")) (condition-case nil (progn (forward-word 1) ;; name of the document - (skip-chars-forward " \t\n") + (goto-char (- (re-search-forward "[^[:space:]]") 1)) (if (looking-at "\\[") - (re-search-forward "\\][ \t\n]*>" end) + (re-search-forward "\\][[:space:]]*>" end) (search-forward ">" end))) (error (error "XML: No end to the DTD")))) @@ -333,7 +333,7 @@ This follows the rule [28] in the XML specifications." "Parse the DTD that point is looking at. The DTD must end before the position END in the current buffer." (forward-char (length "") (error "XML: invalid DTD (excepting name of the document)")) @@ -343,7 +343,7 @@ The DTD must end before the position END in the current buffer." type element end-pos) (goto-char (match-end 0)) - (skip-chars-forward " \t\n") + (goto-char (- (re-search-forward "[^[:space:]]") 1)) ;; External DTDs => don't know how to handle them yet (if (looking-at "SYSTEM") @@ -354,13 +354,13 @@ The DTD must end before the position END in the current buffer." ;; Parse the rest of the DTD (forward-char 1) - (while (and (not (looking-at "[ \t\n]*\\]")) + (while (and (not (looking-at "[[:space:]]*\\]")) (<= (point) end)) (cond ;; Translation of rule [45] of XML specifications ((looking-at - "[\t \n]*]+\\)>") + "[[:space:]]*]+\\)>") (setq element (intern (match-string-no-properties 1)) type (match-string-no-properties 2)) @@ -368,13 +368,13 @@ The DTD must end before the position END in the current buffer." ;; Translation of rule [46] of XML specifications (cond - ((string-match "^EMPTY[ \t\n]*$" type) ;; empty declaration + ((string-match "^EMPTY[[:space:]]*$" type) ;; empty declaration (setq type 'empty)) - ((string-match "^ANY[ \t\n]*$" type) ;; any type of contents + ((string-match "^ANY[[:space:]]*$" type) ;; any type of contents (setq type 'any)) - ((string-match "^(\\(.*\\))[ \t\n]*$" type) ;; children ([47]) + ((string-match "^(\\(.*\\))[[:space:]]*$" type) ;; children ([47]) (setq type (xml-parse-elem-type (match-string-no-properties 1 type)))) - ((string-match "^%[^;]+;[ \t\n]*$" type) ;; substitution + ((string-match "^%[^;]+;[[:space:]]*$" type) ;; substitution nil) (t (error "XML: Invalid element type in the DTD"))) @@ -416,7 +416,7 @@ The DTD must end before the position END in the current buffer." (mapcar 'xml-parse-elem-type (split-string elem ",")))) ))) - (if (string-match "[ \t\n]*\\([^+*?]+\\)\\([+*?]?\\)" string) + (if (string-match "[[:space:]]*\\([^+*?]+\\)\\([+*?]?\\)" string) (setq elem (match-string 1 string) modifier (match-string 2 string))))