Mercurial > emacs
comparison lisp/xml.el @ 30779:aa097d8d4f1a
(xml-parse-tag, xml-parse-attlist): Do not downcase
identifiers, since XML is case sensitive
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Mon, 14 Aug 2000 12:43:55 +0000 |
parents | 1ea701655cf8 |
children | fd338013d333 |
comparison
equal
deleted
inserted
replaced
30778:293a86f4d8aa | 30779:aa097d8d4f1a |
---|---|
60 ;; child_node ::= node | string | 60 ;; child_node ::= node | string |
61 ;; tag_name ::= string | 61 ;; tag_name ::= string |
62 ;; attribute_list ::= (("attribute" . "value") ("attribute" . "value") ...) | 62 ;; attribute_list ::= (("attribute" . "value") ("attribute" . "value") ...) |
63 ;; | nil | 63 ;; | nil |
64 ;; string ::= "..." | 64 ;; string ::= "..." |
65 ;; | |
66 ;; Since XML is case insensitive, tag_name is always converted to lower-cases. | |
67 ;; tag_name is then converted to a symbol (this is not a string, so that the | |
68 ;; list takes less space in memory and is faster to traverse). | |
69 ;; | 65 ;; |
70 ;; Some macros are provided to ease the parsing of this list | 66 ;; Some macros are provided to ease the parsing of this list |
71 | 67 |
72 ;;; Code: | 68 ;;; Code: |
73 | 69 |
207 ((looking-at "</") | 203 ((looking-at "</") |
208 '()) | 204 '()) |
209 ;; opening tag | 205 ;; opening tag |
210 ((looking-at "<\\([^/> \t]+\\)") | 206 ((looking-at "<\\([^/> \t]+\\)") |
211 (let* ((node-name (match-string 1)) | 207 (let* ((node-name (match-string 1)) |
212 (children (list (intern (downcase node-name)))) | 208 (children (list (intern node-name))) |
213 pos) | 209 pos) |
214 (goto-char (match-end 1)) | 210 (goto-char (match-end 1)) |
215 | 211 |
216 ;; parses the attribute list | 212 ;; parses the attribute list |
217 (set 'children (append children (list (xml-parse-attlist end)))) | 213 (set 'children (append children (list (xml-parse-attlist end)))) |
272 Leaves the point on the first non-blank character after the tag." | 268 Leaves the point on the first non-blank character after the tag." |
273 (let ((attlist '()) | 269 (let ((attlist '()) |
274 name) | 270 name) |
275 (skip-chars-forward " \t\n") | 271 (skip-chars-forward " \t\n") |
276 (while (looking-at "\\([a-zA-Z_:][a-zA-Z0-9.-_:]*\\)[ \t\n]*=[ \t\n]*") | 272 (while (looking-at "\\([a-zA-Z_:][a-zA-Z0-9.-_:]*\\)[ \t\n]*=[ \t\n]*") |
277 (set 'name (intern (downcase (match-string 1)))) | 273 (set 'name (intern (match-string 1))) |
278 (goto-char (match-end 0)) | 274 (goto-char (match-end 0)) |
279 | 275 |
280 ;; Do we have a string between quotes (or double-quotes), | 276 ;; Do we have a string between quotes (or double-quotes), |
281 ;; or a simple word ? | 277 ;; or a simple word ? |
282 (unless (looking-at "\"\\([^\"]+\\)\"") | 278 (unless (looking-at "\"\\([^\"]+\\)\"") |
353 | 349 |
354 ;; Translation of rule [45] of XML specifications | 350 ;; Translation of rule [45] of XML specifications |
355 ((looking-at | 351 ((looking-at |
356 "[\t \n]*<!ELEMENT[ \t\n]+\\([a-zA-Z0-9.%;]+\\)[ \t\n]+\\([^>]+\\)>") | 352 "[\t \n]*<!ELEMENT[ \t\n]+\\([a-zA-Z0-9.%;]+\\)[ \t\n]+\\([^>]+\\)>") |
357 | 353 |
358 (setq element (intern (downcase (match-string-no-properties 1))) | 354 (setq element (intern (match-string-no-properties 1)) |
359 type (match-string-no-properties 2)) | 355 type (match-string-no-properties 2)) |
360 (set 'end-pos (match-end 0)) | 356 (set 'end-pos (match-end 0)) |
361 | 357 |
362 ;; Translation of rule [46] of XML specifications | 358 ;; Translation of rule [46] of XML specifications |
363 (cond | 359 (cond |