;;; -*- Mode: lisp; Syntax: ansi-common-lisp; Base: 10; Package: web-user; -*- ;;; ;;; how to load cl-xml (in-package :web-user)
20031024
james anderson
|
[loading] [parsing] [accessor functions] [paths] [combinations] [rtansformations] |
in order to load the cl-xml libraries, one must do three things:
define-system utility. it derives from the definition tool for cl-http, but is extended to support dependancies. the cl-xml release also includes macros which rewrite the definition forms to asdf and mk:defsystem syntax. note that these forms specify the pathnames relative to this particular file.
(load (merge-pathnames (make-pathname :name "define-system" :directory '(:relative :up :up "library"))
*load-pathname*))
next, tell it where to find the system description.
(register-system-definition :xpath (merge-pathnames (make-pathname :name "sysdcl" :directory '(:relative :up :up)) *load-pathname*))next, indicate which features one wishes the library to support. in this case specify to use symbols for xml names
(pushnew :xml-symbols *features*) (setf *features* (remove :nameset-tokenizer *features*))finally invoke the build process to compile and load the xpath library. since the system description declares it to depend on the document models and the parser, those modules are compiled and loaded as well
(execute-system-operations :xpath '(:compile :load))next, define a package for the howto code itself. this is a "user" package, which means that it is defined separate from the library packages and inherits from the library interface packages and/or imports specific symbols.
(defpackage :web-user (:use :common-lisp #+ccl :ccl :xqdm :xmlp) #+ccl (:shadowing-import-from :xqdm :target) (:import-from :xqdm :./* :.//* :./) (:import-from :xmlp :parse-document) (:import-from :xml-path :xpath-parser :map-nodes))finally, as a check, print a list of features
(format *trace-output* "~%cl xml loaded:~%~s" *features*) :eof