From 1080d8de10b27db9667e6e5f280bd7082897a243 Mon Sep 17 00:00:00 2001 From: dlichteblau Date: Sun, 24 Feb 2008 19:03:48 +0000 Subject: [PATCH] add XPath support for xmls-compat --- xml/xmls-compat.lisp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/xml/xmls-compat.lisp b/xml/xmls-compat.lisp index cd98853..aa3d8bc 100644 --- a/xml/xmls-compat.lisp +++ b/xml/xmls-compat.lisp @@ -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")))