Update of /project/cxml/cvsroot/cxml/xml In directory clnet:/tmp/cvs-serv17828/xml
Modified Files: xmls-compat.lisp Log Message: add XPath support for xmls-compat
--- /project/cxml/cvsroot/cxml/xml/xmls-compat.lisp 2007/11/18 18:43:00 1.6 +++ /project/cxml/cvsroot/cxml/xml/xmls-compat.lisp 2008/02/24 19:03:48 1.7 @@ -9,7 +9,7 @@ (defpackage cxml-xmls (:use :cl :runes) (:export #:make-node #:node-name #:node-ns #:node-attrs #:node-children - #:make-xmls-builder #:map-node)) + #:make-xmls-builder #:map-node #:make-xpath-navigator))
(in-package :cxml-xmls)
@@ -241,3 +241,20 @@ :specified-p t) nil))) (node-attrs node)))) + +;;;; XPath + +(defun make-xpath-navigator () + (make-instance 'xpath-navigator)) + +(defclass xpath-navigator () + ((parents :initform (make-hash-table)) + (prefixes :initform (make-hash-table)) + (children :initform (make-hash-table)) + (attributes :initform (make-hash-table)) + (namespaces :initform (make-hash-table)))) + +(defmethod initialize-instance :after ((instance xpath-navigator) &key) + (with-slots (prefixes) instance + (setf (gethash "http://www.w3.org/XML/1998/namespace" prefixes) + "xml")))