]> git.eshelyaron.com Git - emacs.git/commitdiff
Skip parameter entity declarations.
authorMark A. Hershberger <mah@everybody.org>
Thu, 2 Dec 2004 07:48:25 +0000 (07:48 +0000)
committerMark A. Hershberger <mah@everybody.org>
Thu, 2 Dec 2004 07:48:25 +0000 (07:48 +0000)
lisp/ChangeLog
lisp/xml.el

index 6f3b0205bbf33453d6e9dd42ed8effa5d01b8ee8..50cbc41d107f411c63bcaca962c6aed455c26554 100644 (file)
@@ -7,6 +7,8 @@
        isn't followed by an entity.
        (xml-parse-tag): Concatnate any string following the a
        <![CDATA[]]> section to the parsed CDATA.
+       (xml-parse-dtd): Skip parameter entity declarations and use of
+       parameter entities.
 
 2004-12-01  Luc Teirlinck  <teirllm@auburn.edu>
 
index 550ade8ab8fe9c3c6ee98ebe04832981ed586bef..aba84d332305af002dc009906433795f4be05df9 100644 (file)
@@ -179,7 +179,7 @@ If PARSE-NS is non-nil, then QNAMES are expanded."
       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 @@ This follows the rule [28] in the XML specifications."
                                               (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"))))))