/[emacs]/emacs/lisp/xml.el
ViewVC logotype

Diff of /emacs/lisp/xml.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.45 by hexmode, Thu May 26 14:35:46 2005 UTC revision 1.46 by hexmode, Fri Jun 10 15:37:37 2005 UTC
# Line 211  If PARSE-NS is non-nil, then QNAMES are Line 211  If PARSE-NS is non-nil, then QNAMES are
211    (defvar xml-pe-reference-re    (concat "%" xml-name-re ";"))    (defvar xml-pe-reference-re    (concat "%" xml-name-re ";"))
212  ;;[67] Reference   ::= EntityRef | CharRef  ;;[67] Reference   ::= EntityRef | CharRef
213    (defvar xml-reference-re       (concat "\\(?:" xml-entity-ref "\\|" xml-char-ref-re "\\)"))    (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 "\\)"))
243  ;;[9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"'  ;;[9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"'
244  ;;                 |  "'" ([^%&'] | PEReference | Reference)* "'"  ;;                 |  "'" ([^%&'] | PEReference | Reference)* "'"
245    (defvar xml-entity-value-re    (concat "\\(?:\"\\(?:[^%&\"]\\|" xml-pe-reference-re    (defvar xml-entity-value-re    (concat "\\(?:\"\\(?:[^%&\"]\\|" xml-pe-reference-re
# Line 580  This follows the rule [28] in the XML sp Line 609  This follows the rule [28] in the XML sp
609            (error "XML: Bad DTD")            (error "XML: Bad DTD")
610          (forward-char)          (forward-char)
611          ;;  Parse the rest of the DTD          ;;  Parse the rest of the DTD
612          ;;  Fixme: Deal with ATTLIST, NOTATION, PIs.          ;;  Fixme: Deal with NOTATION, PIs.
613          (while (not (looking-at "\\s-*\\]"))          (while (not (looking-at "\\s-*\\]"))
614            (skip-syntax-forward " ")            (skip-syntax-forward " ")
615            (cond            (cond
# Line 616  This follows the rule [28] in the XML sp Line 645  This follows the rule [28] in the XML sp
645              ;;  Store the element in the DTD              ;;  Store the element in the DTD
646              (push (list element type) dtd)              (push (list element type) dtd)
647              (goto-char end-pos))              (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    
657             ((looking-at "<!--")             ((looking-at "<!--")
658              (search-forward "-->"))              (search-forward "-->"))
659             ((looking-at (concat "<!ENTITY[ \t\n\r]*\\(" xml-name-re             ((looking-at (concat "<!ENTITY[ \t\n\r]*\\(" xml-name-re
660                                  "\\)[ \t\n\r]*\\(" xml-entity-value-re                                  "\\)[ \t\n\r]*\\(" xml-entity-value-re
661                                  "\\)[ \t\n\r]*>"))                                  "\\)[ \t\n\r]*>"))
662              (let ((name  (buffer-substring (nth 2 (match-data))              (let ((name  (match-string 1))
663                                             (nth 3 (match-data))))                    (value (substring (match-string 2) 1
664                    (value (buffer-substring (+ (nth 4 (match-data)) 1)                                      (- (length (match-string 2)) 1))))
665                                             (- (nth 5 (match-data)) 1))))                (goto-char (match-end 0))
               (goto-char (nth 1 (match-data)))  
666                (setq xml-entity-alist                (setq xml-entity-alist
667                      (append xml-entity-alist                      (append xml-entity-alist
668                              (list (cons name                              (list (cons name
# Line 644  This follows the rule [28] in the XML sp Line 681  This follows the rule [28] in the XML sp
681                                      "\\|'[- \r\na-zA-Z0-9()+,./:=?;!*#@$_%]*'"                                      "\\|'[- \r\na-zA-Z0-9()+,./:=?;!*#@$_%]*'"
682                                      "[ \t\n\r]+\\(\"[^\"]*\"\\|'[^']*'\\)"                                      "[ \t\n\r]+\\(\"[^\"]*\"\\|'[^']*'\\)"
683                                      "[ \t\n\r]*>")))                                      "[ \t\n\r]*>")))
684              (let ((name  (buffer-substring (nth 2 (match-data))              (let ((name  (match-string 1))
685                                             (nth 3 (match-data))))                    (file  (substring (match-string 2) 1
686                    (file  (buffer-substring (+ (nth 4 (match-data)) 1)                                      (- (length (match-string 2)) 1))))
687                                             (- (nth 5 (match-data)) 1))))                (goto-char (match-end 0))
               (goto-char (nth 1 (match-data)))  
688                (setq xml-entity-alist                (setq xml-entity-alist
689                      (append xml-entity-alist                      (append xml-entity-alist
690                              (list (cons name (with-temp-buffer                              (list (cons name (with-temp-buffer
# Line 677  This follows the rule [28] in the XML sp Line 713  This follows the rule [28] in the XML sp
713              (when xml-validating-parser              (when xml-validating-parser
714                (error "XML: (Validity) Invalid DTD item"))))))                (error "XML: (Validity) Invalid DTD item"))))))
715        (if (looking-at "\\s-*]>")        (if (looking-at "\\s-*]>")
716            (goto-char (nth 1 (match-data)))))            (goto-char (match-end 0))))
717      (nreverse dtd)))      (nreverse dtd)))
718    
719  (defun xml-parse-elem-type (string)  (defun xml-parse-elem-type (string)

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.46

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26