aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/xml.el
diff options
context:
space:
mode:
authorKaroly Lorentey2005-06-15 12:57:51 +0000
committerKaroly Lorentey2005-06-15 12:57:51 +0000
commitef85512e51f043d73788f00a2aed13cccde0682c (patch)
treefc1fa1378533250f260ef8eaa9a84ae882d9df84 /lisp/xml.el
parent8736257554f49445f7b4402ac7a9436b38ce6452 (diff)
parentef88a9999004e6c26148c8d280d6a41f623d7249 (diff)
downloademacs-ef85512e51f043d73788f00a2aed13cccde0682c.tar.gz
emacs-ef85512e51f043d73788f00a2aed13cccde0682c.zip
Merged from miles@gnu.org--gnu-2005 (patch 80-82, 350-422)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-350 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-351 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-352 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-353 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-354 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-355 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-356 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-357 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-358 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-359 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-360 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-361 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-362 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-363 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-364 Remove "-face" suffix from widget faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365 Remove "-face" suffix from custom faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366 Remove "-face" suffix from change-log faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-367 Remove "-face" suffix from compilation faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-368 Remove "-face" suffix from diff-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-369 lisp/longlines.el (longlines-visible-face): Face removed * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-370 Remove "-face" suffix from woman faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-371 Remove "-face" suffix from whitespace-highlight face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372 Remove "-face" suffix from ruler-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-373 Remove "-face" suffix from show-paren faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-374 Remove "-face" suffix from log-view faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-375 Remove "-face" suffix from smerge faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-376 Remove "-face" suffix from show-tabs faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-377 Remove "-face" suffix from highlight-changes faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-378 Remove "-face" suffix from and downcase info faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-379 Remove "-face" suffix from pcvs faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-380 Update uses of renamed pcvs faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-381 Tweak ChangeLog * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-382 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-383 Remove "-face" suffix from strokes-char face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-384 Remove "-face" suffix from compare-windows face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-385 Remove "-face" suffix from calendar faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-386 Remove "-face" suffix from diary-button face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-387 Remove "-face" suffix from testcover faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-388 Remove "-face" suffix from viper faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389 Remove "-face" suffix from org faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-390 Remove "-face" suffix from sgml-namespace face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-391 Remove "-face" suffix from table-cell face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-392 Remove "-face" suffix from tex-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-393 Remove "-face" suffix from texinfo-heading face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394 Remove "-face" suffix from flyspell faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-395 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-396 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-397 Remove "-face" suffix from gomoku faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-398 Remove "-face" suffix from mpuz faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-399 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-400 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-401 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-402 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-403 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-404 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-405 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-406 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-407 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-408 Remove "-face" suffix from Buffer-menu-buffer face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-409 Remove "-face" suffix from antlr-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-410 Remove "-face" suffix from ebrowse faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-411 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-412 Remove "-face" suffix from flymake faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-413 Remove "-face" suffix from idlwave faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-414 Remove "-face" suffix from sh-script faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-415 Remove "-face" suffix from vhdl-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-416 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-417 Remove "-face" suffix from which-func face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-418 Remove "-face" suffix from cperl-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-419 Remove "-face" suffix from ld-script faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-420 Fix cperl-mode font-lock problem * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-421 Tweak which-func face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-422 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-80 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-81 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-82 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-350
Diffstat (limited to 'lisp/xml.el')
-rw-r--r--lisp/xml.el60
1 files changed, 48 insertions, 12 deletions
diff --git a/lisp/xml.el b/lisp/xml.el
index f9527a276b1..f4300817836 100644
--- a/lisp/xml.el
+++ b/lisp/xml.el
@@ -211,6 +211,35 @@ If PARSE-NS is non-nil, then QNAMES are expanded."
211 (defvar xml-pe-reference-re (concat "%" xml-name-re ";")) 211 (defvar xml-pe-reference-re (concat "%" xml-name-re ";"))
212;;[67] Reference ::= EntityRef | CharRef 212;;[67] Reference ::= EntityRef | CharRef
213 (defvar xml-reference-re (concat "\\(?:" xml-entity-ref "\\|" xml-char-ref-re "\\)")) 213 (defvar xml-reference-re (concat "\\(?:" xml-entity-ref "\\|" xml-char-ref-re "\\)"))
214;;[10] AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'"
215 (defvar xml-att-value-re (concat "\\(?:\"\\(?:[^&\"]\\|" xml-reference-re "\\)*\"\\|"
216 "'\\(?:[^&']\\|" xml-reference-re "\\)*'\\)"))
217;;[56] TokenizedType ::= 'ID' [VC: ID] [VC: One ID per Element Type] [VC: ID Attribute Default]
218;; | 'IDREF' [VC: IDREF]
219;; | 'IDREFS' [VC: IDREF]
220;; | 'ENTITY' [VC: Entity Name]
221;; | 'ENTITIES' [VC: Entity Name]
222;; | 'NMTOKEN' [VC: Name Token]
223;; | 'NMTOKENS' [VC: Name Token]
224 (defvar xml-tokenized-type-re "\\(?:ID\\|IDREF\\|IDREFS\\|ENTITY\\|ENTITIES\\|NMTOKEN\\|NMTOKENS\\)")
225;;[58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')'
226 (defvar xml-notation-type-re (concat "\\(?:NOTATION" whitespace "(" whitespace "*" xml-name-re
227 "\\(?:" whitespace "*|" whitespace "*" xml-name-re "\\)*" whitespace "*)\\)"))
228;;[59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')' [VC: Enumeration] [VC: No Duplicate Tokens]
229 (defvar xml-enumeration-re (concat "\\(?:(" whitespace "*" xml-nmtoken-re
230 "\\(?:" whitespace "*|" whitespace "*" xml-nmtoken-re "\\)*"
231 whitespace ")\\)"))
232;;[57] EnumeratedType ::= NotationType | Enumeration
233 (defvar xml-enumerated-type-re (concat "\\(?:" xml-notation-type-re "\\|" xml-enumeration-re "\\)"))
234;;[54] AttType ::= StringType | TokenizedType | EnumeratedType
235;;[55] StringType ::= 'CDATA'
236 (defvar xml-att-type-re (concat "\\(?:CDATA\\|" xml-tokenized-type-re "\\|" xml-notation-type-re"\\|" xml-enumerated-type-re "\\)"))
237;;[60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue)
238 (defvar xml-default-decl-re (concat "\\(?:#REQUIRED\\|#IMPLIED\\|\\(?:#FIXED" whitespace "\\)*" xml-att-value-re "\\)"))
239;;[53] AttDef ::= S Name S AttType S DefaultDecl
240 (defvar xml-att-def-re (concat "\\(?:" whitespace "*" xml-name-re
241 whitespace "*" xml-att-type-re
242 whitespace "*" xml-default-decl-re "\\)"))
214;;[9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"' 243;;[9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"'
215;; | "'" ([^%&'] | PEReference | Reference)* "'" 244;; | "'" ([^%&'] | PEReference | Reference)* "'"
216 (defvar xml-entity-value-re (concat "\\(?:\"\\(?:[^%&\"]\\|" xml-pe-reference-re 245 (defvar xml-entity-value-re (concat "\\(?:\"\\(?:[^%&\"]\\|" xml-pe-reference-re
@@ -580,7 +609,7 @@ This follows the rule [28] in the XML specifications."
580 (error "XML: Bad DTD") 609 (error "XML: Bad DTD")
581 (forward-char) 610 (forward-char)
582 ;; Parse the rest of the DTD 611 ;; Parse the rest of the DTD
583 ;; Fixme: Deal with ATTLIST, NOTATION, PIs. 612 ;; Fixme: Deal with NOTATION, PIs.
584 (while (not (looking-at "\\s-*\\]")) 613 (while (not (looking-at "\\s-*\\]"))
585 (skip-syntax-forward " ") 614 (skip-syntax-forward " ")
586 (cond 615 (cond
@@ -616,16 +645,24 @@ This follows the rule [28] in the XML specifications."
616 ;; Store the element in the DTD 645 ;; Store the element in the DTD
617 (push (list element type) dtd) 646 (push (list element type) dtd)
618 (goto-char end-pos)) 647 (goto-char end-pos))
648
649 ;; Translation of rule [52] of XML specifications
650 ((looking-at (concat "<!ATTLIST[ \t\n\r]*\\(" xml-name-re
651 "\\)[ \t\n\r]*\\(" xml-att-def-re
652 "\\)*[ \t\n\r]*>"))
653
654 ;; We don't do anything with ATTLIST currently
655 (goto-char (match-end 0)))
656
619 ((looking-at "<!--") 657 ((looking-at "<!--")
620 (search-forward "-->")) 658 (search-forward "-->"))
621 ((looking-at (concat "<!ENTITY[ \t\n\r]*\\(" xml-name-re 659 ((looking-at (concat "<!ENTITY[ \t\n\r]*\\(" xml-name-re
622 "\\)[ \t\n\r]*\\(" xml-entity-value-re 660 "\\)[ \t\n\r]*\\(" xml-entity-value-re
623 "\\)[ \t\n\r]*>")) 661 "\\)[ \t\n\r]*>"))
624 (let ((name (buffer-substring (nth 2 (match-data)) 662 (let ((name (match-string 1))
625 (nth 3 (match-data)))) 663 (value (substring (match-string 2) 1
626 (value (buffer-substring (+ (nth 4 (match-data)) 1) 664 (- (length (match-string 2)) 1))))
627 (- (nth 5 (match-data)) 1)))) 665 (goto-char (match-end 0))
628 (goto-char (nth 1 (match-data)))
629 (setq xml-entity-alist 666 (setq xml-entity-alist
630 (append xml-entity-alist 667 (append xml-entity-alist
631 (list (cons name 668 (list (cons name
@@ -644,11 +681,10 @@ This follows the rule [28] in the XML specifications."
644 "\\|'[- \r\na-zA-Z0-9()+,./:=?;!*#@$_%]*'" 681 "\\|'[- \r\na-zA-Z0-9()+,./:=?;!*#@$_%]*'"
645 "[ \t\n\r]+\\(\"[^\"]*\"\\|'[^']*'\\)" 682 "[ \t\n\r]+\\(\"[^\"]*\"\\|'[^']*'\\)"
646 "[ \t\n\r]*>"))) 683 "[ \t\n\r]*>")))
647 (let ((name (buffer-substring (nth 2 (match-data)) 684 (let ((name (match-string 1))
648 (nth 3 (match-data)))) 685 (file (substring (match-string 2) 1
649 (file (buffer-substring (+ (nth 4 (match-data)) 1) 686 (- (length (match-string 2)) 1))))
650 (- (nth 5 (match-data)) 1)))) 687 (goto-char (match-end 0))
651 (goto-char (nth 1 (match-data)))
652 (setq xml-entity-alist 688 (setq xml-entity-alist
653 (append xml-entity-alist 689 (append xml-entity-alist
654 (list (cons name (with-temp-buffer 690 (list (cons name (with-temp-buffer
@@ -677,7 +713,7 @@ This follows the rule [28] in the XML specifications."
677 (when xml-validating-parser 713 (when xml-validating-parser
678 (error "XML: (Validity) Invalid DTD item")))))) 714 (error "XML: (Validity) Invalid DTD item"))))))
679 (if (looking-at "\\s-*]>") 715 (if (looking-at "\\s-*]>")
680 (goto-char (nth 1 (match-data))))) 716 (goto-char (match-end 0))))
681 (nreverse dtd))) 717 (nreverse dtd)))
682 718
683(defun xml-parse-elem-type (string) 719(defun xml-parse-elem-type (string)