Update of /project/s-xml/cvsroot/s-xml/src In directory common-lisp.net:/tmp/cvs-serv14436/src
Modified Files: package.lisp xml.lisp Log Message: added xml prefix namespace as per REC-xml-names-19990114 (by Rudi Schlatte)
Date: Sun Nov 20 15:24:35 2005 Author: scaekenberghe
Index: s-xml/src/package.lisp diff -u s-xml/src/package.lisp:1.5 s-xml/src/package.lisp:1.6 --- s-xml/src/package.lisp:1.5 Wed Sep 21 19:06:24 2005 +++ s-xml/src/package.lisp Sun Nov 20 15:24:34 2005 @@ -1,9 +1,9 @@ ;;;; -*- mode: lisp -*- ;;;; -;;;; $Id: package.lisp,v 1.5 2005/09/21 17:06:24 scaekenberghe Exp $ +;;;; $Id: package.lisp,v 1.6 2005/11/20 14:24:34 scaekenberghe Exp $ ;;;; ;;;; This is a Common Lisp implementation of a very basic XML parser. -;;;; The parser is non-validating and not at all complete (no CDATA). +;;;; The parser is non-validating. ;;;; The API into the parser is pure functional parser hook model that comes from SSAX, ;;;; see also http://pobox.com/~oleg/ftp/Scheme/xml.html or http://ssax.sourceforge.net ;;;; Different DOM models are provided, an XSML, an LXML and a xml-element struct based one.
Index: s-xml/src/xml.lisp diff -u s-xml/src/xml.lisp:1.13 s-xml/src/xml.lisp:1.14 --- s-xml/src/xml.lisp:1.13 Sun Nov 6 13:44:48 2005 +++ s-xml/src/xml.lisp Sun Nov 20 15:24:34 2005 @@ -1,6 +1,6 @@ ;;;; -*- mode: lisp -*- ;;;; -;;;; $Id: xml.lisp,v 1.13 2005/11/06 12:44:48 scaekenberghe Exp $ +;;;; $Id: xml.lisp,v 1.14 2005/11/20 14:24:34 scaekenberghe Exp $ ;;;; ;;;; This is a Common Lisp implementation of a basic but usable XML parser. ;;;; The parser is non-validating and not complete (no CDATA). @@ -154,15 +154,29 @@ :initform nil)) (:documentation "Describes an XML namespace and how it is handled"))
+(defmethod print-object ((object xml-namespace) stream) + (print-unreadable-object (object stream :type t :identity t) + (format stream "~A - ~A" (get-prefix object) (get-uri object)))) + (defvar *local-namespace* (make-instance 'xml-namespace :uri "local" :prefix "" :package (find-package :keyword)) "The local (global default) XML namespace")
-(defvar *known-namespaces* (list *local-namespace*) +(defvar *xml-namespace* (make-instance 'xml-namespace + :uri "http://www.w3.org/XML/1998/namespace" + :prefix "xml" + :package (or (find-package :xml) + (make-package :xml :nicknames '("XML")))) + "REC-xml-names-19990114 says the prefix xml is bound to the namespace http://www.w3.org/XML/1998/namespace.") + +(defvar *known-namespaces* (list *local-namespace* *xml-namespace*) "The list of known/defined namespaces")
+(defvar *namespaces* `(("xml" . ,*xml-namespace*) ("" . ,*local-namespace*)) + "Ordered list of (prefix . XML-namespace) bindings currently in effect - special variable") + (defun find-namespace (uri) "Find a registered XML namespace identified by uri" (find uri *known-namespaces* :key #'get-uri :test #'string-equal)) @@ -179,9 +193,6 @@ :package (find-package package))) *known-namespaces*)) namespace)) - -(defvar *namespaces* `(("" . ,*local-namespace*)) - "Ordered list of (prefix . XML-namespace) bindings currently in effect - special variable")
(defun find-namespace-binding (prefix namespaces) "Find the XML namespace currently bound to prefix in the namespaces bindings"