-;; @(#) xml.el --- XML parser
+;;; xml.el --- XML parser
-;; Copyright (C) 2000 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2001 Free Software Foundation, Inc.
;; Author: Emmanuel Briot <briot@gnat.com>
;; Maintainer: Emmanuel Briot <briot@gnat.com>
(add-to-list 'xml result))))
;; translation of rule [1] of XML specifications
- (error "XML files can have only one toplevel tag.")))
+ (error "XML files can have only one toplevel tag")))
(goto-char end)))
(if parse-dtd
(cons dtd (reverse xml))
(append children '("")))
;; is this a valid start tag ?
- (if (= (char-after) ?>)
+ (if (eq (char-after) ?>)
(progn
(forward-char 1)
(skip-chars-forward " \t\n")
(goto-char (match-end 0))
(skip-chars-forward " \t\n")
(if (> (point) end)
- (error "XML: End tag for %s not found before end of region."
+ (error "XML: End tag for %s not found before end of region"
node-name))
children
)
;; This was an invalid start tag
(error "XML: Invalid attribute list")
))))
+ (t ;; This is not a tag.
+ (error "XML: Invalid character"))
))
(defun xml-parse-attlist (end)
;; Do we have a string between quotes (or double-quotes),
;; or a simple word ?
(unless (looking-at "\"\\([^\"]+\\)\"")
- (unless (looking-at "'\\([^\"]+\\)'")
- (error "XML: Attribute values must be given between quotes.")))
+ (unless (looking-at "'\\([^']+\\)'")
+ (error "XML: Attribute values must be given between quotes")))
;; Each attribute must be unique within a given element
(if (assoc name attlist)
- (error "XML: each attribute must be unique within an element."))
+ (error "XML: each attribute must be unique within an element"))
(set 'attlist (append attlist
(list (cons name (match-string-no-properties 1)))))
(goto-char (match-end 0))
(skip-chars-forward " \t\n")
(if (> (point) end)
- (error "XML: end of attribute list not found before end of region."))
+ (error "XML: end of attribute list not found before end of region"))
)
attlist
))
;; External DTDs => don't know how to handle them yet
(if (looking-at "SYSTEM")
- (error "XML: Don't know how to handle external DTDs."))
+ (error "XML: Don't know how to handle external DTDs"))
(if (not (= (char-after) ?\[))
- (error "XML: Unknown declaration in the DTD."))
+ (error "XML: Unknown declaration in the DTD"))
;; Parse the rest of the DTD
(forward-char 1)
;; rule [45]: the element declaration must be unique
(if (assoc element dtd)
- (error "XML: elements declaration must be unique in a DTD (<%s>)."
+ (error "XML: elements declaration must be unique in a DTD (<%s>)"
(symbol-name element)))
;; Store the element in the DTD