changeset 58724:99943ffd0774

Skip parameter entity declarations.
author Mark A. Hershberger <mah@everybody.org>
date Thu, 02 Dec 2004 07:47:21 +0000
parents 9104d032d2fa
children 27f1bbfc9402
files lisp/xml.el
diffstat 1 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/xml.el	Thu Dec 02 07:19:03 2004 +0000
+++ b/lisp/xml.el	Thu Dec 02 07:47:21 2004 +0000
@@ -179,7 +179,7 @@
       xml)))
 
 
-(let* ((start-chars (concat ":[:alpha:]_"))
+(let* ((start-chars (concat "[:alpha:]:_"))
        (name-chars  (concat "-[:digit:]." start-chars))
 ;;[3]   	S	   ::=   	(#x20 | #x9 | #xD | #xA)+
        (whitespace  "[ \t\n\r]"))
@@ -652,6 +652,22 @@
 					       (xml-parse-fragment
 						xml-validating-parser
 						parse-ns))))))))
+	   ;; skip parameter entity declarations
+	   ((or (looking-at (concat "<!ENTITY[ \t\n\r]+%[ \t\n\r]+\\(" xml-name-re
+				    "\\)[ \t\n\r]+SYSTEM[ \t\n\r]+"
+				    "\\(\"[^\"]*\"\\|'[^']*'\\)[ \t\n\r]*>"))
+		(looking-at (concat "<!ENTITY[ \t\n\r]+"
+				    "%[ \t\n\r]+"
+				    "\\(" xml-name-re "\\)[ \t\n\r]+"
+				    "PUBLIC[ \t\n\r]+"
+				    "\\(\"[- \r\na-zA-Z0-9'()+,./:=?;!*#@$_%]*\""
+				    "\\|'[- \r\na-zA-Z0-9()+,./:=?;!*#@$_%]*'\\)[ \t\n\r]+"
+				    "\\(\"[^\"]+\"\\|'[^']+'\\)"
+				    "[ \t\n\r]*>")))
+	    (goto-char (match-end 0)))
+	   ;; skip parameter entities
+	   ((looking-at (concat "%" xml-name-re ";"))
+	    (goto-char (match-end 0)))
 	   (t
 	    (when xml-validating-parser
 	      (error "XML: (Validity) Invalid DTD item"))))))