From 6688313cc1feda42a82f74ce50848f423ed3cc69 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 9 May 2026 23:21:45 +0000 Subject: [PATCH] refactor: rename systems and packages to io.github.cl-sdk.xml Agent-Logs-Url: https://github.com/cl-sdk/cl-xml/sessions/c0cf3d7f-c8a1-4154-956d-9cadbabe9759 Co-authored-by: diasbruno <362368+diasbruno@users.noreply.github.com> --- README.md | 34 +- api.lisp | 2 +- chars.lisp | 2 +- dom-builder.lisp | 2 +- events.lisp | 2 +- flake.nix | 2 +- cl-soap.asd => io.github.cl-sdk.soap.asd | 6 +- ...test.asd => io.github.cl-sdk.soap.test.asd | 6 +- cl-wsdl.asd => io.github.cl-sdk.wsdl.asd | 6 +- ...test.asd => io.github.cl-sdk.wsdl.test.asd | 6 +- cl-xml.asd => io.github.cl-sdk.xml.asd | 2 +- ....test.asd => io.github.cl-sdk.xml.test.asd | 6 +- cl-xsd.asd => io.github.cl-sdk.xsd.asd | 6 +- ....test.asd => io.github.cl-sdk.xsd.test.asd | 6 +- namespace.lisp | 2 +- package.lisp | 2 +- sax.lisp | 2 +- soap-package.lisp | 4 +- soap.lisp | 2 +- structures.lisp | 2 +- t/cl-soap-package.lisp | 4 +- t/cl-soap-tests.lisp | 362 ++++----- t/cl-wsdl-package.lisp | 4 +- t/cl-wsdl-tests.lisp | 322 ++++---- t/cl-xml-tests.lisp | 764 +++++++++--------- t/cl-xsd-package.lisp | 4 +- t/cl-xsd-tests.lisp | 272 +++---- t/package.lisp | 2 +- tests-runner.lisp | 2 +- tokeniser.lisp | 2 +- wsdl-package.lisp | 4 +- wsdl.lisp | 2 +- xsd-package.lisp | 4 +- xsd.lisp | 2 +- 34 files changed, 925 insertions(+), 927 deletions(-) rename cl-soap.asd => io.github.cl-sdk.soap.asd (74%) rename cl-soap.test.asd => io.github.cl-sdk.soap.test.asd (72%) rename cl-wsdl.asd => io.github.cl-sdk.wsdl.asd (75%) rename cl-wsdl.test.asd => io.github.cl-sdk.wsdl.test.asd (72%) rename cl-xml.asd => io.github.cl-sdk.xml.asd (97%) rename cl-xml.test.asd => io.github.cl-sdk.xml.test.asd (70%) rename cl-xsd.asd => io.github.cl-sdk.xsd.asd (72%) rename cl-xsd.test.asd => io.github.cl-sdk.xsd.test.asd (72%) diff --git a/README.md b/README.md index 5c35332..eee00ae 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,11 @@ -# cl-xml - -> **Note:** cl-xml is a temporary name as it is already taken on Quicklisp. +# io.github.cl-sdk.xml A Common Lisp XML reader, writer, and custom parser. ## Installation ```lisp -(ql:quickload "cl-xml") +(ql:quickload "io.github.cl-sdk.xml") ``` ## Parsing @@ -22,7 +20,7 @@ A Common Lisp XML reader, writer, and custom parser. ```lisp (defvar *doc* - (cl-xml:parse-xml " + (io.github.cl-sdk.xml:parse-xml " hello & world @@ -39,18 +37,18 @@ Provide a subclass of `sax-handler` and pass an instance as `:handler` to methods are no-ops. ```lisp -(defclass my-handler (cl-xml:sax-handler) ()) +(defclass my-handler (io.github.cl-sdk.xml:sax-handler) ()) -(defmethod cl-xml:start-element ((h my-handler) tag attributes) +(defmethod io.github.cl-sdk.xml:start-element ((h my-handler) tag attributes) (format t "open ~a ~a~%" tag attributes)) -(defmethod cl-xml:end-element ((h my-handler) tag) +(defmethod io.github.cl-sdk.xml:end-element ((h my-handler) tag) (format t "close ~a~%" tag)) -(defmethod cl-xml:end-document ((h my-handler)) +(defmethod io.github.cl-sdk.xml:end-document ((h my-handler)) :done) -(cl-xml:parse-xml "" :handler (make-instance 'my-handler)) +(io.github.cl-sdk.xml:parse-xml "" :handler (make-instance 'my-handler)) ;; open root nil ;; open child nil ;; close child @@ -81,10 +79,10 @@ The top-level result of `parse-xml`. | `xml-document-root` | the root `xml-node` | ```lisp -(cl-xml:xml-document-prolog *doc*) +(io.github.cl-sdk.xml:xml-document-prolog *doc*) ;; => (# #) -(cl-xml:xml-node-tag (cl-xml:xml-document-root *doc*)) +(io.github.cl-sdk.xml:xml-node-tag (io.github.cl-sdk.xml:xml-document-root *doc*)) ;; => "root" ``` @@ -97,11 +95,11 @@ The top-level result of `parse-xml`. | `xml-node-children` | list of child nodes (see node types below) | ```lisp -(let* ((root (cl-xml:xml-document-root *doc*)) - (item (first (cl-xml:xml-node-children root)))) - (cl-xml:xml-node-tag item) ; => "item" - (cl-xml:xml-node-attributes item) ; => (("id" . "1")) - (cl-xml:xml-node-children item)) ; => ("hello & world") +(let* ((root (io.github.cl-sdk.xml:xml-document-root *doc*)) + (item (first (io.github.cl-sdk.xml:xml-node-children root)))) + (io.github.cl-sdk.xml:xml-node-tag item) ; => "item" + (io.github.cl-sdk.xml:xml-node-attributes item) ; => (("id" . "1")) + (io.github.cl-sdk.xml:xml-node-children item)) ; => ("hello & world") ``` ### xml-comment @@ -155,7 +153,7 @@ Whitespace-only character data between elements is discarded. ## References -cl-xml is a hand-written recursive-descent parser implemented in Common Lisp. +io.github.cl-sdk.xml is a hand-written recursive-descent parser implemented in Common Lisp. It targets the specifications listed below. - [Extensible Markup Language (XML) 1.0](https://www.w3.org/TR/xml/) — the core grammar and well-formedness rules that govern parsing, character data, entity references, comments, CDATA sections, processing instructions, and the document prolog. diff --git a/api.lisp b/api.lisp index 6336b09..6ecda83 100644 --- a/api.lisp +++ b/api.lisp @@ -1,4 +1,4 @@ -(in-package #:cl-xml) +(in-package #:io.github.cl-sdk.xml) ;;; Event-to-handler bridge diff --git a/chars.lisp b/chars.lisp index cb09bb2..9abf892 100644 --- a/chars.lisp +++ b/chars.lisp @@ -1,4 +1,4 @@ -(in-package #:cl-xml) +(in-package #:io.github.cl-sdk.xml) ;;; Character classification — XML 1.0 §2.3 diff --git a/dom-builder.lisp b/dom-builder.lisp index 3e01cb2..e4249e5 100644 --- a/dom-builder.lisp +++ b/dom-builder.lisp @@ -1,4 +1,4 @@ -(in-package #:cl-xml) +(in-package #:io.github.cl-sdk.xml) ;;; Default DOM-building SAX handler diff --git a/events.lisp b/events.lisp index cdc95e0..c572016 100644 --- a/events.lisp +++ b/events.lisp @@ -1,4 +1,4 @@ -(in-package #:cl-xml) +(in-package #:io.github.cl-sdk.xml) ;;; XML event types — the intermediate representation between the tokeniser ;;; and any downstream processor (SAX handler, validator, etc.). diff --git a/flake.nix b/flake.nix index cbc71f1..003867d 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "cl-xml"; + description = "io.github.cl-sdk.xml"; inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-25.11"; diff --git a/cl-soap.asd b/io.github.cl-sdk.soap.asd similarity index 74% rename from cl-soap.asd rename to io.github.cl-sdk.soap.asd index b6345b9..4680fbc 100644 --- a/cl-soap.asd +++ b/io.github.cl-sdk.soap.asd @@ -1,5 +1,5 @@ -(defsystem #:cl-soap - :description "SOAP 1.1/1.2 support for cl-xml." +(defsystem #:io.github.cl-sdk.soap + :description "SOAP 1.1/1.2 support for io.github.cl-sdk.xml." :version "0.1.0" :author "Bruno Dias " :maintainer "Bruno Dias " @@ -7,6 +7,6 @@ :homepage "https://github.com/cl-sdk/cl-xml" :source-control (:git "https://github.com/cl-sdk/cl-xml") :bug-tracker "https://github.com/cl-sdk/cl-xml/issues" - :depends-on (#:cl-xml) + :depends-on (#:io.github.cl-sdk.xml) :components ((:file "soap-package") (:file "soap" :depends-on ("soap-package")))) diff --git a/cl-soap.test.asd b/io.github.cl-sdk.soap.test.asd similarity index 72% rename from cl-soap.test.asd rename to io.github.cl-sdk.soap.test.asd index 897e20c..616eb97 100644 --- a/cl-soap.test.asd +++ b/io.github.cl-sdk.soap.test.asd @@ -1,12 +1,12 @@ -(defsystem #:cl-soap.test - :description "Tests for cl-soap." +(defsystem #:io.github.cl-sdk.soap.test + :description "Tests for io.github.cl-sdk.xml.soap." :version "0.1.0" :author "Bruno Dias " :license "Unlicense" :homepage "https://github.com/cl-sdk/cl-xml" :source-control (:git "https://github.com/cl-sdk/cl-xml") :bug-tracker "https://github.com/cl-sdk/cl-xml/issues" - :depends-on (#:cl-xml #:cl-soap #:fiveam) + :depends-on (#:io.github.cl-sdk.xml #:io.github.cl-sdk.soap #:fiveam) :components ((:module "t" :components ((:file "cl-soap-package") diff --git a/cl-wsdl.asd b/io.github.cl-sdk.wsdl.asd similarity index 75% rename from cl-wsdl.asd rename to io.github.cl-sdk.wsdl.asd index 284c841..ce575af 100644 --- a/cl-wsdl.asd +++ b/io.github.cl-sdk.wsdl.asd @@ -1,5 +1,5 @@ -(defsystem #:cl-wsdl - :description "WSDL 2.0 support for cl-xml." +(defsystem #:io.github.cl-sdk.wsdl + :description "WSDL 2.0 support for io.github.cl-sdk.xml." :version "0.1.0" :author "Bruno Dias " :maintainer "Bruno Dias " @@ -7,6 +7,6 @@ :homepage "https://github.com/cl-sdk/cl-xml" :source-control (:git "https://github.com/cl-sdk/cl-xml") :bug-tracker "https://github.com/cl-sdk/cl-xml/issues" - :depends-on (#:cl-xml) + :depends-on (#:io.github.cl-sdk.xml) :components ((:file "wsdl-package") (:file "wsdl" :depends-on ("wsdl-package")))) diff --git a/cl-wsdl.test.asd b/io.github.cl-sdk.wsdl.test.asd similarity index 72% rename from cl-wsdl.test.asd rename to io.github.cl-sdk.wsdl.test.asd index da3a91e..43c7f5b 100644 --- a/cl-wsdl.test.asd +++ b/io.github.cl-sdk.wsdl.test.asd @@ -1,12 +1,12 @@ -(defsystem #:cl-wsdl.test - :description "Tests for cl-wsdl." +(defsystem #:io.github.cl-sdk.wsdl.test + :description "Tests for io.github.cl-sdk.xml.wsdl." :version "0.1.0" :author "Bruno Dias " :license "Unlicense" :homepage "https://github.com/cl-sdk/cl-xml" :source-control (:git "https://github.com/cl-sdk/cl-xml") :bug-tracker "https://github.com/cl-sdk/cl-xml/issues" - :depends-on (#:cl-xml #:cl-wsdl #:fiveam) + :depends-on (#:io.github.cl-sdk.xml #:io.github.cl-sdk.wsdl #:fiveam) :components ((:module "t" :components ((:file "cl-wsdl-package") diff --git a/cl-xml.asd b/io.github.cl-sdk.xml.asd similarity index 97% rename from cl-xml.asd rename to io.github.cl-sdk.xml.asd index e096d7f..a8778f9 100644 --- a/cl-xml.asd +++ b/io.github.cl-sdk.xml.asd @@ -1,4 +1,4 @@ -(defsystem #:cl-xml +(defsystem #:io.github.cl-sdk.xml :description "A Common Lisp XML reader, writer, and custom parser." :long-description #.(uiop:read-file-string (uiop:subpathname *load-pathname* "README.md")) diff --git a/cl-xml.test.asd b/io.github.cl-sdk.xml.test.asd similarity index 70% rename from cl-xml.test.asd rename to io.github.cl-sdk.xml.test.asd index 063b473..adf4813 100644 --- a/cl-xml.test.asd +++ b/io.github.cl-sdk.xml.test.asd @@ -1,12 +1,12 @@ -(defsystem #:cl-xml.test - :description "Tests for cl-xml." +(defsystem #:io.github.cl-sdk.xml.test + :description "Tests for io.github.cl-sdk.xml." :version "0.1.0" :author "Bruno Dias " :license "Unlicense" :homepage "https://github.com/cl-sdk/cl-xml" :source-control (:git "https://github.com/cl-sdk/cl-xml") :bug-tracker "https://github.com/cl-sdk/cl-xml/issues" - :depends-on (#:cl-xml #:fiveam #:trivial-gray-streams) + :depends-on (#:io.github.cl-sdk.xml #:fiveam #:trivial-gray-streams) :components ((:module "t" :components ((:file "package") diff --git a/cl-xsd.asd b/io.github.cl-sdk.xsd.asd similarity index 72% rename from cl-xsd.asd rename to io.github.cl-sdk.xsd.asd index 8f1094e..3bd60e7 100644 --- a/cl-xsd.asd +++ b/io.github.cl-sdk.xsd.asd @@ -1,5 +1,5 @@ -(defsystem #:cl-xsd - :description "XSD (XML Schema Definition) support for cl-xml." +(defsystem #:io.github.cl-sdk.xsd + :description "XSD (XML Schema Definition) support for io.github.cl-sdk.xml." :version "0.1.0" :author "Bruno Dias " :maintainer "Bruno Dias " @@ -7,6 +7,6 @@ :homepage "https://github.com/cl-sdk/cl-xml" :source-control (:git "https://github.com/cl-sdk/cl-xml") :bug-tracker "https://github.com/cl-sdk/cl-xml/issues" - :depends-on (#:cl-xml) + :depends-on (#:io.github.cl-sdk.xml) :components ((:file "xsd-package") (:file "xsd" :depends-on ("xsd-package")))) diff --git a/cl-xsd.test.asd b/io.github.cl-sdk.xsd.test.asd similarity index 72% rename from cl-xsd.test.asd rename to io.github.cl-sdk.xsd.test.asd index 957f96e..650bb7c 100644 --- a/cl-xsd.test.asd +++ b/io.github.cl-sdk.xsd.test.asd @@ -1,12 +1,12 @@ -(defsystem #:cl-xsd.test - :description "Tests for cl-xsd." +(defsystem #:io.github.cl-sdk.xsd.test + :description "Tests for io.github.cl-sdk.xml.xsd." :version "0.1.0" :author "Bruno Dias " :license "Unlicense" :homepage "https://github.com/cl-sdk/cl-xml" :source-control (:git "https://github.com/cl-sdk/cl-xml") :bug-tracker "https://github.com/cl-sdk/cl-xml/issues" - :depends-on (#:cl-xml #:cl-xsd #:fiveam) + :depends-on (#:io.github.cl-sdk.xml #:io.github.cl-sdk.xsd #:fiveam) :components ((:module "t" :components ((:file "cl-xsd-package") diff --git a/namespace.lisp b/namespace.lisp index c30ccfa..7c26c73 100644 --- a/namespace.lisp +++ b/namespace.lisp @@ -1,4 +1,4 @@ -(in-package #:cl-xml) +(in-package #:io.github.cl-sdk.xml) ;;; Namespace resolution — Namespaces in XML 1.0 diff --git a/package.lisp b/package.lisp index 0488a2a..4a98338 100644 --- a/package.lisp +++ b/package.lisp @@ -1,4 +1,4 @@ -(defpackage #:cl-xml +(defpackage #:io.github.cl-sdk.xml (:use #:cl #:trivial-gray-streams) (:export ;; Document diff --git a/sax.lisp b/sax.lisp index 5464752..6a93e1c 100644 --- a/sax.lisp +++ b/sax.lisp @@ -1,4 +1,4 @@ -(in-package #:cl-xml) +(in-package #:io.github.cl-sdk.xml) ;;; SAX handler protocol — event-driven parsing interface diff --git a/soap-package.lisp b/soap-package.lisp index 5f799f8..afa2fae 100644 --- a/soap-package.lisp +++ b/soap-package.lisp @@ -1,5 +1,5 @@ -(defpackage #:cl-soap - (:use #:cl #:cl-xml) +(defpackage #:io.github.cl-sdk.soap + (:use #:cl #:io.github.cl-sdk.xml) (:export ;; SOAP namespace URI constants #:+soap-1.1-namespace+ diff --git a/soap.lisp b/soap.lisp index 1ce91ac..d4453c8 100644 --- a/soap.lisp +++ b/soap.lisp @@ -1,4 +1,4 @@ -(in-package #:cl-soap) +(in-package #:io.github.cl-sdk.soap) ;;;; SOAP (Simple Object Access Protocol) — 1.1 and 1.2 implementation ;;;; diff --git a/structures.lisp b/structures.lisp index 21ead04..19963a9 100644 --- a/structures.lisp +++ b/structures.lisp @@ -1,4 +1,4 @@ -(in-package #:cl-xml) +(in-package #:io.github.cl-sdk.xml) ;;; Data structures diff --git a/t/cl-soap-package.lisp b/t/cl-soap-package.lisp index 22aa4e1..52ea7ca 100644 --- a/t/cl-soap-package.lisp +++ b/t/cl-soap-package.lisp @@ -1,3 +1,3 @@ -(defpackage #:cl-soap.test - (:use #:cl #:fiveam #:cl-soap) +(defpackage #:io.github.cl-sdk.soap.test + (:use #:cl #:fiveam #:io.github.cl-sdk.soap) (:export #:cl-soap-suite)) diff --git a/t/cl-soap-tests.lisp b/t/cl-soap-tests.lisp index 58d2459..3db3a48 100644 --- a/t/cl-soap-tests.lisp +++ b/t/cl-soap-tests.lisp @@ -1,4 +1,4 @@ -(in-package #:cl-soap.test) +(in-package #:io.github.cl-sdk.soap.test) (def-suite cl-soap-suite :description "Test suite for cl-soap.") @@ -12,46 +12,46 @@ (test soap-namespace-constants "SOAP namespace URI constants have the correct values." (is (string= "http://schemas.xmlsoap.org/soap/envelope/" - cl-soap:+soap-1.1-namespace+)) + io.github.cl-sdk.soap:+soap-1.1-namespace+)) (is (string= "http://www.w3.org/2003/05/soap-envelope" - cl-soap:+soap-1.2-namespace+))) + io.github.cl-sdk.soap:+soap-1.2-namespace+))) ;;; Structure construction (test soap-envelope-struct "soap-envelope struct can be constructed and its fields read back." - (let* ((body (cl-soap:make-soap-body :payload '())) - (env (cl-soap:make-soap-envelope :version :1.1 :body body))) - (is (cl-soap:soap-envelope-p env)) - (is (eq :1.1 (cl-soap:soap-envelope-version env))) - (is (null (cl-soap:soap-envelope-header env))) - (is (cl-soap:soap-body-p (cl-soap:soap-envelope-body env))))) + (let* ((body (io.github.cl-sdk.soap:make-soap-body :payload '())) + (env (io.github.cl-sdk.soap:make-soap-envelope :version :1.1 :body body))) + (is (io.github.cl-sdk.soap:soap-envelope-p env)) + (is (eq :1.1 (io.github.cl-sdk.soap:soap-envelope-version env))) + (is (null (io.github.cl-sdk.soap:soap-envelope-header env))) + (is (io.github.cl-sdk.soap:soap-body-p (io.github.cl-sdk.soap:soap-envelope-body env))))) (test soap-header-struct "soap-header struct stores entries correctly." - (let ((hdr (cl-soap:make-soap-header :entries '()))) - (is (cl-soap:soap-header-p hdr)) - (is (null (cl-soap:soap-header-entries hdr))))) + (let ((hdr (io.github.cl-sdk.soap:make-soap-header :entries '()))) + (is (io.github.cl-sdk.soap:soap-header-p hdr)) + (is (null (io.github.cl-sdk.soap:soap-header-entries hdr))))) (test soap-body-struct "soap-body struct stores payload correctly." - (let ((body (cl-soap:make-soap-body :payload '()))) - (is (cl-soap:soap-body-p body)) - (is (null (cl-soap:soap-body-fault body))) - (is (null (cl-soap:soap-body-payload body))))) + (let ((body (io.github.cl-sdk.soap:make-soap-body :payload '()))) + (is (io.github.cl-sdk.soap:soap-body-p body)) + (is (null (io.github.cl-sdk.soap:soap-body-fault body))) + (is (null (io.github.cl-sdk.soap:soap-body-payload body))))) (test soap-fault-struct "soap-fault struct stores all fields correctly." - (let ((f (cl-soap:make-soap-fault + (let ((f (io.github.cl-sdk.soap:make-soap-fault :code "soap:Client" :string "Bad request" :actor "http://example.com/" :detail nil))) - (is (cl-soap:soap-fault-p f)) - (is (string= "soap:Client" (cl-soap:soap-fault-code f))) - (is (string= "Bad request" (cl-soap:soap-fault-string f))) - (is (string= "http://example.com/" (cl-soap:soap-fault-actor f))) - (is (null (cl-soap:soap-fault-detail f))))) + (is (io.github.cl-sdk.soap:soap-fault-p f)) + (is (string= "soap:Client" (io.github.cl-sdk.soap:soap-fault-code f))) + (is (string= "Bad request" (io.github.cl-sdk.soap:soap-fault-string f))) + (is (string= "http://example.com/" (io.github.cl-sdk.soap:soap-fault-actor f))) + (is (null (io.github.cl-sdk.soap:soap-fault-detail f))))) ;;; parse-soap — SOAP 1.1 @@ -65,23 +65,23 @@ (test parse-soap-1.1-basic "parse-soap returns a soap-envelope with version :1.1 for a SOAP 1.1 message." - (let ((env (cl-soap:parse-soap +soap-1.1-minimal+))) - (is (cl-soap:soap-envelope-p env)) - (is (eq :1.1 (cl-soap:soap-envelope-version env))) - (is (null (cl-soap:soap-envelope-header env))) - (is (cl-soap:soap-body-p (cl-soap:soap-envelope-body env))) - (is (null (cl-soap:soap-body-fault (cl-soap:soap-envelope-body env)))) - (is (= 1 (length (cl-soap:soap-body-payload - (cl-soap:soap-envelope-body env))))))) + (let ((env (io.github.cl-sdk.soap:parse-soap +soap-1.1-minimal+))) + (is (io.github.cl-sdk.soap:soap-envelope-p env)) + (is (eq :1.1 (io.github.cl-sdk.soap:soap-envelope-version env))) + (is (null (io.github.cl-sdk.soap:soap-envelope-header env))) + (is (io.github.cl-sdk.soap:soap-body-p (io.github.cl-sdk.soap:soap-envelope-body env))) + (is (null (io.github.cl-sdk.soap:soap-body-fault (io.github.cl-sdk.soap:soap-envelope-body env)))) + (is (= 1 (length (io.github.cl-sdk.soap:soap-body-payload + (io.github.cl-sdk.soap:soap-envelope-body env))))))) (test parse-soap-1.1-body-element-name "The body payload element is the GetPrice element." - (let* ((env (cl-soap:parse-soap +soap-1.1-minimal+)) - (body (cl-soap:soap-envelope-body env)) - (elem (first (cl-soap:soap-body-payload body))) - (tag (cl-xml:xml-node-tag elem))) - (is (cl-xml:xml-qname-p tag)) - (is (string= "GetPrice" (cl-xml:xml-qname-local-name tag))))) + (let* ((env (io.github.cl-sdk.soap:parse-soap +soap-1.1-minimal+)) + (body (io.github.cl-sdk.soap:soap-envelope-body env)) + (elem (first (io.github.cl-sdk.soap:soap-body-payload body))) + (tag (io.github.cl-sdk.xml:xml-node-tag elem))) + (is (io.github.cl-sdk.xml:xml-qname-p tag)) + (is (string= "GetPrice" (io.github.cl-sdk.xml:xml-qname-local-name tag))))) ;;; parse-soap — SOAP 1.2 @@ -95,12 +95,12 @@ (test parse-soap-1.2-basic "parse-soap returns a soap-envelope with version :1.2 for a SOAP 1.2 message." - (let ((env (cl-soap:parse-soap +soap-1.2-minimal+))) - (is (cl-soap:soap-envelope-p env)) - (is (eq :1.2 (cl-soap:soap-envelope-version env))) - (is (null (cl-soap:soap-envelope-header env))) - (is (= 1 (length (cl-soap:soap-body-payload - (cl-soap:soap-envelope-body env))))))) + (let ((env (io.github.cl-sdk.soap:parse-soap +soap-1.2-minimal+))) + (is (io.github.cl-sdk.soap:soap-envelope-p env)) + (is (eq :1.2 (io.github.cl-sdk.soap:soap-envelope-version env))) + (is (null (io.github.cl-sdk.soap:soap-envelope-header env))) + (is (= 1 (length (io.github.cl-sdk.soap:soap-body-payload + (io.github.cl-sdk.soap:soap-envelope-body env))))))) ;;; parse-soap — Header @@ -117,14 +117,14 @@ (test parse-soap-with-header "parse-soap populates soap-header with the header block elements." - (let* ((env (cl-soap:parse-soap +soap-1.1-with-header+)) - (hdr (cl-soap:soap-envelope-header env))) - (is (cl-soap:soap-header-p hdr)) - (is (= 1 (length (cl-soap:soap-header-entries hdr)))) - (let* ((entry (first (cl-soap:soap-header-entries hdr))) - (tag (cl-xml:xml-node-tag entry))) - (is (cl-xml:xml-qname-p tag)) - (is (string= "Auth" (cl-xml:xml-qname-local-name tag)))))) + (let* ((env (io.github.cl-sdk.soap:parse-soap +soap-1.1-with-header+)) + (hdr (io.github.cl-sdk.soap:soap-envelope-header env))) + (is (io.github.cl-sdk.soap:soap-header-p hdr)) + (is (= 1 (length (io.github.cl-sdk.soap:soap-header-entries hdr)))) + (let* ((entry (first (io.github.cl-sdk.soap:soap-header-entries hdr))) + (tag (io.github.cl-sdk.xml:xml-node-tag entry))) + (is (io.github.cl-sdk.xml:xml-qname-p tag)) + (is (string= "Auth" (io.github.cl-sdk.xml:xml-qname-local-name tag)))))) ;;; parse-soap — SOAP 1.1 Fault @@ -143,43 +143,43 @@ (test parse-soap-1.1-fault-detected "parse-soap sets soap-body-fault for a SOAP 1.1 Fault body." - (let* ((env (cl-soap:parse-soap +soap-1.1-fault+)) - (body (cl-soap:soap-envelope-body env)) - (fault (cl-soap:soap-body-fault body))) - (is (cl-soap:soap-fault-p fault)) - (is (null (cl-soap:soap-body-payload body))))) + (let* ((env (io.github.cl-sdk.soap:parse-soap +soap-1.1-fault+)) + (body (io.github.cl-sdk.soap:soap-envelope-body env)) + (fault (io.github.cl-sdk.soap:soap-body-fault body))) + (is (io.github.cl-sdk.soap:soap-fault-p fault)) + (is (null (io.github.cl-sdk.soap:soap-body-payload body))))) (test parse-soap-1.1-fault-code "SOAP 1.1 fault code is extracted from faultcode text." - (let* ((fault (cl-soap:soap-body-fault - (cl-soap:soap-envelope-body - (cl-soap:parse-soap +soap-1.1-fault+))))) - (is (string= "soap:Client" (cl-soap:soap-fault-code fault))))) + (let* ((fault (io.github.cl-sdk.soap:soap-body-fault + (io.github.cl-sdk.soap:soap-envelope-body + (io.github.cl-sdk.soap:parse-soap +soap-1.1-fault+))))) + (is (string= "soap:Client" (io.github.cl-sdk.soap:soap-fault-code fault))))) (test parse-soap-1.1-fault-string "SOAP 1.1 fault string is extracted from faultstring text." - (let* ((fault (cl-soap:soap-body-fault - (cl-soap:soap-envelope-body - (cl-soap:parse-soap +soap-1.1-fault+))))) - (is (string= "Invalid input" (cl-soap:soap-fault-string fault))))) + (let* ((fault (io.github.cl-sdk.soap:soap-body-fault + (io.github.cl-sdk.soap:soap-envelope-body + (io.github.cl-sdk.soap:parse-soap +soap-1.1-fault+))))) + (is (string= "Invalid input" (io.github.cl-sdk.soap:soap-fault-string fault))))) (test parse-soap-1.1-fault-actor "SOAP 1.1 fault actor is extracted from faultactor text." - (let* ((fault (cl-soap:soap-body-fault - (cl-soap:soap-envelope-body - (cl-soap:parse-soap +soap-1.1-fault+))))) - (is (string= "http://example.com/service" (cl-soap:soap-fault-actor fault))))) + (let* ((fault (io.github.cl-sdk.soap:soap-body-fault + (io.github.cl-sdk.soap:soap-envelope-body + (io.github.cl-sdk.soap:parse-soap +soap-1.1-fault+))))) + (is (string= "http://example.com/service" (io.github.cl-sdk.soap:soap-fault-actor fault))))) (test parse-soap-1.1-fault-detail-present "SOAP 1.1 fault detail is the detail xml-node." - (let* ((fault (cl-soap:soap-body-fault - (cl-soap:soap-envelope-body - (cl-soap:parse-soap +soap-1.1-fault+))))) - (is (cl-xml:xml-node-p (cl-soap:soap-fault-detail fault))) + (let* ((fault (io.github.cl-sdk.soap:soap-body-fault + (io.github.cl-sdk.soap:soap-envelope-body + (io.github.cl-sdk.soap:parse-soap +soap-1.1-fault+))))) + (is (io.github.cl-sdk.xml:xml-node-p (io.github.cl-sdk.soap:soap-fault-detail fault))) (is (string= "detail" - (let ((tag (cl-xml:xml-node-tag (cl-soap:soap-fault-detail fault)))) - (if (cl-xml:xml-qname-p tag) - (cl-xml:xml-qname-local-name tag) + (let ((tag (io.github.cl-sdk.xml:xml-node-tag (io.github.cl-sdk.soap:soap-fault-detail fault)))) + (if (io.github.cl-sdk.xml:xml-qname-p tag) + (io.github.cl-sdk.xml:xml-qname-local-name tag) tag)))))) ;;; parse-soap — SOAP 1.2 Fault @@ -199,211 +199,211 @@ (test parse-soap-1.2-fault-code "SOAP 1.2 fault code is extracted from Code/Value text." - (let* ((fault (cl-soap:soap-body-fault - (cl-soap:soap-envelope-body - (cl-soap:parse-soap +soap-1.2-fault+))))) - (is (cl-soap:soap-fault-p fault)) - (is (string= "env:Sender" (cl-soap:soap-fault-code fault))))) + (let* ((fault (io.github.cl-sdk.soap:soap-body-fault + (io.github.cl-sdk.soap:soap-envelope-body + (io.github.cl-sdk.soap:parse-soap +soap-1.2-fault+))))) + (is (io.github.cl-sdk.soap:soap-fault-p fault)) + (is (string= "env:Sender" (io.github.cl-sdk.soap:soap-fault-code fault))))) (test parse-soap-1.2-fault-string "SOAP 1.2 fault string is extracted from Reason/Text text." - (let* ((fault (cl-soap:soap-body-fault - (cl-soap:soap-envelope-body - (cl-soap:parse-soap +soap-1.2-fault+))))) - (is (string= "Bad request" (cl-soap:soap-fault-string fault))))) + (let* ((fault (io.github.cl-sdk.soap:soap-body-fault + (io.github.cl-sdk.soap:soap-envelope-body + (io.github.cl-sdk.soap:parse-soap +soap-1.2-fault+))))) + (is (string= "Bad request" (io.github.cl-sdk.soap:soap-fault-string fault))))) (test parse-soap-1.2-fault-actor "SOAP 1.2 Role is mapped to soap-fault-actor." - (let* ((fault (cl-soap:soap-body-fault - (cl-soap:soap-envelope-body - (cl-soap:parse-soap +soap-1.2-fault+))))) - (is (string= "http://example.com/node" (cl-soap:soap-fault-actor fault))))) + (let* ((fault (io.github.cl-sdk.soap:soap-body-fault + (io.github.cl-sdk.soap:soap-envelope-body + (io.github.cl-sdk.soap:parse-soap +soap-1.2-fault+))))) + (is (string= "http://example.com/node" (io.github.cl-sdk.soap:soap-fault-actor fault))))) (test parse-soap-1.2-fault-detail-present "SOAP 1.2 fault Detail is the Detail xml-node." - (let* ((fault (cl-soap:soap-body-fault - (cl-soap:soap-envelope-body - (cl-soap:parse-soap +soap-1.2-fault+))))) - (is (cl-xml:xml-node-p (cl-soap:soap-fault-detail fault))) + (let* ((fault (io.github.cl-sdk.soap:soap-body-fault + (io.github.cl-sdk.soap:soap-envelope-body + (io.github.cl-sdk.soap:parse-soap +soap-1.2-fault+))))) + (is (io.github.cl-sdk.xml:xml-node-p (io.github.cl-sdk.soap:soap-fault-detail fault))) (is (string= "Detail" - (let ((tag (cl-xml:xml-node-tag (cl-soap:soap-fault-detail fault)))) - (if (cl-xml:xml-qname-p tag) - (cl-xml:xml-qname-local-name tag) + (let ((tag (io.github.cl-sdk.xml:xml-node-tag (io.github.cl-sdk.soap:soap-fault-detail fault)))) + (if (io.github.cl-sdk.xml:xml-qname-p tag) + (io.github.cl-sdk.xml:xml-qname-local-name tag) tag)))))) (test parse-soap-1.2-fault-lang "SOAP 1.2 fault lang is extracted from Reason/Text xml:lang attribute." - (let* ((fault (cl-soap:soap-body-fault - (cl-soap:soap-envelope-body - (cl-soap:parse-soap +soap-1.2-fault+))))) - (is (string= "en" (cl-soap:soap-fault-lang fault))))) + (let* ((fault (io.github.cl-sdk.soap:soap-body-fault + (io.github.cl-sdk.soap:soap-envelope-body + (io.github.cl-sdk.soap:parse-soap +soap-1.2-fault+))))) + (is (string= "en" (io.github.cl-sdk.soap:soap-fault-lang fault))))) ;;; parse-soap — error cases (test parse-soap-not-envelope-error "parse-soap signals soap-error when root element is not Envelope." - (signals cl-soap:soap-error - (cl-soap:parse-soap + (signals io.github.cl-sdk.soap:soap-error + (io.github.cl-sdk.soap:parse-soap ""))) (test parse-soap-unknown-namespace-error "parse-soap signals soap-error for an unknown SOAP namespace URI." - (signals cl-soap:soap-error - (cl-soap:parse-soap + (signals io.github.cl-sdk.soap:soap-error + (io.github.cl-sdk.soap:parse-soap ""))) (test parse-soap-no-body-error "parse-soap signals soap-error when the Envelope has no Body." - (signals cl-soap:soap-error - (cl-soap:parse-soap + (signals io.github.cl-sdk.soap:soap-error + (io.github.cl-sdk.soap:parse-soap ""))) ;;; serialize-soap (defun parse-soap-from-string (str) "Round-trip helper: parse STR as a SOAP envelope." - (cl-soap:parse-soap str)) + (io.github.cl-sdk.soap:parse-soap str)) (test serialize-soap-returns-string "serialize-soap returns a non-empty string by default." - (let* ((body (cl-soap:make-soap-body :payload '())) - (env (cl-soap:make-soap-envelope :version :1.1 :body body)) - (xml (cl-soap:serialize-soap env))) + (let* ((body (io.github.cl-sdk.soap:make-soap-body :payload '())) + (env (io.github.cl-sdk.soap:make-soap-envelope :version :1.1 :body body)) + (xml (io.github.cl-sdk.soap:serialize-soap env))) (is (stringp xml)) (is (plusp (length xml))))) (test serialize-soap-contains-envelope-tag "The serialized string contains soap:Envelope." - (let* ((body (cl-soap:make-soap-body :payload '())) - (env (cl-soap:make-soap-envelope :version :1.1 :body body)) - (xml (cl-soap:serialize-soap env))) + (let* ((body (io.github.cl-sdk.soap:make-soap-body :payload '())) + (env (io.github.cl-sdk.soap:make-soap-envelope :version :1.1 :body body)) + (xml (io.github.cl-sdk.soap:serialize-soap env))) (is (search "Envelope" xml)))) (test serialize-soap-1.1-namespace-present "Serialized SOAP 1.1 output contains the SOAP 1.1 namespace URI." - (let* ((body (cl-soap:make-soap-body :payload '())) - (env (cl-soap:make-soap-envelope :version :1.1 :body body)) - (xml (cl-soap:serialize-soap env))) + (let* ((body (io.github.cl-sdk.soap:make-soap-body :payload '())) + (env (io.github.cl-sdk.soap:make-soap-envelope :version :1.1 :body body)) + (xml (io.github.cl-sdk.soap:serialize-soap env))) (is (search "schemas.xmlsoap.org/soap/envelope/" xml)))) (test serialize-soap-1.2-namespace-present "Serialized SOAP 1.2 output contains the SOAP 1.2 namespace URI." - (let* ((body (cl-soap:make-soap-body :payload '())) - (env (cl-soap:make-soap-envelope :version :1.2 :body body)) - (xml (cl-soap:serialize-soap env))) + (let* ((body (io.github.cl-sdk.soap:make-soap-body :payload '())) + (env (io.github.cl-sdk.soap:make-soap-envelope :version :1.2 :body body)) + (xml (io.github.cl-sdk.soap:serialize-soap env))) (is (search "w3.org/2003/05/soap-envelope" xml)))) (test serialize-soap-to-stream "serialize-soap writes to a supplied stream and returns nil." - (let* ((body (cl-soap:make-soap-body :payload '())) - (env (cl-soap:make-soap-envelope :version :1.1 :body body)) + (let* ((body (io.github.cl-sdk.soap:make-soap-body :payload '())) + (env (io.github.cl-sdk.soap:make-soap-envelope :version :1.1 :body body)) result) (with-output-to-string (s) - (setf result (cl-soap:serialize-soap env :stream s))) + (setf result (io.github.cl-sdk.soap:serialize-soap env :stream s))) (is (null result)))) (test serialize-soap-roundtrip-1.1 "Serializing and re-parsing a SOAP 1.1 envelope preserves version and body." - (let* ((env (cl-soap:parse-soap +soap-1.1-minimal+)) - (xml (cl-soap:serialize-soap env)) - (env2 (cl-soap:parse-soap xml))) - (is (eq :1.1 (cl-soap:soap-envelope-version env2))) - (is (= 1 (length (cl-soap:soap-body-payload - (cl-soap:soap-envelope-body env2))))))) + (let* ((env (io.github.cl-sdk.soap:parse-soap +soap-1.1-minimal+)) + (xml (io.github.cl-sdk.soap:serialize-soap env)) + (env2 (io.github.cl-sdk.soap:parse-soap xml))) + (is (eq :1.1 (io.github.cl-sdk.soap:soap-envelope-version env2))) + (is (= 1 (length (io.github.cl-sdk.soap:soap-body-payload + (io.github.cl-sdk.soap:soap-envelope-body env2))))))) (test serialize-soap-roundtrip-1.2 "Serializing and re-parsing a SOAP 1.2 envelope preserves version." - (let* ((env (cl-soap:parse-soap +soap-1.2-minimal+)) - (xml (cl-soap:serialize-soap env)) - (env2 (cl-soap:parse-soap xml))) - (is (eq :1.2 (cl-soap:soap-envelope-version env2))))) + (let* ((env (io.github.cl-sdk.soap:parse-soap +soap-1.2-minimal+)) + (xml (io.github.cl-sdk.soap:serialize-soap env)) + (env2 (io.github.cl-sdk.soap:parse-soap xml))) + (is (eq :1.2 (io.github.cl-sdk.soap:soap-envelope-version env2))))) (test serialize-soap-roundtrip-header "Serializing and re-parsing preserves the header block count." - (let* ((env (cl-soap:parse-soap +soap-1.1-with-header+)) - (xml (cl-soap:serialize-soap env)) - (env2 (cl-soap:parse-soap xml)) - (hdr (cl-soap:soap-envelope-header env2))) - (is (cl-soap:soap-header-p hdr)) - (is (= 1 (length (cl-soap:soap-header-entries hdr)))))) + (let* ((env (io.github.cl-sdk.soap:parse-soap +soap-1.1-with-header+)) + (xml (io.github.cl-sdk.soap:serialize-soap env)) + (env2 (io.github.cl-sdk.soap:parse-soap xml)) + (hdr (io.github.cl-sdk.soap:soap-envelope-header env2))) + (is (io.github.cl-sdk.soap:soap-header-p hdr)) + (is (= 1 (length (io.github.cl-sdk.soap:soap-header-entries hdr)))))) (test serialize-soap-1.1-fault-roundtrip "Serializing and re-parsing a SOAP 1.1 fault preserves code and string." - (let* ((fault-in (cl-soap:make-soap-fault + (let* ((fault-in (io.github.cl-sdk.soap:make-soap-fault :code "soap:Server" :string "Internal error")) - (body (cl-soap:make-soap-body :fault fault-in)) - (env (cl-soap:make-soap-envelope :version :1.1 :body body)) - (xml (cl-soap:serialize-soap env)) - (env2 (cl-soap:parse-soap xml)) - (fault (cl-soap:soap-body-fault (cl-soap:soap-envelope-body env2)))) - (is (cl-soap:soap-fault-p fault)) - (is (string= "soap:Server" (cl-soap:soap-fault-code fault))) - (is (string= "Internal error" (cl-soap:soap-fault-string fault))))) + (body (io.github.cl-sdk.soap:make-soap-body :fault fault-in)) + (env (io.github.cl-sdk.soap:make-soap-envelope :version :1.1 :body body)) + (xml (io.github.cl-sdk.soap:serialize-soap env)) + (env2 (io.github.cl-sdk.soap:parse-soap xml)) + (fault (io.github.cl-sdk.soap:soap-body-fault (io.github.cl-sdk.soap:soap-envelope-body env2)))) + (is (io.github.cl-sdk.soap:soap-fault-p fault)) + (is (string= "soap:Server" (io.github.cl-sdk.soap:soap-fault-code fault))) + (is (string= "Internal error" (io.github.cl-sdk.soap:soap-fault-string fault))))) (test serialize-soap-1.2-fault-roundtrip "Serializing and re-parsing a SOAP 1.2 fault preserves code and string." - (let* ((fault-in (cl-soap:make-soap-fault + (let* ((fault-in (io.github.cl-sdk.soap:make-soap-fault :code "env:Receiver" :string "Processing failed")) - (body (cl-soap:make-soap-body :fault fault-in)) - (env (cl-soap:make-soap-envelope :version :1.2 :body body)) - (xml (cl-soap:serialize-soap env)) - (env2 (cl-soap:parse-soap xml)) - (fault (cl-soap:soap-body-fault (cl-soap:soap-envelope-body env2)))) - (is (cl-soap:soap-fault-p fault)) - (is (string= "env:Receiver" (cl-soap:soap-fault-code fault))) - (is (string= "Processing failed" (cl-soap:soap-fault-string fault))))) + (body (io.github.cl-sdk.soap:make-soap-body :fault fault-in)) + (env (io.github.cl-sdk.soap:make-soap-envelope :version :1.2 :body body)) + (xml (io.github.cl-sdk.soap:serialize-soap env)) + (env2 (io.github.cl-sdk.soap:parse-soap xml)) + (fault (io.github.cl-sdk.soap:soap-body-fault (io.github.cl-sdk.soap:soap-envelope-body env2)))) + (is (io.github.cl-sdk.soap:soap-fault-p fault)) + (is (string= "env:Receiver" (io.github.cl-sdk.soap:soap-fault-code fault))) + (is (string= "Processing failed" (io.github.cl-sdk.soap:soap-fault-string fault))))) ;;; soap-make-envelope (test soap-make-envelope-basic "soap-make-envelope wraps body XML in a SOAP 1.1 envelope." - (let* ((env (cl-soap:soap-make-envelope + (let* ((env (io.github.cl-sdk.soap:soap-make-envelope "1")) - (body (cl-soap:soap-envelope-body env))) - (is (cl-soap:soap-envelope-p env)) - (is (eq :1.1 (cl-soap:soap-envelope-version env))) - (is (null (cl-soap:soap-envelope-header env))) - (is (= 1 (length (cl-soap:soap-body-payload body)))) + (body (io.github.cl-sdk.soap:soap-envelope-body env))) + (is (io.github.cl-sdk.soap:soap-envelope-p env)) + (is (eq :1.1 (io.github.cl-sdk.soap:soap-envelope-version env))) + (is (null (io.github.cl-sdk.soap:soap-envelope-header env))) + (is (= 1 (length (io.github.cl-sdk.soap:soap-body-payload body)))) (is (string= "GetUser" - (cl-xml:xml-qname-local-name - (cl-xml:xml-node-tag - (first (cl-soap:soap-body-payload body)))))))) + (io.github.cl-sdk.xml:xml-qname-local-name + (io.github.cl-sdk.xml:xml-node-tag + (first (io.github.cl-sdk.soap:soap-body-payload body)))))))) (test soap-make-envelope-version-1.2 "soap-make-envelope respects the :version :1.2 keyword argument." - (let ((env (cl-soap:soap-make-envelope + (let ((env (io.github.cl-sdk.soap:soap-make-envelope "" :version :1.2))) - (is (eq :1.2 (cl-soap:soap-envelope-version env))))) + (is (eq :1.2 (io.github.cl-sdk.soap:soap-envelope-version env))))) (test soap-make-envelope-with-header "soap-make-envelope with :header-xml adds header entries." - (let* ((env (cl-soap:soap-make-envelope + (let* ((env (io.github.cl-sdk.soap:soap-make-envelope "" :header-xml "xyz")) - (hdr (cl-soap:soap-envelope-header env))) - (is (cl-soap:soap-header-p hdr)) - (is (= 1 (length (cl-soap:soap-header-entries hdr)))) - (let ((tag (cl-xml:xml-node-tag (first (cl-soap:soap-header-entries hdr))))) + (hdr (io.github.cl-sdk.soap:soap-envelope-header env))) + (is (io.github.cl-sdk.soap:soap-header-p hdr)) + (is (= 1 (length (io.github.cl-sdk.soap:soap-header-entries hdr)))) + (let ((tag (io.github.cl-sdk.xml:xml-node-tag (first (io.github.cl-sdk.soap:soap-header-entries hdr))))) (is (string= "auth" - (if (cl-xml:xml-qname-p tag) - (cl-xml:xml-qname-local-name tag) + (if (io.github.cl-sdk.xml:xml-qname-p tag) + (io.github.cl-sdk.xml:xml-qname-local-name tag) tag)))))) (test soap-make-envelope-serialize-roundtrip "An envelope built with soap-make-envelope survives a serialize/parse round-trip." - (let* ((env (cl-soap:soap-make-envelope + (let* ((env (io.github.cl-sdk.soap:soap-make-envelope "" :version :1.1)) - (xml (cl-soap:serialize-soap env)) - (env2 (cl-soap:parse-soap xml))) - (is (eq :1.1 (cl-soap:soap-envelope-version env2))) - (is (= 1 (length (cl-soap:soap-body-payload - (cl-soap:soap-envelope-body env2))))))) + (xml (io.github.cl-sdk.soap:serialize-soap env)) + (env2 (io.github.cl-sdk.soap:parse-soap xml))) + (is (eq :1.1 (io.github.cl-sdk.soap:soap-envelope-version env2))) + (is (= 1 (length (io.github.cl-sdk.soap:soap-body-payload + (io.github.cl-sdk.soap:soap-envelope-body env2))))))) (test soap-error-condition "soap-error condition reports message correctly." - (let ((err (make-condition 'cl-soap:soap-error :message "test error"))) - (is (string= "test error" (cl-soap:soap-error-message err))) - (is (null (cl-soap:soap-error-path err))) + (let ((err (make-condition 'io.github.cl-sdk.soap:soap-error :message "test error"))) + (is (string= "test error" (io.github.cl-sdk.soap:soap-error-message err))) + (is (null (io.github.cl-sdk.soap:soap-error-path err))) (is (search "test error" (format nil "~a" err))))) diff --git a/t/cl-wsdl-package.lisp b/t/cl-wsdl-package.lisp index df588d3..492d66f 100644 --- a/t/cl-wsdl-package.lisp +++ b/t/cl-wsdl-package.lisp @@ -1,3 +1,3 @@ -(defpackage #:cl-wsdl.test - (:use #:cl #:fiveam #:cl-wsdl) +(defpackage #:io.github.cl-sdk.wsdl.test + (:use #:cl #:fiveam #:io.github.cl-sdk.wsdl) (:export #:cl-wsdl-suite)) diff --git a/t/cl-wsdl-tests.lisp b/t/cl-wsdl-tests.lisp index cbb6863..e87dceb 100644 --- a/t/cl-wsdl-tests.lisp +++ b/t/cl-wsdl-tests.lisp @@ -1,4 +1,4 @@ -(in-package #:cl-wsdl.test) +(in-package #:io.github.cl-sdk.wsdl.test) (def-suite cl-wsdl-suite :description "Test suite for cl-wsdl.") @@ -35,92 +35,92 @@ (test wsdl-namespace-constant "The WSDL 2.0 namespace URI constant has the correct value." (is (string= "http://www.w3.org/ns/wsdl" - cl-wsdl:+wsdl-2.0-namespace+))) + io.github.cl-sdk.wsdl:+wsdl-2.0-namespace+))) (test parse-wsdl-returns-description "parse-wsdl returns a wsdl-description struct." - (let ((desc (cl-wsdl:parse-wsdl +simple-wsdl+))) - (is (cl-wsdl:wsdl-description-p desc)))) + (let ((desc (io.github.cl-sdk.wsdl:parse-wsdl +simple-wsdl+))) + (is (io.github.cl-sdk.wsdl:wsdl-description-p desc)))) (test parse-wsdl-target-namespace "parse-wsdl captures the targetNamespace attribute." - (let ((desc (cl-wsdl:parse-wsdl +simple-wsdl+))) + (let ((desc (io.github.cl-sdk.wsdl:parse-wsdl +simple-wsdl+))) (is (string= "http://example.com/hello" - (cl-wsdl:wsdl-description-target-namespace desc))))) + (io.github.cl-sdk.wsdl:wsdl-description-target-namespace desc))))) (test parse-wsdl-interface-count "parse-wsdl populates the interfaces list." - (let ((desc (cl-wsdl:parse-wsdl +simple-wsdl+))) - (is (= 1 (length (cl-wsdl:wsdl-description-interfaces desc)))))) + (let ((desc (io.github.cl-sdk.wsdl:parse-wsdl +simple-wsdl+))) + (is (= 1 (length (io.github.cl-sdk.wsdl:wsdl-description-interfaces desc)))))) (test parse-wsdl-interface-name "parse-wsdl captures the interface name." - (let* ((desc (cl-wsdl:parse-wsdl +simple-wsdl+)) - (iface (first (cl-wsdl:wsdl-description-interfaces desc)))) - (is (cl-wsdl:wsdl-interface-p iface)) - (is (string= "HelloInterface" (cl-wsdl:wsdl-interface-name iface))))) + (let* ((desc (io.github.cl-sdk.wsdl:parse-wsdl +simple-wsdl+)) + (iface (first (io.github.cl-sdk.wsdl:wsdl-description-interfaces desc)))) + (is (io.github.cl-sdk.wsdl:wsdl-interface-p iface)) + (is (string= "HelloInterface" (io.github.cl-sdk.wsdl:wsdl-interface-name iface))))) (test parse-wsdl-interface-operation "parse-wsdl parses wsdl:operation inside wsdl:interface." - (let* ((desc (cl-wsdl:parse-wsdl +simple-wsdl+)) - (iface (first (cl-wsdl:wsdl-description-interfaces desc))) - (op (first (cl-wsdl:wsdl-interface-operations iface)))) - (is (cl-wsdl:wsdl-interface-operation-p op)) - (is (string= "sayHello" (cl-wsdl:wsdl-interface-operation-name op))) + (let* ((desc (io.github.cl-sdk.wsdl:parse-wsdl +simple-wsdl+)) + (iface (first (io.github.cl-sdk.wsdl:wsdl-description-interfaces desc))) + (op (first (io.github.cl-sdk.wsdl:wsdl-interface-operations iface)))) + (is (io.github.cl-sdk.wsdl:wsdl-interface-operation-p op)) + (is (string= "sayHello" (io.github.cl-sdk.wsdl:wsdl-interface-operation-name op))) (is (string= "http://www.w3.org/ns/wsdl/in-out" - (cl-wsdl:wsdl-interface-operation-pattern op))))) + (io.github.cl-sdk.wsdl:wsdl-interface-operation-pattern op))))) (test parse-wsdl-operation-input-output "parse-wsdl records wsdl:input and wsdl:output as wsdl-message-ref structs." - (let* ((desc (cl-wsdl:parse-wsdl +simple-wsdl+)) - (op (first (cl-wsdl:wsdl-interface-operations - (first (cl-wsdl:wsdl-description-interfaces desc))))) - (in (first (cl-wsdl:wsdl-interface-operation-inputs op))) - (out (first (cl-wsdl:wsdl-interface-operation-outputs op)))) - (is (cl-wsdl:wsdl-message-ref-p in)) - (is (string= "tns:SayHelloRequest" (cl-wsdl:wsdl-message-ref-element in))) - (is (cl-wsdl:wsdl-message-ref-p out)) - (is (string= "tns:SayHelloResponse" (cl-wsdl:wsdl-message-ref-element out))))) + (let* ((desc (io.github.cl-sdk.wsdl:parse-wsdl +simple-wsdl+)) + (op (first (io.github.cl-sdk.wsdl:wsdl-interface-operations + (first (io.github.cl-sdk.wsdl:wsdl-description-interfaces desc))))) + (in (first (io.github.cl-sdk.wsdl:wsdl-interface-operation-inputs op))) + (out (first (io.github.cl-sdk.wsdl:wsdl-interface-operation-outputs op)))) + (is (io.github.cl-sdk.wsdl:wsdl-message-ref-p in)) + (is (string= "tns:SayHelloRequest" (io.github.cl-sdk.wsdl:wsdl-message-ref-element in))) + (is (io.github.cl-sdk.wsdl:wsdl-message-ref-p out)) + (is (string= "tns:SayHelloResponse" (io.github.cl-sdk.wsdl:wsdl-message-ref-element out))))) (test parse-wsdl-binding "parse-wsdl parses wsdl:binding with name, interface, and type." - (let* ((desc (cl-wsdl:parse-wsdl +simple-wsdl+)) - (binding (first (cl-wsdl:wsdl-description-bindings desc)))) - (is (cl-wsdl:wsdl-binding-p binding)) - (is (string= "HelloBinding" (cl-wsdl:wsdl-binding-name binding))) - (is (string= "tns:HelloInterface" (cl-wsdl:wsdl-binding-interface binding))) + (let* ((desc (io.github.cl-sdk.wsdl:parse-wsdl +simple-wsdl+)) + (binding (first (io.github.cl-sdk.wsdl:wsdl-description-bindings desc)))) + (is (io.github.cl-sdk.wsdl:wsdl-binding-p binding)) + (is (string= "HelloBinding" (io.github.cl-sdk.wsdl:wsdl-binding-name binding))) + (is (string= "tns:HelloInterface" (io.github.cl-sdk.wsdl:wsdl-binding-interface binding))) (is (string= "http://www.w3.org/ns/wsdl/soap" - (cl-wsdl:wsdl-binding-type binding))))) + (io.github.cl-sdk.wsdl:wsdl-binding-type binding))))) (test parse-wsdl-binding-operation "parse-wsdl parses wsdl:operation inside wsdl:binding." - (let* ((desc (cl-wsdl:parse-wsdl +simple-wsdl+)) - (binding (first (cl-wsdl:wsdl-description-bindings desc))) - (bop (first (cl-wsdl:wsdl-binding-operations binding)))) - (is (cl-wsdl:wsdl-binding-operation-p bop)) - (is (string= "tns:sayHello" (cl-wsdl:wsdl-binding-operation-ref bop))))) + (let* ((desc (io.github.cl-sdk.wsdl:parse-wsdl +simple-wsdl+)) + (binding (first (io.github.cl-sdk.wsdl:wsdl-description-bindings desc))) + (bop (first (io.github.cl-sdk.wsdl:wsdl-binding-operations binding)))) + (is (io.github.cl-sdk.wsdl:wsdl-binding-operation-p bop)) + (is (string= "tns:sayHello" (io.github.cl-sdk.wsdl:wsdl-binding-operation-ref bop))))) (test parse-wsdl-service "parse-wsdl parses wsdl:service." - (let* ((desc (cl-wsdl:parse-wsdl +simple-wsdl+)) - (service (first (cl-wsdl:wsdl-description-services desc)))) - (is (cl-wsdl:wsdl-service-p service)) - (is (string= "HelloService" (cl-wsdl:wsdl-service-name service))) - (is (string= "tns:HelloInterface" (cl-wsdl:wsdl-service-interface service))))) + (let* ((desc (io.github.cl-sdk.wsdl:parse-wsdl +simple-wsdl+)) + (service (first (io.github.cl-sdk.wsdl:wsdl-description-services desc)))) + (is (io.github.cl-sdk.wsdl:wsdl-service-p service)) + (is (string= "HelloService" (io.github.cl-sdk.wsdl:wsdl-service-name service))) + (is (string= "tns:HelloInterface" (io.github.cl-sdk.wsdl:wsdl-service-interface service))))) (test parse-wsdl-endpoint "parse-wsdl parses wsdl:endpoint inside wsdl:service." - (let* ((desc (cl-wsdl:parse-wsdl +simple-wsdl+)) - (service (first (cl-wsdl:wsdl-description-services desc))) - (ep (first (cl-wsdl:wsdl-service-endpoints service)))) - (is (cl-wsdl:wsdl-endpoint-p ep)) - (is (string= "HelloEndpoint" (cl-wsdl:wsdl-endpoint-name ep))) - (is (string= "tns:HelloBinding" (cl-wsdl:wsdl-endpoint-binding ep))) - (is (string= "http://example.com/hello" (cl-wsdl:wsdl-endpoint-address ep))))) + (let* ((desc (io.github.cl-sdk.wsdl:parse-wsdl +simple-wsdl+)) + (service (first (io.github.cl-sdk.wsdl:wsdl-description-services desc))) + (ep (first (io.github.cl-sdk.wsdl:wsdl-service-endpoints service)))) + (is (io.github.cl-sdk.wsdl:wsdl-endpoint-p ep)) + (is (string= "HelloEndpoint" (io.github.cl-sdk.wsdl:wsdl-endpoint-name ep))) + (is (string= "tns:HelloBinding" (io.github.cl-sdk.wsdl:wsdl-endpoint-binding ep))) + (is (string= "http://example.com/hello" (io.github.cl-sdk.wsdl:wsdl-endpoint-address ep))))) (test parse-wsdl-interface-fault "parse-wsdl parses wsdl:fault inside wsdl:interface." - (let* ((desc (cl-wsdl:parse-wsdl + (let* ((desc (io.github.cl-sdk.wsdl:parse-wsdl " @@ -128,15 +128,15 @@ ")) - (iface (first (cl-wsdl:wsdl-description-interfaces desc))) - (fault (first (cl-wsdl:wsdl-interface-faults iface)))) - (is (cl-wsdl:wsdl-interface-fault-p fault)) - (is (string= "NotFound" (cl-wsdl:wsdl-interface-fault-name fault))) - (is (string= "tns:NotFoundFault" (cl-wsdl:wsdl-interface-fault-element fault))))) + (iface (first (io.github.cl-sdk.wsdl:wsdl-description-interfaces desc))) + (fault (first (io.github.cl-sdk.wsdl:wsdl-interface-faults iface)))) + (is (io.github.cl-sdk.wsdl:wsdl-interface-fault-p fault)) + (is (string= "NotFound" (io.github.cl-sdk.wsdl:wsdl-interface-fault-name fault))) + (is (string= "tns:NotFoundFault" (io.github.cl-sdk.wsdl:wsdl-interface-fault-element fault))))) (test parse-wsdl-infault-outfault "parse-wsdl parses wsdl:infault and wsdl:outfault inside wsdl:operation." - (let* ((desc (cl-wsdl:parse-wsdl + (let* ((desc (io.github.cl-sdk.wsdl:parse-wsdl " @@ -150,56 +150,56 @@ ")) - (op (first (cl-wsdl:wsdl-interface-operations - (first (cl-wsdl:wsdl-description-interfaces desc)))))) - (let ((inf (first (cl-wsdl:wsdl-interface-operation-in-faults op))) - (outf (first (cl-wsdl:wsdl-interface-operation-out-faults op)))) - (is (cl-wsdl:wsdl-fault-ref-p inf)) - (is (string= "tns:InputFault" (cl-wsdl:wsdl-fault-ref-ref inf))) - (is (cl-wsdl:wsdl-fault-ref-p outf)) - (is (string= "tns:OutputFault" (cl-wsdl:wsdl-fault-ref-ref outf)))))) + (op (first (io.github.cl-sdk.wsdl:wsdl-interface-operations + (first (io.github.cl-sdk.wsdl:wsdl-description-interfaces desc)))))) + (let ((inf (first (io.github.cl-sdk.wsdl:wsdl-interface-operation-in-faults op))) + (outf (first (io.github.cl-sdk.wsdl:wsdl-interface-operation-out-faults op)))) + (is (io.github.cl-sdk.wsdl:wsdl-fault-ref-p inf)) + (is (string= "tns:InputFault" (io.github.cl-sdk.wsdl:wsdl-fault-ref-ref inf))) + (is (io.github.cl-sdk.wsdl:wsdl-fault-ref-p outf)) + (is (string= "tns:OutputFault" (io.github.cl-sdk.wsdl:wsdl-fault-ref-ref outf)))))) (test parse-wsdl-interface-extends "parse-wsdl captures the extends attribute as a list of names." - (let* ((desc (cl-wsdl:parse-wsdl + (let* ((desc (io.github.cl-sdk.wsdl:parse-wsdl " ")) - (iface (first (cl-wsdl:wsdl-description-interfaces desc)))) + (iface (first (io.github.cl-sdk.wsdl:wsdl-description-interfaces desc)))) (is (equal '("tns:Base1" "tns:Base2") - (cl-wsdl:wsdl-interface-extends iface))))) + (io.github.cl-sdk.wsdl:wsdl-interface-extends iface))))) (test parse-wsdl-import "parse-wsdl captures wsdl:import elements." - (let* ((desc (cl-wsdl:parse-wsdl + (let* ((desc (io.github.cl-sdk.wsdl:parse-wsdl " ")) - (imp (first (cl-wsdl:wsdl-description-imports desc)))) - (is (cl-wsdl:wsdl-import-p imp)) - (is (string= "http://other.example.com/" (cl-wsdl:wsdl-import-namespace imp))) - (is (string= "other.wsdl" (cl-wsdl:wsdl-import-location imp))))) + (imp (first (io.github.cl-sdk.wsdl:wsdl-description-imports desc)))) + (is (io.github.cl-sdk.wsdl:wsdl-import-p imp)) + (is (string= "http://other.example.com/" (io.github.cl-sdk.wsdl:wsdl-import-namespace imp))) + (is (string= "other.wsdl" (io.github.cl-sdk.wsdl:wsdl-import-location imp))))) (test parse-wsdl-include "parse-wsdl captures wsdl:include elements." - (let* ((desc (cl-wsdl:parse-wsdl + (let* ((desc (io.github.cl-sdk.wsdl:parse-wsdl " ")) - (inc (first (cl-wsdl:wsdl-description-includes desc)))) - (is (cl-wsdl:wsdl-include-p inc)) - (is (string= "common.wsdl" (cl-wsdl:wsdl-include-location inc))))) + (inc (first (io.github.cl-sdk.wsdl:wsdl-description-includes desc)))) + (is (io.github.cl-sdk.wsdl:wsdl-include-p inc)) + (is (string= "common.wsdl" (io.github.cl-sdk.wsdl:wsdl-include-location inc))))) (test parse-wsdl-types-preserved "parse-wsdl stores type children as xml-nodes." - (let* ((desc (cl-wsdl:parse-wsdl + (let* ((desc (io.github.cl-sdk.wsdl:parse-wsdl " "))) - (is (= 1 (length (cl-wsdl:wsdl-description-types desc)))) - (is (cl-xml:xml-node-p (first (cl-wsdl:wsdl-description-types desc)))))) + (is (= 1 (length (io.github.cl-sdk.wsdl:wsdl-description-types desc)))) + (is (io.github.cl-sdk.xml:xml-node-p (first (io.github.cl-sdk.wsdl:wsdl-description-types desc)))))) (test parse-wsdl-binding-fault "parse-wsdl parses wsdl:fault inside wsdl:binding." - (let* ((desc (cl-wsdl:parse-wsdl + (let* ((desc (io.github.cl-sdk.wsdl:parse-wsdl " @@ -224,153 +224,153 @@ ")) - (bf (first (cl-wsdl:wsdl-binding-faults - (first (cl-wsdl:wsdl-description-bindings desc)))))) - (is (cl-wsdl:wsdl-binding-fault-p bf)) - (is (string= "tns:NotFound" (cl-wsdl:wsdl-binding-fault-ref bf))) - (is (string= "soap:Sender" (cl-wsdl:wsdl-binding-fault-code bf))))) + (bf (first (io.github.cl-sdk.wsdl:wsdl-binding-faults + (first (io.github.cl-sdk.wsdl:wsdl-description-bindings desc)))))) + (is (io.github.cl-sdk.wsdl:wsdl-binding-fault-p bf)) + (is (string= "tns:NotFound" (io.github.cl-sdk.wsdl:wsdl-binding-fault-ref bf))) + (is (string= "soap:Sender" (io.github.cl-sdk.wsdl:wsdl-binding-fault-code bf))))) (test parse-wsdl-wrong-root-signals-error "parse-wsdl signals wsdl-error when the root element is not wsdl:description." - (signals cl-wsdl:wsdl-error - (cl-wsdl:parse-wsdl + (signals io.github.cl-sdk.wsdl:wsdl-error + (io.github.cl-sdk.wsdl:parse-wsdl " "))) (test parse-wsdl-wrong-namespace-signals-error "parse-wsdl signals wsdl-error when the namespace URI is not WSDL 2.0." - (signals cl-wsdl:wsdl-error - (cl-wsdl:parse-wsdl + (signals io.github.cl-sdk.wsdl:wsdl-error + (io.github.cl-sdk.wsdl:parse-wsdl " "))) (test serialize-wsdl-returns-string "serialize-wsdl with no :stream argument returns a string." - (let* ((desc (cl-wsdl:parse-wsdl +simple-wsdl+)) - (out (cl-wsdl:serialize-wsdl desc))) + (let* ((desc (io.github.cl-sdk.wsdl:parse-wsdl +simple-wsdl+)) + (out (io.github.cl-sdk.wsdl:serialize-wsdl desc))) (is (stringp out)))) (test serialize-wsdl-contains-declaration "serialize-wsdl output starts with an XML declaration." - (let* ((desc (cl-wsdl:parse-wsdl +simple-wsdl+)) - (out (cl-wsdl:serialize-wsdl desc))) + (let* ((desc (io.github.cl-sdk.wsdl:parse-wsdl +simple-wsdl+)) + (out (io.github.cl-sdk.wsdl:serialize-wsdl desc))) (is (search " "))) - (is (cl-wsdl:wsdl-description-p desc)) - (is (null (cl-wsdl:wsdl-description-target-namespace desc))))) + (is (io.github.cl-sdk.wsdl:wsdl-description-p desc)) + (is (null (io.github.cl-sdk.wsdl:wsdl-description-target-namespace desc))))) (test parse-wsdl-multiple-interfaces "parse-wsdl collects all wsdl:interface children in order." - (let* ((desc (cl-wsdl:parse-wsdl + (let* ((desc (io.github.cl-sdk.wsdl:parse-wsdl " @@ -378,8 +378,8 @@ ")) - (ifaces (cl-wsdl:wsdl-description-interfaces desc))) + (ifaces (io.github.cl-sdk.wsdl:wsdl-description-interfaces desc))) (is (= 3 (length ifaces))) - (is (string= "Alpha" (cl-wsdl:wsdl-interface-name (first ifaces)))) - (is (string= "Beta" (cl-wsdl:wsdl-interface-name (second ifaces)))) - (is (string= "Gamma" (cl-wsdl:wsdl-interface-name (third ifaces)))))) + (is (string= "Alpha" (io.github.cl-sdk.wsdl:wsdl-interface-name (first ifaces)))) + (is (string= "Beta" (io.github.cl-sdk.wsdl:wsdl-interface-name (second ifaces)))) + (is (string= "Gamma" (io.github.cl-sdk.wsdl:wsdl-interface-name (third ifaces)))))) diff --git a/t/cl-xml-tests.lisp b/t/cl-xml-tests.lisp index bc83227..ae2f885 100644 --- a/t/cl-xml-tests.lisp +++ b/t/cl-xml-tests.lisp @@ -1,4 +1,4 @@ -(in-package #:cl-xml.test) +(in-package #:io.github.cl-sdk.xml.test) (def-suite cl-xml-suite :description "Test suite for cl-xml.") @@ -9,47 +9,47 @@ (defun parse-root (str) "Parse STR and return the root xml-node." - (cl-xml:xml-document-root (cl-xml:parse-xml str))) + (io.github.cl-sdk.xml:xml-document-root (io.github.cl-sdk.xml:parse-xml str))) ;;; ── Original regression tests ──────────────────────────────────────────── (test self-closing-node "A self-closing element is parsed into an xml-node with no children." (let ((node (parse-root ""))) - (is (string= "tag" (cl-xml:xml-node-tag node))) - (is (null (cl-xml:xml-node-attributes node))) - (is (null (cl-xml:xml-node-children node))))) + (is (string= "tag" (io.github.cl-sdk.xml:xml-node-tag node))) + (is (null (io.github.cl-sdk.xml:xml-node-attributes node))) + (is (null (io.github.cl-sdk.xml:xml-node-children node))))) (test self-closing-node-with-attribute "A self-closing element with one attribute." (let ((node (parse-root ""))) - (is (string= "img" (cl-xml:xml-node-tag node))) - (is (equal '(("src" . "logo.png")) (cl-xml:xml-node-attributes node))) - (is (null (cl-xml:xml-node-children node))))) + (is (string= "img" (io.github.cl-sdk.xml:xml-node-tag node))) + (is (equal '(("src" . "logo.png")) (io.github.cl-sdk.xml:xml-node-attributes node))) + (is (null (io.github.cl-sdk.xml:xml-node-children node))))) (test empty-element "An element with an explicit closing tag but no children." (let ((node (parse-root "
"))) - (is (string= "div" (cl-xml:xml-node-tag node))) - (is (null (cl-xml:xml-node-attributes node))) - (is (null (cl-xml:xml-node-children node))))) + (is (string= "div" (io.github.cl-sdk.xml:xml-node-tag node))) + (is (null (io.github.cl-sdk.xml:xml-node-attributes node))) + (is (null (io.github.cl-sdk.xml:xml-node-children node))))) (test element-with-attribute "An element with one attribute and an explicit closing tag." (let ((node (parse-root ""))) - (is (string= "a" (cl-xml:xml-node-tag node))) + (is (string= "a" (io.github.cl-sdk.xml:xml-node-tag node))) (is (equal '(("href" . "https://example.com")) - (cl-xml:xml-node-attributes node))) - (is (null (cl-xml:xml-node-children node))))) + (io.github.cl-sdk.xml:xml-node-attributes node))) + (is (null (io.github.cl-sdk.xml:xml-node-children node))))) (test element-with-children "An element whose children are parsed recursively." (let ((root (parse-root ""))) - (is (string= "root" (cl-xml:xml-node-tag root))) - (is (= 1 (length (cl-xml:xml-node-children root)))) - (let ((child (first (cl-xml:xml-node-children root)))) - (is (string= "child" (cl-xml:xml-node-tag child))) - (is (null (cl-xml:xml-node-children child)))))) + (is (string= "root" (io.github.cl-sdk.xml:xml-node-tag root))) + (is (= 1 (length (io.github.cl-sdk.xml:xml-node-children root)))) + (let ((child (first (io.github.cl-sdk.xml:xml-node-children root)))) + (is (string= "child" (io.github.cl-sdk.xml:xml-node-tag child))) + (is (null (io.github.cl-sdk.xml:xml-node-children child)))))) (test problem-statement-example "Parse the full example from the problem statement." @@ -60,126 +60,126 @@
") (root (parse-root xml))) - (is (string= "root" (cl-xml:xml-node-tag root))) - (is (null (cl-xml:xml-node-attributes root))) - (is (= 2 (length (cl-xml:xml-node-children root)))) - (let ((self-closing (first (cl-xml:xml-node-children root))) - (with-children (second (cl-xml:xml-node-children root)))) + (is (string= "root" (io.github.cl-sdk.xml:xml-node-tag root))) + (is (null (io.github.cl-sdk.xml:xml-node-attributes root))) + (is (= 2 (length (io.github.cl-sdk.xml:xml-node-children root)))) + (let ((self-closing (first (io.github.cl-sdk.xml:xml-node-children root))) + (with-children (second (io.github.cl-sdk.xml:xml-node-children root)))) ;; self-closing child - (is (string= "node-without-children" (cl-xml:xml-node-tag self-closing))) + (is (string= "node-without-children" (io.github.cl-sdk.xml:xml-node-tag self-closing))) (is (equal '(("attribute-name" . "attribute-value")) - (cl-xml:xml-node-attributes self-closing))) - (is (null (cl-xml:xml-node-children self-closing))) + (io.github.cl-sdk.xml:xml-node-attributes self-closing))) + (is (null (io.github.cl-sdk.xml:xml-node-children self-closing))) ;; child with explicit closing tag - (is (string= "node-with-children" (cl-xml:xml-node-tag with-children))) + (is (string= "node-with-children" (io.github.cl-sdk.xml:xml-node-tag with-children))) (is (equal '(("attribute-name" . "attribute-value")) - (cl-xml:xml-node-attributes with-children))) - (is (null (cl-xml:xml-node-children with-children)))))) + (io.github.cl-sdk.xml:xml-node-attributes with-children))) + (is (null (io.github.cl-sdk.xml:xml-node-children with-children)))))) (test multiple-attributes "An element with multiple attributes preserves order." (let ((node (parse-root ""))) (is (equal '(("a" . "1") ("b" . "2") ("c" . "3")) - (cl-xml:xml-node-attributes node))))) + (io.github.cl-sdk.xml:xml-node-attributes node))))) (test deeply-nested "Deeply nested elements are parsed correctly." (let* ((root (parse-root "")) - (b (first (cl-xml:xml-node-children root))) - (c (first (cl-xml:xml-node-children b)))) - (is (string= "a" (cl-xml:xml-node-tag root))) - (is (string= "b" (cl-xml:xml-node-tag b))) - (is (string= "c" (cl-xml:xml-node-tag c))) - (is (null (cl-xml:xml-node-children c))))) + (b (first (io.github.cl-sdk.xml:xml-node-children root))) + (c (first (io.github.cl-sdk.xml:xml-node-children b)))) + (is (string= "a" (io.github.cl-sdk.xml:xml-node-tag root))) + (is (string= "b" (io.github.cl-sdk.xml:xml-node-tag b))) + (is (string= "c" (io.github.cl-sdk.xml:xml-node-tag c))) + (is (null (io.github.cl-sdk.xml:xml-node-children c))))) ;;; ── xml-document structure ─────────────────────────────────────────────── (test parse-xml-returns-document "parse-xml returns an xml-document with prolog and root fields." - (let ((doc (cl-xml:parse-xml ""))) - (is (cl-xml:xml-document-p doc)) - (is (null (cl-xml:xml-document-prolog doc))) - (is (cl-xml:xml-node-p (cl-xml:xml-document-root doc))) - (is (string= "root" (cl-xml:xml-node-tag (cl-xml:xml-document-root doc)))))) + (let ((doc (io.github.cl-sdk.xml:parse-xml ""))) + (is (io.github.cl-sdk.xml:xml-document-p doc)) + (is (null (io.github.cl-sdk.xml:xml-document-prolog doc))) + (is (io.github.cl-sdk.xml:xml-node-p (io.github.cl-sdk.xml:xml-document-root doc))) + (is (string= "root" (io.github.cl-sdk.xml:xml-node-tag (io.github.cl-sdk.xml:xml-document-root doc)))))) ;;; ── XML 1.0 conformance — Names (§2.3) ────────────────────────────────── (test valid-name-with-underscore-and-hyphen "Names may contain underscores, hyphens, and dots after the first char." (let ((node (parse-root "<_my-tag.1 />"))) - (is (string= "_my-tag.1" (cl-xml:xml-node-tag node))))) + (is (string= "_my-tag.1" (io.github.cl-sdk.xml:xml-node-tag node))))) (test valid-name-with-colon "Colons are valid XML name characters." (let ((node (parse-root ""))) - (is (string= "ns:tag" (cl-xml:xml-node-tag node))))) + (is (string= "ns:tag" (io.github.cl-sdk.xml:xml-node-tag node))))) (test invalid-name-start-digit "A name starting with a digit is a well-formedness error." - (signals error (cl-xml:parse-xml "<1tag />"))) + (signals error (io.github.cl-sdk.xml:parse-xml "<1tag />"))) (test invalid-name-start-hyphen "A name starting with a hyphen is a well-formedness error." - (signals error (cl-xml:parse-xml "<-tag />"))) + (signals error (io.github.cl-sdk.xml:parse-xml "<-tag />"))) ;;; ── XML 1.0 conformance — Attributes (§3.1, §3.3.3) ───────────────────── (test duplicate-attribute-error "Duplicate attribute names on the same element are a well-formedness error." - (signals error (cl-xml:parse-xml ""))) + (signals error (io.github.cl-sdk.xml:parse-xml ""))) (test lt-in-attribute-value-error "A literal '<' inside an attribute value is a well-formedness error." - (signals error (cl-xml:parse-xml ""))) + (signals error (io.github.cl-sdk.xml:parse-xml ""))) ;;; ── XML 1.0 conformance — Entity references (§4.6) ────────────────────── (test entity-ref-amp-in-attribute "& in an attribute value expands to '&'." (let ((node (parse-root ""))) - (is (string= "a&b" (cdr (assoc "v" (cl-xml:xml-node-attributes node) + (is (string= "a&b" (cdr (assoc "v" (io.github.cl-sdk.xml:xml-node-attributes node) :test #'string=)))))) (test entity-ref-lt-in-attribute "< in an attribute value expands to '<'." (let ((node (parse-root ""))) - (is (string= "a'." (let ((node (parse-root ""))) - (is (string= "a>b" (cdr (assoc "v" (cl-xml:xml-node-attributes node) + (is (string= "a>b" (cdr (assoc "v" (io.github.cl-sdk.xml:xml-node-attributes node) :test #'string=)))))) (test entity-ref-quot-in-attribute "" in a single-quoted attribute value expands to '\"'." (let ((node (parse-root ""))) - (is (string= "a\"b" (cdr (assoc "v" (cl-xml:xml-node-attributes node) + (is (string= "a\"b" (cdr (assoc "v" (io.github.cl-sdk.xml:xml-node-attributes node) :test #'string=)))))) (test entity-ref-apos-in-attribute "' in a double-quoted attribute value expands to \"'\"." (let ((node (parse-root ""))) - (is (string= "a'b" (cdr (assoc "v" (cl-xml:xml-node-attributes node) + (is (string= "a'b" (cdr (assoc "v" (io.github.cl-sdk.xml:xml-node-attributes node) :test #'string=)))))) (test unknown-entity-ref-error "An unknown named entity reference signals an error." - (signals error (cl-xml:parse-xml ""))) + (signals error (io.github.cl-sdk.xml:parse-xml ""))) ;;; ── XML 1.0 conformance — Character references (§4.1) ─────────────────── (test char-ref-decimal "A decimal character reference A expands to 'A'." (let ((node (parse-root ""))) - (is (string= "A" (cdr (assoc "v" (cl-xml:xml-node-attributes node) + (is (string= "A" (cdr (assoc "v" (io.github.cl-sdk.xml:xml-node-attributes node) :test #'string=)))))) (test char-ref-hex "A hexadecimal character reference A expands to 'A'." (let ((node (parse-root ""))) - (is (string= "A" (cdr (assoc "v" (cl-xml:xml-node-attributes node) + (is (string= "A" (cdr (assoc "v" (io.github.cl-sdk.xml:xml-node-attributes node) :test #'string=)))))) ;;; ── XML 1.0 conformance — Character data (§2.4) ───────────────────────── @@ -187,7 +187,7 @@ (test text-content-preserved "Non-whitespace text content is preserved as a string child." (let* ((root (parse-root "

hello

")) - (children (cl-xml:xml-node-children root))) + (children (io.github.cl-sdk.xml:xml-node-children root))) (is (= 1 (length children))) (is (stringp (first children))) (is (string= "hello" (first children))))) @@ -195,7 +195,7 @@ (test text-with-entity-ref "Entity references in text content are expanded." (let* ((root (parse-root "

a&b

")) - (children (cl-xml:xml-node-children root))) + (children (io.github.cl-sdk.xml:xml-node-children root))) (is (string= "a&b" (first children))))) (test whitespace-only-text-discarded @@ -204,154 +204,154 @@
"))) - (is (= 2 (length (cl-xml:xml-node-children root)))) - (is (every #'cl-xml:xml-node-p (cl-xml:xml-node-children root))))) + (is (= 2 (length (io.github.cl-sdk.xml:xml-node-children root)))) + (is (every #'io.github.cl-sdk.xml:xml-node-p (io.github.cl-sdk.xml:xml-node-children root))))) ;;; ── XML 1.0 conformance — CDATA sections (§2.7) ───────────────────────── (test cdata-section-preserved-as-node "A CDATA section is preserved as an xml-cdata child node." (let* ((root (parse-root "&c]]>")) - (children (cl-xml:xml-node-children root))) + (children (io.github.cl-sdk.xml:xml-node-children root))) (is (= 1 (length children))) - (is (cl-xml:xml-cdata-p (first children))) - (is (string= "a&c" (cl-xml:xml-cdata-data (first children)))))) + (is (io.github.cl-sdk.xml:xml-cdata-p (first children))) + (is (string= "a&c" (io.github.cl-sdk.xml:xml-cdata-data (first children)))))) (test cdata-whitespace-only-preserved "A CDATA section containing only whitespace is still preserved as a node." (let* ((root (parse-root "")) - (children (cl-xml:xml-node-children root))) + (children (io.github.cl-sdk.xml:xml-node-children root))) (is (= 1 (length children))) - (is (cl-xml:xml-cdata-p (first children))) - (is (string= " " (cl-xml:xml-cdata-data (first children)))))) + (is (io.github.cl-sdk.xml:xml-cdata-p (first children))) + (is (string= " " (io.github.cl-sdk.xml:xml-cdata-data (first children)))))) ;;; ── XML 1.0 conformance — Comments (§2.5) ─────────────────────────────── (test comment-preserved-as-node "Comments inside an element are preserved as xml-comment child nodes." (let* ((root (parse-root "")) - (children (cl-xml:xml-node-children root))) + (children (io.github.cl-sdk.xml:xml-node-children root))) (is (= 2 (length children))) - (is (cl-xml:xml-comment-p (first children))) - (is (string= " hello " (cl-xml:xml-comment-data (first children)))) - (is (cl-xml:xml-node-p (second children))) - (is (string= "child" (cl-xml:xml-node-tag (second children)))))) + (is (io.github.cl-sdk.xml:xml-comment-p (first children))) + (is (string= " hello " (io.github.cl-sdk.xml:xml-comment-data (first children)))) + (is (io.github.cl-sdk.xml:xml-node-p (second children))) + (is (string= "child" (io.github.cl-sdk.xml:xml-node-tag (second children)))))) (test multiple-comments-in-element "Multiple comments between elements are each preserved as xml-comment nodes." (let* ((root (parse-root "")) - (children (cl-xml:xml-node-children root))) + (children (io.github.cl-sdk.xml:xml-node-children root))) (is (= 3 (length children))) - (is (cl-xml:xml-comment-p (first children))) - (is (string= " a " (cl-xml:xml-comment-data (first children)))) - (is (cl-xml:xml-comment-p (second children))) - (is (string= " b " (cl-xml:xml-comment-data (second children)))) - (is (cl-xml:xml-node-p (third children))))) + (is (io.github.cl-sdk.xml:xml-comment-p (first children))) + (is (string= " a " (io.github.cl-sdk.xml:xml-comment-data (first children)))) + (is (io.github.cl-sdk.xml:xml-comment-p (second children))) + (is (string= " b " (io.github.cl-sdk.xml:xml-comment-data (second children)))) + (is (io.github.cl-sdk.xml:xml-node-p (third children))))) (test illegal-double-dash-in-comment "The sequence '--' inside a comment (not as part of '-->') is an error." - (signals error (cl-xml:parse-xml ""))) + (signals error (io.github.cl-sdk.xml:parse-xml ""))) ;;; ── XML 1.0 conformance — Processing instructions (§2.6) ──────────────── (test pi-preserved-as-node "Processing instructions inside an element are preserved as xml-pi nodes." (let* ((root (parse-root "")) - (children (cl-xml:xml-node-children root))) + (children (io.github.cl-sdk.xml:xml-node-children root))) (is (= 2 (length children))) - (is (cl-xml:xml-pi-p (first children))) - (is (string= "app" (cl-xml:xml-pi-target (first children)))) - (is (string= "data" (cl-xml:xml-pi-data (first children)))) - (is (cl-xml:xml-node-p (second children))))) + (is (io.github.cl-sdk.xml:xml-pi-p (first children))) + (is (string= "app" (io.github.cl-sdk.xml:xml-pi-target (first children)))) + (is (string= "data" (io.github.cl-sdk.xml:xml-pi-data (first children)))) + (is (io.github.cl-sdk.xml:xml-node-p (second children))))) (test pi-no-data "A processing instruction with no data has an empty data string." (let* ((root (parse-root "")) - (pinstruction (first (cl-xml:xml-node-children root)))) - (is (cl-xml:xml-pi-p pinstruction)) - (is (string= "foo" (cl-xml:xml-pi-target pinstruction))) - (is (string= "" (cl-xml:xml-pi-data pinstruction))))) + (pinstruction (first (io.github.cl-sdk.xml:xml-node-children root)))) + (is (io.github.cl-sdk.xml:xml-pi-p pinstruction)) + (is (string= "foo" (io.github.cl-sdk.xml:xml-pi-target pinstruction))) + (is (string= "" (io.github.cl-sdk.xml:xml-pi-data pinstruction))))) ;;; ── XML 1.0 conformance — Prolog (§2.8) ───────────────────────────────── (test xml-declaration-in-prolog "An XML declaration is preserved as an xml-pi node in the document prolog." - (let ((doc (cl-xml:parse-xml ""))) - (is (= 1 (length (cl-xml:xml-document-prolog doc)))) - (let ((decl (first (cl-xml:xml-document-prolog doc)))) - (is (cl-xml:xml-pi-p decl)) - (is (string= "xml" (cl-xml:xml-pi-target decl)))) - (is (string= "root" (cl-xml:xml-node-tag (cl-xml:xml-document-root doc)))))) + (let ((doc (io.github.cl-sdk.xml:parse-xml ""))) + (is (= 1 (length (io.github.cl-sdk.xml:xml-document-prolog doc)))) + (let ((decl (first (io.github.cl-sdk.xml:xml-document-prolog doc)))) + (is (io.github.cl-sdk.xml:xml-pi-p decl)) + (is (string= "xml" (io.github.cl-sdk.xml:xml-pi-target decl)))) + (is (string= "root" (io.github.cl-sdk.xml:xml-node-tag (io.github.cl-sdk.xml:xml-document-root doc)))))) (test doctype-skipped "A DOCTYPE declaration in the prolog is silently skipped." - (let ((doc (cl-xml:parse-xml ""))) - (is (null (cl-xml:xml-document-prolog doc))) - (is (string= "root" (cl-xml:xml-node-tag (cl-xml:xml-document-root doc)))))) + (let ((doc (io.github.cl-sdk.xml:parse-xml ""))) + (is (null (io.github.cl-sdk.xml:xml-document-prolog doc))) + (is (string= "root" (io.github.cl-sdk.xml:xml-node-tag (io.github.cl-sdk.xml:xml-document-root doc)))))) (test doctype-with-internal-subset-skipped "A DOCTYPE with an internal subset is silently skipped." - (let ((doc (cl-xml:parse-xml "]>"))) - (is (null (cl-xml:xml-document-prolog doc))) - (is (string= "root" (cl-xml:xml-node-tag (cl-xml:xml-document-root doc)))))) + (let ((doc (io.github.cl-sdk.xml:parse-xml "]>"))) + (is (null (io.github.cl-sdk.xml:xml-document-prolog doc))) + (is (string= "root" (io.github.cl-sdk.xml:xml-node-tag (io.github.cl-sdk.xml:xml-document-root doc)))))) (test prolog-comment-preserved "A comment in the document prolog is preserved as an xml-comment node." - (let ((doc (cl-xml:parse-xml ""))) - (is (= 1 (length (cl-xml:xml-document-prolog doc)))) - (is (cl-xml:xml-comment-p (first (cl-xml:xml-document-prolog doc)))) + (let ((doc (io.github.cl-sdk.xml:parse-xml ""))) + (is (= 1 (length (io.github.cl-sdk.xml:xml-document-prolog doc)))) + (is (io.github.cl-sdk.xml:xml-comment-p (first (io.github.cl-sdk.xml:xml-document-prolog doc)))) (is (string= " intro " - (cl-xml:xml-comment-data - (first (cl-xml:xml-document-prolog doc))))) - (is (string= "root" (cl-xml:xml-node-tag (cl-xml:xml-document-root doc)))))) + (io.github.cl-sdk.xml:xml-comment-data + (first (io.github.cl-sdk.xml:xml-document-prolog doc))))) + (is (string= "root" (io.github.cl-sdk.xml:xml-node-tag (io.github.cl-sdk.xml:xml-document-root doc)))))) (test prolog-pi-preserved "A processing instruction in the document prolog is preserved as xml-pi." - (let ((doc (cl-xml:parse-xml ""))) - (is (= 1 (length (cl-xml:xml-document-prolog doc)))) - (is (cl-xml:xml-pi-p (first (cl-xml:xml-document-prolog doc)))) + (let ((doc (io.github.cl-sdk.xml:parse-xml ""))) + (is (= 1 (length (io.github.cl-sdk.xml:xml-document-prolog doc)))) + (is (io.github.cl-sdk.xml:xml-pi-p (first (io.github.cl-sdk.xml:xml-document-prolog doc)))) (is (string= "stylesheet" - (cl-xml:xml-pi-target (first (cl-xml:xml-document-prolog doc))))) - (is (string= "root" (cl-xml:xml-node-tag (cl-xml:xml-document-root doc)))))) + (io.github.cl-sdk.xml:xml-pi-target (first (io.github.cl-sdk.xml:xml-document-prolog doc))))) + (is (string= "root" (io.github.cl-sdk.xml:xml-node-tag (io.github.cl-sdk.xml:xml-document-root doc)))))) ;;; ── SAX handler — collecting helper ───────────────────────────────────── -(defclass collecting-handler (cl-xml:sax-handler) +(defclass collecting-handler (io.github.cl-sdk.xml:sax-handler) ((events :initform '() :accessor handler-events)) (:documentation "SAX handler that accumulates all events into a list.")) -(defmethod cl-xml:start-element ((h collecting-handler) tag attributes) +(defmethod io.github.cl-sdk.xml:start-element ((h collecting-handler) tag attributes) (push (list :start-element tag attributes) (handler-events h))) -(defmethod cl-xml:end-element ((h collecting-handler) tag) +(defmethod io.github.cl-sdk.xml:end-element ((h collecting-handler) tag) (push (list :end-element tag) (handler-events h))) -(defmethod cl-xml:characters ((h collecting-handler) text) +(defmethod io.github.cl-sdk.xml:characters ((h collecting-handler) text) (push (list :characters text) (handler-events h))) -(defmethod cl-xml:comment ((h collecting-handler) data) +(defmethod io.github.cl-sdk.xml:comment ((h collecting-handler) data) (push (list :comment data) (handler-events h))) -(defmethod cl-xml:processing-instruction ((h collecting-handler) target data) +(defmethod io.github.cl-sdk.xml:processing-instruction ((h collecting-handler) target data) (push (list :pi target data) (handler-events h))) -(defmethod cl-xml:cdata-section ((h collecting-handler) data) +(defmethod io.github.cl-sdk.xml:cdata-section ((h collecting-handler) data) (push (list :cdata data) (handler-events h))) -(defmethod cl-xml:end-document ((h collecting-handler)) +(defmethod io.github.cl-sdk.xml:end-document ((h collecting-handler)) (nreverse (handler-events h))) (defun sax-events (str) "Parse STR with a COLLECTING-HANDLER and return the event list." - (cl-xml:parse-xml str :handler (make-instance 'collecting-handler))) + (io.github.cl-sdk.xml:parse-xml str :handler (make-instance 'collecting-handler))) ;;; ── SAX handler tests ───────────────────────────────────────────────────── (test sax-default-returns-document "parse-xml without :handler returns an xml-document (backward compat)." - (let ((doc (cl-xml:parse-xml ""))) - (is (cl-xml:xml-document-p doc)) - (is (string= "root" (cl-xml:xml-node-tag (cl-xml:xml-document-root doc)))))) + (let ((doc (io.github.cl-sdk.xml:parse-xml ""))) + (is (io.github.cl-sdk.xml:xml-document-p doc)) + (is (string= "root" (io.github.cl-sdk.xml:xml-node-tag (io.github.cl-sdk.xml:xml-document-root doc)))))) (test sax-self-closing-events "A self-closing element fires start-element then end-element." @@ -436,7 +436,7 @@ (test sax-end-document-return-value "The return value of END-DOCUMENT becomes the return value of PARSE-XML." - (let ((result (cl-xml:parse-xml "" :handler (make-instance 'collecting-handler)))) + (let ((result (io.github.cl-sdk.xml:parse-xml "" :handler (make-instance 'collecting-handler)))) (is (listp result)) (is (equal '(:start-element "x" nil) (first result))) (is (equal '(:end-element "x") (second result))))) @@ -446,8 +446,8 @@ (let ((root (parse-root "
"))) - (is (= 1 (length (cl-xml:xml-node-children root)))) - (is (cl-xml:xml-node-p (first (cl-xml:xml-node-children root)))))) + (is (= 1 (length (io.github.cl-sdk.xml:xml-node-children root)))) + (is (io.github.cl-sdk.xml:xml-node-p (first (io.github.cl-sdk.xml:xml-node-children root)))))) (test full-prolog "A document with XML decl, DOCTYPE, and a prolog comment is parsed correctly." @@ -456,24 +456,24 @@ "" "" "")) - (doc (cl-xml:parse-xml xml))) + (doc (io.github.cl-sdk.xml:parse-xml xml))) ;; XML decl (as xml-pi) + prolog comment = 2 items; DOCTYPE is skipped - (is (= 2 (length (cl-xml:xml-document-prolog doc)))) - (is (cl-xml:xml-pi-p (first (cl-xml:xml-document-prolog doc)))) - (is (cl-xml:xml-comment-p (second (cl-xml:xml-document-prolog doc)))) - (let ((root (cl-xml:xml-document-root doc))) - (is (string= "root" (cl-xml:xml-node-tag root))) - (is (= 1 (length (cl-xml:xml-node-children root))))))) + (is (= 2 (length (io.github.cl-sdk.xml:xml-document-prolog doc)))) + (is (io.github.cl-sdk.xml:xml-pi-p (first (io.github.cl-sdk.xml:xml-document-prolog doc)))) + (is (io.github.cl-sdk.xml:xml-comment-p (second (io.github.cl-sdk.xml:xml-document-prolog doc)))) + (let ((root (io.github.cl-sdk.xml:xml-document-root doc))) + (is (string= "root" (io.github.cl-sdk.xml:xml-node-tag root))) + (is (= 1 (length (io.github.cl-sdk.xml:xml-node-children root))))))) ;;; ── Stream input ────────────────────────────────────────────────────────── (test parse-xml-accepts-stream "parse-xml accepts a character stream in addition to a string." (let* ((stream (make-string-input-stream "text")) - (root (cl-xml:xml-document-root (cl-xml:parse-xml stream)))) - (is (string= "tag" (cl-xml:xml-node-tag root))) - (is (equal '(("attr" . "val")) (cl-xml:xml-node-attributes root))) - (is (string= "text" (first (cl-xml:xml-node-children root)))))) + (root (io.github.cl-sdk.xml:xml-document-root (io.github.cl-sdk.xml:parse-xml stream)))) + (is (string= "tag" (io.github.cl-sdk.xml:xml-node-tag root))) + (is (equal '(("attr" . "val")) (io.github.cl-sdk.xml:xml-node-attributes root))) + (is (string= "text" (first (io.github.cl-sdk.xml:xml-node-children root)))))) ;;; ── trivial-gray-streams input ──────────────────────────────────────────── @@ -497,168 +497,168 @@ "parse-xml accepts a trivial-gray-streams fundamental-character-input-stream." (let* ((inner (make-string-input-stream "hello")) (stream (make-instance 'test-gray-stream :inner inner)) - (root (cl-xml:xml-document-root (cl-xml:parse-xml stream)))) - (is (string= "el" (cl-xml:xml-node-tag root))) - (is (equal '(("key" . "v")) (cl-xml:xml-node-attributes root))) - (is (string= "hello" (first (cl-xml:xml-node-children root)))))) + (root (io.github.cl-sdk.xml:xml-document-root (io.github.cl-sdk.xml:parse-xml stream)))) + (is (string= "el" (io.github.cl-sdk.xml:xml-node-tag root))) + (is (equal '(("key" . "v")) (io.github.cl-sdk.xml:xml-node-attributes root))) + (is (string= "hello" (first (io.github.cl-sdk.xml:xml-node-children root)))))) ;;; ── Namespace resolution (resolve-namespaces) ──────────────────────────── (defun resolve-root-tag (str) "Parse STR, resolve namespaces, and return the tag (xml-qname) of the root xml-node." - (cl-xml:xml-node-tag - (cl-xml:xml-document-root - (cl-xml:resolve-namespaces (cl-xml:parse-xml str))))) + (io.github.cl-sdk.xml:xml-node-tag + (io.github.cl-sdk.xml:xml-document-root + (io.github.cl-sdk.xml:resolve-namespaces (io.github.cl-sdk.xml:parse-xml str))))) (test ns-qname-struct "xml-qname struct has prefix, local-name, and namespace-uri fields." - (let ((q (cl-xml:make-xml-qname :prefix "ns" :local-name "tag" + (let ((q (io.github.cl-sdk.xml:make-xml-qname :prefix "ns" :local-name "tag" :namespace-uri "http://example.com/"))) - (is (cl-xml:xml-qname-p q)) - (is (string= "ns" (cl-xml:xml-qname-prefix q))) - (is (string= "tag" (cl-xml:xml-qname-local-name q))) - (is (string= "http://example.com/" (cl-xml:xml-qname-namespace-uri q))))) + (is (io.github.cl-sdk.xml:xml-qname-p q)) + (is (string= "ns" (io.github.cl-sdk.xml:xml-qname-prefix q))) + (is (string= "tag" (io.github.cl-sdk.xml:xml-qname-local-name q))) + (is (string= "http://example.com/" (io.github.cl-sdk.xml:xml-qname-namespace-uri q))))) (test ns-resolve-prefixed-element "A prefixed element tag is resolved to an xml-qname with the correct URI." (let ((tag (resolve-root-tag ""))) - (is (cl-xml:xml-qname-p tag)) - (is (string= "ns" (cl-xml:xml-qname-prefix tag))) - (is (string= "root" (cl-xml:xml-qname-local-name tag))) - (is (string= "http://example.com/" (cl-xml:xml-qname-namespace-uri tag))))) + (is (io.github.cl-sdk.xml:xml-qname-p tag)) + (is (string= "ns" (io.github.cl-sdk.xml:xml-qname-prefix tag))) + (is (string= "root" (io.github.cl-sdk.xml:xml-qname-local-name tag))) + (is (string= "http://example.com/" (io.github.cl-sdk.xml:xml-qname-namespace-uri tag))))) (test ns-resolve-default-namespace "An unprefixed element in a default namespace gets the declared namespace URI." (let ((tag (resolve-root-tag ""))) - (is (cl-xml:xml-qname-p tag)) - (is (null (cl-xml:xml-qname-prefix tag))) - (is (string= "root" (cl-xml:xml-qname-local-name tag))) - (is (string= "http://example.com/" (cl-xml:xml-qname-namespace-uri tag))))) + (is (io.github.cl-sdk.xml:xml-qname-p tag)) + (is (null (io.github.cl-sdk.xml:xml-qname-prefix tag))) + (is (string= "root" (io.github.cl-sdk.xml:xml-qname-local-name tag))) + (is (string= "http://example.com/" (io.github.cl-sdk.xml:xml-qname-namespace-uri tag))))) (test ns-resolve-no-namespace "An unprefixed element with no default namespace has nil namespace-uri." (let ((tag (resolve-root-tag ""))) - (is (cl-xml:xml-qname-p tag)) - (is (null (cl-xml:xml-qname-prefix tag))) - (is (string= "root" (cl-xml:xml-qname-local-name tag))) - (is (null (cl-xml:xml-qname-namespace-uri tag))))) + (is (io.github.cl-sdk.xml:xml-qname-p tag)) + (is (null (io.github.cl-sdk.xml:xml-qname-prefix tag))) + (is (string= "root" (io.github.cl-sdk.xml:xml-qname-local-name tag))) + (is (null (io.github.cl-sdk.xml:xml-qname-namespace-uri tag))))) (test ns-resolve-xmlns-attrs-removed "xmlns and xmlns:prefix attributes are absent after resolve-namespaces." - (let* ((doc (cl-xml:parse-xml + (let* ((doc (io.github.cl-sdk.xml:parse-xml "")) - (resolved (cl-xml:resolve-namespaces doc)) - (attrs (cl-xml:xml-node-attributes - (cl-xml:xml-document-root resolved)))) + (resolved (io.github.cl-sdk.xml:resolve-namespaces doc)) + (attrs (io.github.cl-sdk.xml:xml-node-attributes + (io.github.cl-sdk.xml:xml-document-root resolved)))) (is (null attrs)))) (test ns-resolve-prefixed-attribute "A prefixed attribute key is resolved to an xml-qname with the correct URI." - (let* ((doc (cl-xml:parse-xml + (let* ((doc (io.github.cl-sdk.xml:parse-xml "")) - (resolved (cl-xml:resolve-namespaces doc)) - (attrs (cl-xml:xml-node-attributes - (cl-xml:xml-document-root resolved)))) + (resolved (io.github.cl-sdk.xml:resolve-namespaces doc)) + (attrs (io.github.cl-sdk.xml:xml-node-attributes + (io.github.cl-sdk.xml:xml-document-root resolved)))) (is (= 1 (length attrs))) (let ((key (caar attrs))) - (is (cl-xml:xml-qname-p key)) - (is (string= "ns" (cl-xml:xml-qname-prefix key))) - (is (string= "attr" (cl-xml:xml-qname-local-name key))) - (is (string= "http://example.com/" (cl-xml:xml-qname-namespace-uri key)))) + (is (io.github.cl-sdk.xml:xml-qname-p key)) + (is (string= "ns" (io.github.cl-sdk.xml:xml-qname-prefix key))) + (is (string= "attr" (io.github.cl-sdk.xml:xml-qname-local-name key))) + (is (string= "http://example.com/" (io.github.cl-sdk.xml:xml-qname-namespace-uri key)))) (is (string= "val" (cdar attrs))))) (test ns-resolve-unprefixed-attribute-has-no-ns "An unprefixed attribute has nil namespace-uri even when a default ns is active." - (let* ((doc (cl-xml:parse-xml + (let* ((doc (io.github.cl-sdk.xml:parse-xml "")) - (resolved (cl-xml:resolve-namespaces doc)) - (attrs (cl-xml:xml-node-attributes - (cl-xml:xml-document-root resolved)))) + (resolved (io.github.cl-sdk.xml:resolve-namespaces doc)) + (attrs (io.github.cl-sdk.xml:xml-node-attributes + (io.github.cl-sdk.xml:xml-document-root resolved)))) (is (= 1 (length attrs))) (let ((key (caar attrs))) - (is (cl-xml:xml-qname-p key)) - (is (null (cl-xml:xml-qname-prefix key))) - (is (string= "attr" (cl-xml:xml-qname-local-name key))) - (is (null (cl-xml:xml-qname-namespace-uri key)))))) + (is (io.github.cl-sdk.xml:xml-qname-p key)) + (is (null (io.github.cl-sdk.xml:xml-qname-prefix key))) + (is (string= "attr" (io.github.cl-sdk.xml:xml-qname-local-name key))) + (is (null (io.github.cl-sdk.xml:xml-qname-namespace-uri key)))))) (test ns-resolve-inherited-binding "Namespace bindings declared on a parent are visible in child elements." - (let* ((doc (cl-xml:parse-xml + (let* ((doc (io.github.cl-sdk.xml:parse-xml "")) - (resolved (cl-xml:resolve-namespaces doc)) - (child (first (cl-xml:xml-node-children - (cl-xml:xml-document-root resolved)))) - (ctag (cl-xml:xml-node-tag child))) - (is (cl-xml:xml-qname-p ctag)) - (is (string= "ns" (cl-xml:xml-qname-prefix ctag))) - (is (string= "child" (cl-xml:xml-qname-local-name ctag))) - (is (string= "http://example.com/" (cl-xml:xml-qname-namespace-uri ctag))))) + (resolved (io.github.cl-sdk.xml:resolve-namespaces doc)) + (child (first (io.github.cl-sdk.xml:xml-node-children + (io.github.cl-sdk.xml:xml-document-root resolved)))) + (ctag (io.github.cl-sdk.xml:xml-node-tag child))) + (is (io.github.cl-sdk.xml:xml-qname-p ctag)) + (is (string= "ns" (io.github.cl-sdk.xml:xml-qname-prefix ctag))) + (is (string= "child" (io.github.cl-sdk.xml:xml-qname-local-name ctag))) + (is (string= "http://example.com/" (io.github.cl-sdk.xml:xml-qname-namespace-uri ctag))))) (test ns-resolve-xml-prefix-predeclared "The 'xml' prefix is pre-declared and resolves without an explicit xmlns:xml." - (let* ((doc (cl-xml:parse-xml "")) - (resolved (cl-xml:resolve-namespaces doc)) - (attrs (cl-xml:xml-node-attributes - (cl-xml:xml-document-root resolved)))) + (let* ((doc (io.github.cl-sdk.xml:parse-xml "")) + (resolved (io.github.cl-sdk.xml:resolve-namespaces doc)) + (attrs (io.github.cl-sdk.xml:xml-node-attributes + (io.github.cl-sdk.xml:xml-document-root resolved)))) (is (= 1 (length attrs))) (let ((key (caar attrs))) - (is (string= "xml" (cl-xml:xml-qname-prefix key))) - (is (string= "lang" (cl-xml:xml-qname-local-name key))) + (is (string= "xml" (io.github.cl-sdk.xml:xml-qname-prefix key))) + (is (string= "lang" (io.github.cl-sdk.xml:xml-qname-local-name key))) (is (string= "http://www.w3.org/XML/1998/namespace" - (cl-xml:xml-qname-namespace-uri key)))))) + (io.github.cl-sdk.xml:xml-qname-namespace-uri key)))))) (test ns-resolve-undeclared-prefix-error "Using an undeclared namespace prefix signals an error." (signals error - (cl-xml:resolve-namespaces (cl-xml:parse-xml "")))) + (io.github.cl-sdk.xml:resolve-namespaces (io.github.cl-sdk.xml:parse-xml "")))) (test ns-resolve-default-ns-reset "An xmlns='' declaration on a child resets the default namespace to nil." - (let* ((doc (cl-xml:parse-xml + (let* ((doc (io.github.cl-sdk.xml:parse-xml "")) - (resolved (cl-xml:resolve-namespaces doc)) - (child (first (cl-xml:xml-node-children - (cl-xml:xml-document-root resolved)))) - (ctag (cl-xml:xml-node-tag child))) - (is (null (cl-xml:xml-qname-namespace-uri ctag))))) + (resolved (io.github.cl-sdk.xml:resolve-namespaces doc)) + (child (first (io.github.cl-sdk.xml:xml-node-children + (io.github.cl-sdk.xml:xml-document-root resolved)))) + (ctag (io.github.cl-sdk.xml:xml-node-tag child))) + (is (null (io.github.cl-sdk.xml:xml-qname-namespace-uri ctag))))) (test ns-resolve-returns-xml-document "resolve-namespaces returns an xml-document." - (let ((resolved (cl-xml:resolve-namespaces (cl-xml:parse-xml "")))) - (is (cl-xml:xml-document-p resolved)))) + (let ((resolved (io.github.cl-sdk.xml:resolve-namespaces (io.github.cl-sdk.xml:parse-xml "")))) + (is (io.github.cl-sdk.xml:xml-document-p resolved)))) (test ns-resolve-preserves-prolog "resolve-namespaces preserves the document prolog unchanged." - (let* ((doc (cl-xml:parse-xml "")) - (resolved (cl-xml:resolve-namespaces doc))) - (is (equal (cl-xml:xml-document-prolog doc) - (cl-xml:xml-document-prolog resolved))))) + (let* ((doc (io.github.cl-sdk.xml:parse-xml "")) + (resolved (io.github.cl-sdk.xml:resolve-namespaces doc))) + (is (equal (io.github.cl-sdk.xml:xml-document-prolog doc) + (io.github.cl-sdk.xml:xml-document-prolog resolved))))) (test ns-resolve-multiple-prefixes "Multiple namespace prefixes on the same element are all resolved correctly." - (let* ((doc (cl-xml:parse-xml + (let* ((doc (io.github.cl-sdk.xml:parse-xml (concatenate 'string ""))) - (resolved (cl-xml:resolve-namespaces doc)) - (attrs (cl-xml:xml-node-attributes - (cl-xml:xml-document-root resolved)))) + (resolved (io.github.cl-sdk.xml:resolve-namespaces doc)) + (attrs (io.github.cl-sdk.xml:xml-node-attributes + (io.github.cl-sdk.xml:xml-document-root resolved)))) (is (= 2 (length attrs))) - (let ((a-attr (find "x" attrs :key (lambda (e) (cl-xml:xml-qname-local-name (car e))) + (let ((a-attr (find "x" attrs :key (lambda (e) (io.github.cl-sdk.xml:xml-qname-local-name (car e))) :test #'string=)) - (b-attr (find "y" attrs :key (lambda (e) (cl-xml:xml-qname-local-name (car e))) + (b-attr (find "y" attrs :key (lambda (e) (io.github.cl-sdk.xml:xml-qname-local-name (car e))) :test #'string=))) - (is (string= "http://a.com/" (cl-xml:xml-qname-namespace-uri (car a-attr)))) - (is (string= "http://b.com/" (cl-xml:xml-qname-namespace-uri (car b-attr))))))) + (is (string= "http://a.com/" (io.github.cl-sdk.xml:xml-qname-namespace-uri (car a-attr)))) + (is (string= "http://b.com/" (io.github.cl-sdk.xml:xml-qname-namespace-uri (car b-attr))))))) (test ns-resolve-preserves-text-children "Text and CDATA children are passed through unchanged by resolve-namespaces." - (let* ((doc (cl-xml:parse-xml + (let* ((doc (io.github.cl-sdk.xml:parse-xml "hello")) - (resolved (cl-xml:resolve-namespaces doc)) - (children (cl-xml:xml-node-children - (cl-xml:xml-document-root resolved)))) + (resolved (io.github.cl-sdk.xml:resolve-namespaces doc)) + (children (io.github.cl-sdk.xml:xml-node-children + (io.github.cl-sdk.xml:xml-document-root resolved)))) (is (= 1 (length children))) (is (string= "hello" (first children))))) @@ -668,73 +668,73 @@ (defun parse-doctype-elements (str) "Parse STR and return the list of xml-dtd-element structs from the DOCTYPE." - (cl-xml:xml-doctype-elements - (cl-xml:xml-document-doctype (cl-xml:parse-xml str)))) + (io.github.cl-sdk.xml:xml-doctype-elements + (io.github.cl-sdk.xml:xml-document-doctype (io.github.cl-sdk.xml:parse-xml str)))) ;;; xml-dtd-element struct (test dtd-element-struct "xml-dtd-element struct has name and content-model fields." - (let ((e (cl-xml:make-xml-dtd-element :name "root" :content-model :empty))) - (is (cl-xml:xml-dtd-element-p e)) - (is (string= "root" (cl-xml:xml-dtd-element-name e))) - (is (eq :empty (cl-xml:xml-dtd-element-content-model e))))) + (let ((e (io.github.cl-sdk.xml:make-xml-dtd-element :name "root" :content-model :empty))) + (is (io.github.cl-sdk.xml:xml-dtd-element-p e)) + (is (string= "root" (io.github.cl-sdk.xml:xml-dtd-element-name e))) + (is (eq :empty (io.github.cl-sdk.xml:xml-dtd-element-content-model e))))) ;;; xml-doctype struct (test dtd-doctype-struct "xml-doctype struct has name, public-id, system-id, and elements fields." - (let ((d (cl-xml:make-xml-doctype :name "root" :public-id nil + (let ((d (io.github.cl-sdk.xml:make-xml-doctype :name "root" :public-id nil :system-id "root.dtd" :elements '()))) - (is (cl-xml:xml-doctype-p d)) - (is (string= "root" (cl-xml:xml-doctype-name d))) - (is (null (cl-xml:xml-doctype-public-id d))) - (is (string= "root.dtd" (cl-xml:xml-doctype-system-id d))) - (is (null (cl-xml:xml-doctype-elements d))))) + (is (io.github.cl-sdk.xml:xml-doctype-p d)) + (is (string= "root" (io.github.cl-sdk.xml:xml-doctype-name d))) + (is (null (io.github.cl-sdk.xml:xml-doctype-public-id d))) + (is (string= "root.dtd" (io.github.cl-sdk.xml:xml-doctype-system-id d))) + (is (null (io.github.cl-sdk.xml:xml-doctype-elements d))))) ;;; xml-document-doctype accessor (test no-doctype-gives-nil "A document without a DOCTYPE has xml-document-doctype = NIL." - (let ((doc (cl-xml:parse-xml ""))) - (is (null (cl-xml:xml-document-doctype doc))))) + (let ((doc (io.github.cl-sdk.xml:parse-xml ""))) + (is (null (io.github.cl-sdk.xml:xml-document-doctype doc))))) (test doctype-present "A document with a DOCTYPE has a non-nil xml-doctype in xml-document-doctype." - (let* ((doc (cl-xml:parse-xml "")) - (dtd (cl-xml:xml-document-doctype doc))) - (is (cl-xml:xml-doctype-p dtd)) - (is (string= "root" (cl-xml:xml-doctype-name dtd))))) + (let* ((doc (io.github.cl-sdk.xml:parse-xml "")) + (dtd (io.github.cl-sdk.xml:xml-document-doctype doc))) + (is (io.github.cl-sdk.xml:xml-doctype-p dtd)) + (is (string= "root" (io.github.cl-sdk.xml:xml-doctype-name dtd))))) (test doctype-no-external-id "A DOCTYPE with no external identifier has nil public-id and system-id." - (let* ((dtd (cl-xml:xml-document-doctype - (cl-xml:parse-xml "")))) - (is (null (cl-xml:xml-doctype-public-id dtd))) - (is (null (cl-xml:xml-doctype-system-id dtd))))) + (let* ((dtd (io.github.cl-sdk.xml:xml-document-doctype + (io.github.cl-sdk.xml:parse-xml "")))) + (is (null (io.github.cl-sdk.xml:xml-doctype-public-id dtd))) + (is (null (io.github.cl-sdk.xml:xml-doctype-system-id dtd))))) (test doctype-system-id "A DOCTYPE with SYSTEM identifier records the system-id." - (let* ((dtd (cl-xml:xml-document-doctype - (cl-xml:parse-xml + (let* ((dtd (io.github.cl-sdk.xml:xml-document-doctype + (io.github.cl-sdk.xml:parse-xml "")))) - (is (null (cl-xml:xml-doctype-public-id dtd))) - (is (string= "root.dtd" (cl-xml:xml-doctype-system-id dtd))))) + (is (null (io.github.cl-sdk.xml:xml-doctype-public-id dtd))) + (is (string= "root.dtd" (io.github.cl-sdk.xml:xml-doctype-system-id dtd))))) (test doctype-public-id "A DOCTYPE with PUBLIC identifier records both public-id and system-id." - (let* ((dtd (cl-xml:xml-document-doctype - (cl-xml:parse-xml + (let* ((dtd (io.github.cl-sdk.xml:xml-document-doctype + (io.github.cl-sdk.xml:parse-xml "")))) - (is (string= "-//W3C//DTD XHTML 1.0//EN" (cl-xml:xml-doctype-public-id dtd))) - (is (string= "xhtml1.dtd" (cl-xml:xml-doctype-system-id dtd))))) + (is (string= "-//W3C//DTD XHTML 1.0//EN" (io.github.cl-sdk.xml:xml-doctype-public-id dtd))) + (is (string= "xhtml1.dtd" (io.github.cl-sdk.xml:xml-doctype-system-id dtd))))) (test doctype-root-element-preserved "The root element is still correctly parsed when a DOCTYPE is present." - (let ((doc (cl-xml:parse-xml ""))) - (is (string= "root" (cl-xml:xml-node-tag (cl-xml:xml-document-root doc)))) - (is (= 1 (length (cl-xml:xml-node-children - (cl-xml:xml-document-root doc))))))) + (let ((doc (io.github.cl-sdk.xml:parse-xml ""))) + (is (string= "root" (io.github.cl-sdk.xml:xml-node-tag (io.github.cl-sdk.xml:xml-document-root doc)))) + (is (= 1 (length (io.github.cl-sdk.xml:xml-node-children + (io.github.cl-sdk.xml:xml-document-root doc))))))) ;;; DTD ELEMENT content models @@ -744,21 +744,21 @@ "]>"))) (is (= 1 (length elems))) (let ((e (first elems))) - (is (string= "root" (cl-xml:xml-dtd-element-name e))) - (is (eq :empty (cl-xml:xml-dtd-element-content-model e)))))) + (is (string= "root" (io.github.cl-sdk.xml:xml-dtd-element-name e))) + (is (eq :empty (io.github.cl-sdk.xml:xml-dtd-element-content-model e)))))) (test dtd-element-any " with ANY content model is parsed as :any." (let ((elems (parse-doctype-elements "]>"))) (is (= 1 (length elems))) - (is (eq :any (cl-xml:xml-dtd-element-content-model (first elems)))))) + (is (eq :any (io.github.cl-sdk.xml:xml-dtd-element-content-model (first elems)))))) (test dtd-element-pcdata-only " with (#PCDATA) is parsed as (:mixed)." (let* ((elems (parse-doctype-elements "]>")) - (cm (cl-xml:xml-dtd-element-content-model (first elems)))) + (cm (io.github.cl-sdk.xml:xml-dtd-element-content-model (first elems)))) (is (consp cm)) (is (eq :mixed (car cm))) (is (null (cdr cm))))) @@ -767,7 +767,7 @@ " with (#PCDATA|a|b)* is parsed as (:mixed \"a\" \"b\")." (let* ((elems (parse-doctype-elements "]>")) - (cm (cl-xml:xml-dtd-element-content-model (first elems)))) + (cm (io.github.cl-sdk.xml:xml-dtd-element-content-model (first elems)))) (is (eq :mixed (car cm))) (is (equal '("a" "b") (cdr cm))))) @@ -775,42 +775,42 @@ " with (a, b, c) is parsed as (:seq \"a\" \"b\" \"c\")." (let* ((elems (parse-doctype-elements "]>")) - (cm (cl-xml:xml-dtd-element-content-model (first elems)))) + (cm (io.github.cl-sdk.xml:xml-dtd-element-content-model (first elems)))) (is (equal '(:seq "a" "b" "c") cm)))) (test dtd-element-choice " with (a|b) is parsed as (:choice \"a\" \"b\")." (let* ((elems (parse-doctype-elements "]>")) - (cm (cl-xml:xml-dtd-element-content-model (first elems)))) + (cm (io.github.cl-sdk.xml:xml-dtd-element-content-model (first elems)))) (is (equal '(:choice "a" "b") cm)))) (test dtd-element-sequence-plus " with (a, b)+ wraps the group with :+." (let* ((elems (parse-doctype-elements "]>")) - (cm (cl-xml:xml-dtd-element-content-model (first elems)))) + (cm (io.github.cl-sdk.xml:xml-dtd-element-content-model (first elems)))) (is (equal '(:+ (:seq "a" "b")) cm)))) (test dtd-element-choice-star " with (a|b)* wraps the group with :*." (let* ((elems (parse-doctype-elements "]>")) - (cm (cl-xml:xml-dtd-element-content-model (first elems)))) + (cm (io.github.cl-sdk.xml:xml-dtd-element-content-model (first elems)))) (is (equal '(:* (:choice "a" "b")) cm)))) (test dtd-element-sequence-opt " with (a, b)? wraps the group with :?." (let* ((elems (parse-doctype-elements "]>")) - (cm (cl-xml:xml-dtd-element-content-model (first elems)))) + (cm (io.github.cl-sdk.xml:xml-dtd-element-content-model (first elems)))) (is (equal '(:? (:seq "a" "b")) cm)))) (test dtd-element-leaf-quantifier "A leaf content particle with + quantifier is wrapped with :+." (let* ((elems (parse-doctype-elements "]>")) - (cm (cl-xml:xml-dtd-element-content-model (first elems)))) + (cm (io.github.cl-sdk.xml:xml-dtd-element-content-model (first elems)))) ;; (a+) → single-element sequence containing (:+ "a") (is (equal '(:seq (:+ "a")) cm)))) @@ -818,7 +818,7 @@ " with ((a,b)|c) is parsed as a nested group." (let* ((elems (parse-doctype-elements "]>")) - (cm (cl-xml:xml-dtd-element-content-model (first elems)))) + (cm (io.github.cl-sdk.xml:xml-dtd-element-content-model (first elems)))) (is (equal '(:choice (:seq "a" "b") "c") cm)))) (test dtd-multiple-elements @@ -831,26 +831,26 @@ "" "]>")))) (is (= 3 (length elems))) - (is (string= "root" (cl-xml:xml-dtd-element-name (first elems)))) - (is (string= "a" (cl-xml:xml-dtd-element-name (second elems)))) - (is (string= "b" (cl-xml:xml-dtd-element-name (third elems)))) + (is (string= "root" (io.github.cl-sdk.xml:xml-dtd-element-name (first elems)))) + (is (string= "a" (io.github.cl-sdk.xml:xml-dtd-element-name (second elems)))) + (is (string= "b" (io.github.cl-sdk.xml:xml-dtd-element-name (third elems)))) (is (equal '(:seq "a" "b") - (cl-xml:xml-dtd-element-content-model (first elems)))) - (is (eq :empty (cl-xml:xml-dtd-element-content-model (third elems)))))) + (io.github.cl-sdk.xml:xml-dtd-element-content-model (first elems)))) + (is (eq :empty (io.github.cl-sdk.xml:xml-dtd-element-content-model (third elems)))))) (test dtd-attlist-coexists-with-element " declaration does not interfere with parsing." - (let* ((dtd (cl-xml:xml-document-doctype - (cl-xml:parse-xml + (let* ((dtd (io.github.cl-sdk.xml:xml-document-doctype + (io.github.cl-sdk.xml:parse-xml (concatenate 'string "" "" "]>")))) - (elems (cl-xml:xml-doctype-elements dtd))) + (elems (io.github.cl-sdk.xml:xml-doctype-elements dtd))) (is (= 1 (length elems))) - (is (string= "root" (cl-xml:xml-dtd-element-name (first elems)))) - (is (= 1 (length (cl-xml:xml-doctype-attlists dtd)))))) + (is (string= "root" (io.github.cl-sdk.xml:xml-dtd-element-name (first elems)))) + (is (= 1 (length (io.github.cl-sdk.xml:xml-doctype-attlists dtd)))))) (test dtd-comment-in-subset-skipped "Comments inside the internal subset are silently skipped." @@ -861,20 +861,20 @@ "" "]>")))) (is (= 1 (length elems))) - (is (string= "root" (cl-xml:xml-dtd-element-name (first elems)))))) + (is (string= "root" (io.github.cl-sdk.xml:xml-dtd-element-name (first elems)))))) (test dtd-whitespace-in-content-model "Whitespace around operators in a content model is handled correctly." (let* ((elems (parse-doctype-elements "]>")) - (cm (cl-xml:xml-dtd-element-content-model (first elems)))) + (cm (io.github.cl-sdk.xml:xml-dtd-element-content-model (first elems)))) (is (equal '(:choice "a" "b" "c") cm)))) (test dtd-whitespace-sequence "Whitespace around ',' in a sequence is handled correctly." (let* ((elems (parse-doctype-elements "]>")) - (cm (cl-xml:xml-dtd-element-content-model (first elems)))) + (cm (io.github.cl-sdk.xml:xml-dtd-element-content-model (first elems)))) (is (equal '(:seq "a" "b" "c") cm)))) ;;; SAX doctype-declaration event @@ -882,7 +882,7 @@ (test sax-doctype-declaration-event "The doctype-declaration SAX event is fired with the parsed xml-doctype." (let* ((handler (make-instance 'collecting-handler)) - (result (cl-xml:parse-xml + (result (io.github.cl-sdk.xml:parse-xml "]>" :handler handler))) ;; collecting-handler doesn't define doctype-declaration, so the default @@ -894,35 +894,35 @@ (defun parse-doctype-attlists (str) "Parse STR and return the list of xml-dtd-attlist structs from the DOCTYPE." - (cl-xml:xml-doctype-attlists - (cl-xml:xml-document-doctype (cl-xml:parse-xml str)))) + (io.github.cl-sdk.xml:xml-doctype-attlists + (io.github.cl-sdk.xml:xml-document-doctype (io.github.cl-sdk.xml:parse-xml str)))) ;;; xml-dtd-att-def struct (test dtd-att-def-struct "xml-dtd-att-def struct has name, type, and default fields." - (let ((d (cl-xml:make-xml-dtd-att-def :name "id" :type :id :default :required))) - (is (cl-xml:xml-dtd-att-def-p d)) - (is (string= "id" (cl-xml:xml-dtd-att-def-name d))) - (is (eq :id (cl-xml:xml-dtd-att-def-type d))) - (is (eq :required (cl-xml:xml-dtd-att-def-default d))))) + (let ((d (io.github.cl-sdk.xml:make-xml-dtd-att-def :name "id" :type :id :default :required))) + (is (io.github.cl-sdk.xml:xml-dtd-att-def-p d)) + (is (string= "id" (io.github.cl-sdk.xml:xml-dtd-att-def-name d))) + (is (eq :id (io.github.cl-sdk.xml:xml-dtd-att-def-type d))) + (is (eq :required (io.github.cl-sdk.xml:xml-dtd-att-def-default d))))) ;;; xml-dtd-attlist struct (test dtd-attlist-struct "xml-dtd-attlist struct has element-name and definitions fields." - (let ((a (cl-xml:make-xml-dtd-attlist :element-name "root" :definitions '()))) - (is (cl-xml:xml-dtd-attlist-p a)) - (is (string= "root" (cl-xml:xml-dtd-attlist-element-name a))) - (is (null (cl-xml:xml-dtd-attlist-definitions a))))) + (let ((a (io.github.cl-sdk.xml:make-xml-dtd-attlist :element-name "root" :definitions '()))) + (is (io.github.cl-sdk.xml:xml-dtd-attlist-p a)) + (is (string= "root" (io.github.cl-sdk.xml:xml-dtd-attlist-element-name a))) + (is (null (io.github.cl-sdk.xml:xml-dtd-attlist-definitions a))))) ;;; xml-doctype-attlists accessor (test dtd-doctype-has-attlists "xml-doctype-attlists returns NIL when no ATTLIST is present." - (let* ((dtd (cl-xml:xml-document-doctype - (cl-xml:parse-xml "")))) - (is (null (cl-xml:xml-doctype-attlists dtd))))) + (let* ((dtd (io.github.cl-sdk.xml:xml-document-doctype + (io.github.cl-sdk.xml:parse-xml "")))) + (is (null (io.github.cl-sdk.xml:xml-doctype-attlists dtd))))) ;;; Tokenized attribute types @@ -931,62 +931,62 @@ (let* ((alists (parse-doctype-attlists "]>")) (al (first alists)) - (def (first (cl-xml:xml-dtd-attlist-definitions al)))) + (def (first (io.github.cl-sdk.xml:xml-dtd-attlist-definitions al)))) (is (= 1 (length alists))) - (is (string= "root" (cl-xml:xml-dtd-attlist-element-name al))) - (is (string= "title" (cl-xml:xml-dtd-att-def-name def))) - (is (eq :cdata (cl-xml:xml-dtd-att-def-type def))) - (is (eq :required (cl-xml:xml-dtd-att-def-default def))))) + (is (string= "root" (io.github.cl-sdk.xml:xml-dtd-attlist-element-name al))) + (is (string= "title" (io.github.cl-sdk.xml:xml-dtd-att-def-name def))) + (is (eq :cdata (io.github.cl-sdk.xml:xml-dtd-att-def-type def))) + (is (eq :required (io.github.cl-sdk.xml:xml-dtd-att-def-default def))))) (test dtd-attlist-id-implied " with ID type and #IMPLIED default is parsed correctly." (let* ((alists (parse-doctype-attlists "]>")) - (def (first (cl-xml:xml-dtd-attlist-definitions (first alists))))) - (is (eq :id (cl-xml:xml-dtd-att-def-type def))) - (is (eq :implied (cl-xml:xml-dtd-att-def-default def))))) + (def (first (io.github.cl-sdk.xml:xml-dtd-attlist-definitions (first alists))))) + (is (eq :id (io.github.cl-sdk.xml:xml-dtd-att-def-type def))) + (is (eq :implied (io.github.cl-sdk.xml:xml-dtd-att-def-default def))))) (test dtd-attlist-idref-type " with IDREF type is parsed as :idref." - (let* ((def (first (cl-xml:xml-dtd-attlist-definitions + (let* ((def (first (io.github.cl-sdk.xml:xml-dtd-attlist-definitions (first (parse-doctype-attlists "]>")))))) - (is (eq :idref (cl-xml:xml-dtd-att-def-type def))))) + (is (eq :idref (io.github.cl-sdk.xml:xml-dtd-att-def-type def))))) (test dtd-attlist-idrefs-type " with IDREFS type is parsed as :idrefs." - (let* ((def (first (cl-xml:xml-dtd-attlist-definitions + (let* ((def (first (io.github.cl-sdk.xml:xml-dtd-attlist-definitions (first (parse-doctype-attlists "]>")))))) - (is (eq :idrefs (cl-xml:xml-dtd-att-def-type def))))) + (is (eq :idrefs (io.github.cl-sdk.xml:xml-dtd-att-def-type def))))) (test dtd-attlist-entity-type " with ENTITY type is parsed as :entity." - (let* ((def (first (cl-xml:xml-dtd-attlist-definitions + (let* ((def (first (io.github.cl-sdk.xml:xml-dtd-attlist-definitions (first (parse-doctype-attlists "]>")))))) - (is (eq :entity (cl-xml:xml-dtd-att-def-type def))))) + (is (eq :entity (io.github.cl-sdk.xml:xml-dtd-att-def-type def))))) (test dtd-attlist-entities-type " with ENTITIES type is parsed as :entities." - (let* ((def (first (cl-xml:xml-dtd-attlist-definitions + (let* ((def (first (io.github.cl-sdk.xml:xml-dtd-attlist-definitions (first (parse-doctype-attlists "]>")))))) - (is (eq :entities (cl-xml:xml-dtd-att-def-type def))))) + (is (eq :entities (io.github.cl-sdk.xml:xml-dtd-att-def-type def))))) (test dtd-attlist-nmtoken-type " with NMTOKEN type is parsed as :nmtoken." - (let* ((def (first (cl-xml:xml-dtd-attlist-definitions + (let* ((def (first (io.github.cl-sdk.xml:xml-dtd-attlist-definitions (first (parse-doctype-attlists "]>")))))) - (is (eq :nmtoken (cl-xml:xml-dtd-att-def-type def))))) + (is (eq :nmtoken (io.github.cl-sdk.xml:xml-dtd-att-def-type def))))) (test dtd-attlist-nmtokens-type " with NMTOKENS type is parsed as :nmtokens." - (let* ((def (first (cl-xml:xml-dtd-attlist-definitions + (let* ((def (first (io.github.cl-sdk.xml:xml-dtd-attlist-definitions (first (parse-doctype-attlists "]>")))))) - (is (eq :nmtokens (cl-xml:xml-dtd-att-def-type def))))) + (is (eq :nmtokens (io.github.cl-sdk.xml:xml-dtd-att-def-type def))))) ;;; Enumerated and NOTATION types @@ -994,33 +994,33 @@ " with enumerated type is parsed as (:enumeration token+)." (let* ((alists (parse-doctype-attlists "]>")) - (def (first (cl-xml:xml-dtd-attlist-definitions (first alists))))) + (def (first (io.github.cl-sdk.xml:xml-dtd-attlist-definitions (first alists))))) (is (equal '(:enumeration "small" "medium" "large") - (cl-xml:xml-dtd-att-def-type def))))) + (io.github.cl-sdk.xml:xml-dtd-att-def-type def))))) (test dtd-attlist-notation-type " with NOTATION type is parsed as (:notation name+)." (let* ((alists (parse-doctype-attlists "]>")) - (def (first (cl-xml:xml-dtd-attlist-definitions (first alists))))) + (def (first (io.github.cl-sdk.xml:xml-dtd-attlist-definitions (first alists))))) (is (equal '(:notation "gif" "png") - (cl-xml:xml-dtd-att-def-type def))))) + (io.github.cl-sdk.xml:xml-dtd-att-def-type def))))) ;;; Default declarations (test dtd-attlist-fixed-default " with #FIXED AttValue is parsed as (:fixed value)." - (let* ((def (first (cl-xml:xml-dtd-attlist-definitions + (let* ((def (first (io.github.cl-sdk.xml:xml-dtd-attlist-definitions (first (parse-doctype-attlists "]>")))))) - (is (equal '(:fixed "en") (cl-xml:xml-dtd-att-def-default def))))) + (is (equal '(:fixed "en") (io.github.cl-sdk.xml:xml-dtd-att-def-default def))))) (test dtd-attlist-bare-default " with a bare AttValue is parsed as (:default value)." - (let* ((def (first (cl-xml:xml-dtd-attlist-definitions + (let* ((def (first (io.github.cl-sdk.xml:xml-dtd-attlist-definitions (first (parse-doctype-attlists "]>")))))) - (is (equal '(:default "en") (cl-xml:xml-dtd-att-def-default def))))) + (is (equal '(:default "en") (io.github.cl-sdk.xml:xml-dtd-att-def-default def))))) ;;; Multiple attribute definitions in one ATTLIST @@ -1032,11 +1032,11 @@ " id ID #REQUIRED" " class CDATA #IMPLIED" " lang CDATA \"en\">]>")))) - (defs (cl-xml:xml-dtd-attlist-definitions al))) + (defs (io.github.cl-sdk.xml:xml-dtd-attlist-definitions al))) (is (= 3 (length defs))) - (is (string= "id" (cl-xml:xml-dtd-att-def-name (first defs)))) - (is (string= "class" (cl-xml:xml-dtd-att-def-name (second defs)))) - (is (string= "lang" (cl-xml:xml-dtd-att-def-name (third defs)))))) + (is (string= "id" (io.github.cl-sdk.xml:xml-dtd-att-def-name (first defs)))) + (is (string= "class" (io.github.cl-sdk.xml:xml-dtd-att-def-name (second defs)))) + (is (string= "lang" (io.github.cl-sdk.xml:xml-dtd-att-def-name (third defs)))))) ;;; Multiple ATTLIST declarations @@ -1047,26 +1047,26 @@ "" "]>")))) (is (= 2 (length alists))) - (is (string= "r" (cl-xml:xml-dtd-attlist-element-name (first alists)))) - (is (string= "p" (cl-xml:xml-dtd-attlist-element-name (second alists)))))) + (is (string= "r" (io.github.cl-sdk.xml:xml-dtd-attlist-element-name (first alists)))) + (is (string= "p" (io.github.cl-sdk.xml:xml-dtd-attlist-element-name (second alists)))))) ;;; ── DTD ENTITY parsing ──────────────────────────────────────────────────── (defun parse-doctype-entities (str) "Parse STR and return the list of xml-dtd-entity structs from the DOCTYPE." - (cl-xml:xml-doctype-entities - (cl-xml:xml-document-doctype (cl-xml:parse-xml str)))) + (io.github.cl-sdk.xml:xml-doctype-entities + (io.github.cl-sdk.xml:xml-document-doctype (io.github.cl-sdk.xml:parse-xml str)))) ;;; xml-dtd-entity struct (test dtd-entity-struct "xml-dtd-entity struct has name, parameter-p, and definition fields." - (let ((e (cl-xml:make-xml-dtd-entity :name "amp" :parameter-p nil + (let ((e (io.github.cl-sdk.xml:make-xml-dtd-entity :name "amp" :parameter-p nil :definition "&"))) - (is (cl-xml:xml-dtd-entity-p e)) - (is (string= "amp" (cl-xml:xml-dtd-entity-name e))) - (is (null (cl-xml:xml-dtd-entity-parameter-p e))) - (is (string= "&" (cl-xml:xml-dtd-entity-definition e))))) + (is (io.github.cl-sdk.xml:xml-dtd-entity-p e)) + (is (string= "amp" (io.github.cl-sdk.xml:xml-dtd-entity-name e))) + (is (null (io.github.cl-sdk.xml:xml-dtd-entity-parameter-p e))) + (is (string= "&" (io.github.cl-sdk.xml:xml-dtd-entity-definition e))))) ;;; Internal general entity @@ -1076,9 +1076,9 @@ "]>")) (e (first ents))) (is (= 1 (length ents))) - (is (string= "greeting" (cl-xml:xml-dtd-entity-name e))) - (is (null (cl-xml:xml-dtd-entity-parameter-p e))) - (is (string= "Hello" (cl-xml:xml-dtd-entity-definition e))))) + (is (string= "greeting" (io.github.cl-sdk.xml:xml-dtd-entity-name e))) + (is (null (io.github.cl-sdk.xml:xml-dtd-entity-parameter-p e))) + (is (string= "Hello" (io.github.cl-sdk.xml:xml-dtd-entity-definition e))))) ;;; Internal parameter entity @@ -1088,9 +1088,9 @@ "]>")) (e (first ents))) (is (= 1 (length ents))) - (is (string= "inline" (cl-xml:xml-dtd-entity-name e))) - (is (cl-xml:xml-dtd-entity-parameter-p e)) - (is (string= "(#PCDATA)" (cl-xml:xml-dtd-entity-definition e))))) + (is (string= "inline" (io.github.cl-sdk.xml:xml-dtd-entity-name e))) + (is (io.github.cl-sdk.xml:xml-dtd-entity-parameter-p e)) + (is (string= "(#PCDATA)" (io.github.cl-sdk.xml:xml-dtd-entity-definition e))))) ;;; External general entity — SYSTEM @@ -1099,7 +1099,7 @@ (let* ((ents (parse-doctype-entities "]>")) (e (first ents))) - (is (equal '(:external nil "logo.png") (cl-xml:xml-dtd-entity-definition e))))) + (is (equal '(:external nil "logo.png") (io.github.cl-sdk.xml:xml-dtd-entity-definition e))))) ;;; External general entity — PUBLIC @@ -1109,7 +1109,7 @@ "]>")) (e (first ents))) (is (equal '(:external "-//ISO//EN" "iso.ent") - (cl-xml:xml-dtd-entity-definition e))))) + (io.github.cl-sdk.xml:xml-dtd-entity-definition e))))) ;;; Unparsed (NDATA) entity @@ -1119,7 +1119,7 @@ "]>")) (e (first ents))) (is (equal '(:unparsed nil "logo.gif" "gif") - (cl-xml:xml-dtd-entity-definition e))))) + (io.github.cl-sdk.xml:xml-dtd-entity-definition e))))) ;;; External parameter entity @@ -1128,9 +1128,9 @@ (let* ((ents (parse-doctype-entities "]>")) (e (first ents))) - (is (cl-xml:xml-dtd-entity-parameter-p e)) + (is (io.github.cl-sdk.xml:xml-dtd-entity-parameter-p e)) (is (equal '(:external nil "common.ent") - (cl-xml:xml-dtd-entity-definition e))))) + (io.github.cl-sdk.xml:xml-dtd-entity-definition e))))) ;;; Multiple entities @@ -1143,26 +1143,26 @@ "" "]>")))) (is (= 2 (length ents))) - (is (string= "a" (cl-xml:xml-dtd-entity-name (first ents)))) - (is (string= "b" (cl-xml:xml-dtd-entity-name (second ents)))))) + (is (string= "a" (io.github.cl-sdk.xml:xml-dtd-entity-name (first ents)))) + (is (string= "b" (io.github.cl-sdk.xml:xml-dtd-entity-name (second ents)))))) ;;; ── DTD NOTATION parsing ────────────────────────────────────────────────── (defun parse-doctype-notations (str) "Parse STR and return the list of xml-dtd-notation structs from the DOCTYPE." - (cl-xml:xml-doctype-notations - (cl-xml:xml-document-doctype (cl-xml:parse-xml str)))) + (io.github.cl-sdk.xml:xml-doctype-notations + (io.github.cl-sdk.xml:xml-document-doctype (io.github.cl-sdk.xml:parse-xml str)))) ;;; xml-dtd-notation struct (test dtd-notation-struct "xml-dtd-notation struct has name, public-id, and system-id fields." - (let ((n (cl-xml:make-xml-dtd-notation :name "gif" :public-id nil + (let ((n (io.github.cl-sdk.xml:make-xml-dtd-notation :name "gif" :public-id nil :system-id "image/gif"))) - (is (cl-xml:xml-dtd-notation-p n)) - (is (string= "gif" (cl-xml:xml-dtd-notation-name n))) - (is (null (cl-xml:xml-dtd-notation-public-id n))) - (is (string= "image/gif" (cl-xml:xml-dtd-notation-system-id n))))) + (is (io.github.cl-sdk.xml:xml-dtd-notation-p n)) + (is (string= "gif" (io.github.cl-sdk.xml:xml-dtd-notation-name n))) + (is (null (io.github.cl-sdk.xml:xml-dtd-notation-public-id n))) + (is (string= "image/gif" (io.github.cl-sdk.xml:xml-dtd-notation-system-id n))))) ;;; NOTATION with SYSTEM identifier @@ -1172,9 +1172,9 @@ "]>")) (n (first notations))) (is (= 1 (length notations))) - (is (string= "gif" (cl-xml:xml-dtd-notation-name n))) - (is (null (cl-xml:xml-dtd-notation-public-id n))) - (is (string= "image/gif" (cl-xml:xml-dtd-notation-system-id n))))) + (is (string= "gif" (io.github.cl-sdk.xml:xml-dtd-notation-name n))) + (is (null (io.github.cl-sdk.xml:xml-dtd-notation-public-id n))) + (is (string= "image/gif" (io.github.cl-sdk.xml:xml-dtd-notation-system-id n))))) ;;; NOTATION with PUBLIC + SYSTEM identifiers (ExternalID) @@ -1183,8 +1183,8 @@ (let* ((notations (parse-doctype-notations "]>")) (n (first notations))) - (is (string= "-//JPEG//" (cl-xml:xml-dtd-notation-public-id n))) - (is (string= "image/jpeg" (cl-xml:xml-dtd-notation-system-id n))))) + (is (string= "-//JPEG//" (io.github.cl-sdk.xml:xml-dtd-notation-public-id n))) + (is (string= "image/jpeg" (io.github.cl-sdk.xml:xml-dtd-notation-system-id n))))) ;;; NOTATION with PUBLIC only (PublicID — no system literal) @@ -1193,8 +1193,8 @@ (let* ((notations (parse-doctype-notations "]>")) (n (first notations))) - (is (string= "-//Adobe//PDF" (cl-xml:xml-dtd-notation-public-id n))) - (is (null (cl-xml:xml-dtd-notation-system-id n))))) + (is (string= "-//Adobe//PDF" (io.github.cl-sdk.xml:xml-dtd-notation-public-id n))) + (is (null (io.github.cl-sdk.xml:xml-dtd-notation-system-id n))))) ;;; Multiple notations @@ -1207,15 +1207,15 @@ "" "]>")))) (is (= 2 (length notations))) - (is (string= "gif" (cl-xml:xml-dtd-notation-name (first notations)))) - (is (string= "png" (cl-xml:xml-dtd-notation-name (second notations)))))) + (is (string= "gif" (io.github.cl-sdk.xml:xml-dtd-notation-name (first notations)))) + (is (string= "png" (io.github.cl-sdk.xml:xml-dtd-notation-name (second notations)))))) ;;; ── All DTD declaration types together ──────────────────────────────────── (test dtd-all-declaration-types "DOCTYPE internal subset with ELEMENT, ATTLIST, ENTITY, and NOTATION all parsed." - (let* ((dtd (cl-xml:xml-document-doctype - (cl-xml:parse-xml + (let* ((dtd (io.github.cl-sdk.xml:xml-document-doctype + (io.github.cl-sdk.xml:parse-xml (concatenate 'string "" @@ -1223,29 +1223,29 @@ "" "" "]>"))))) - (is (= 1 (length (cl-xml:xml-doctype-elements dtd)))) - (is (= 1 (length (cl-xml:xml-doctype-attlists dtd)))) - (is (= 1 (length (cl-xml:xml-doctype-entities dtd)))) - (is (= 1 (length (cl-xml:xml-doctype-notations dtd)))) + (is (= 1 (length (io.github.cl-sdk.xml:xml-doctype-elements dtd)))) + (is (= 1 (length (io.github.cl-sdk.xml:xml-doctype-attlists dtd)))) + (is (= 1 (length (io.github.cl-sdk.xml:xml-doctype-entities dtd)))) + (is (= 1 (length (io.github.cl-sdk.xml:xml-doctype-notations dtd)))) (is (string= "root" - (cl-xml:xml-dtd-element-name - (first (cl-xml:xml-doctype-elements dtd))))) + (io.github.cl-sdk.xml:xml-dtd-element-name + (first (io.github.cl-sdk.xml:xml-doctype-elements dtd))))) (is (string= "root" - (cl-xml:xml-dtd-attlist-element-name - (first (cl-xml:xml-doctype-attlists dtd))))) + (io.github.cl-sdk.xml:xml-dtd-attlist-element-name + (first (io.github.cl-sdk.xml:xml-doctype-attlists dtd))))) (is (string= "copyright" - (cl-xml:xml-dtd-entity-name - (first (cl-xml:xml-doctype-entities dtd))))) + (io.github.cl-sdk.xml:xml-dtd-entity-name + (first (io.github.cl-sdk.xml:xml-doctype-entities dtd))))) (is (string= "svg" - (cl-xml:xml-dtd-notation-name - (first (cl-xml:xml-doctype-notations dtd))))))) + (io.github.cl-sdk.xml:xml-dtd-notation-name + (first (io.github.cl-sdk.xml:xml-doctype-notations dtd))))))) ;;; PE references between declarations are tolerated (test dtd-pe-reference-between-decls "Parameter entity references between markup declarations do not cause errors." - (let* ((dtd (cl-xml:xml-document-doctype - (cl-xml:parse-xml + (let* ((dtd (io.github.cl-sdk.xml:xml-document-doctype + (io.github.cl-sdk.xml:parse-xml (concatenate 'string "" @@ -1253,5 +1253,5 @@ "" "]>"))))) ;; The PE reference is skipped; ELEMENT is still parsed - (is (= 1 (length (cl-xml:xml-doctype-elements dtd)))))) + (is (= 1 (length (io.github.cl-sdk.xml:xml-doctype-elements dtd)))))) diff --git a/t/cl-xsd-package.lisp b/t/cl-xsd-package.lisp index 554e26f..9752655 100644 --- a/t/cl-xsd-package.lisp +++ b/t/cl-xsd-package.lisp @@ -1,3 +1,3 @@ -(defpackage #:cl-xsd.test - (:use #:cl #:fiveam #:cl-xsd) +(defpackage #:io.github.cl-sdk.xsd.test + (:use #:cl #:fiveam #:io.github.cl-sdk.xsd) (:export #:cl-xsd-suite)) diff --git a/t/cl-xsd-tests.lisp b/t/cl-xsd-tests.lisp index cb9d261..04e7dc7 100644 --- a/t/cl-xsd-tests.lisp +++ b/t/cl-xsd-tests.lisp @@ -1,4 +1,4 @@ -(in-package #:cl-xsd.test) +(in-package #:io.github.cl-sdk.xsd.test) (def-suite cl-xsd-suite :description "Test suite for cl-xsd.") @@ -16,35 +16,35 @@ (test load-xsd-returns-schema "load-xsd returns an xsd-schema struct." - (let ((schema (cl-xsd:load-xsd +simple-xsd+))) - (is (cl-xsd:xsd-schema-p schema)))) + (let ((schema (io.github.cl-sdk.xsd:load-xsd +simple-xsd+))) + (is (io.github.cl-sdk.xsd:xsd-schema-p schema)))) (test load-xsd-parses-target-namespace "load-xsd captures the targetNamespace attribute." - (let ((schema (cl-xsd:load-xsd + (let ((schema (io.github.cl-sdk.xsd:load-xsd " "))) (is (string= "http://example.com/ns" - (cl-xsd:xsd-schema-target-namespace schema))))) + (io.github.cl-sdk.xsd:xsd-schema-target-namespace schema))))) (test load-xsd-parses-top-level-element "load-xsd populates the elements alist with top-level xs:element declarations." - (let* ((schema (cl-xsd:load-xsd +simple-xsd+)) - (elem (cdr (assoc "root" (cl-xsd:xsd-schema-elements schema) + (let* ((schema (io.github.cl-sdk.xsd:load-xsd +simple-xsd+)) + (elem (cdr (assoc "root" (io.github.cl-sdk.xsd:xsd-schema-elements schema) :test #'string=)))) (is (not (null elem))) - (is (cl-xsd:xsd-element-p elem)) - (is (string= "root" (cl-xsd:xsd-element-name elem))) - (is (eq :string (cl-xsd:xsd-element-type elem))) - (is (= 1 (cl-xsd:xsd-element-min-occurs elem))) - (is (= 1 (cl-xsd:xsd-element-max-occurs elem))))) + (is (io.github.cl-sdk.xsd:xsd-element-p elem)) + (is (string= "root" (io.github.cl-sdk.xsd:xsd-element-name elem))) + (is (eq :string (io.github.cl-sdk.xsd:xsd-element-type elem))) + (is (= 1 (io.github.cl-sdk.xsd:xsd-element-min-occurs elem))) + (is (= 1 (io.github.cl-sdk.xsd:xsd-element-max-occurs elem))))) (test load-xsd-parses-named-complex-type "load-xsd places a named xs:complexType in the types alist." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " @@ -56,20 +56,20 @@ ")) - (ctype (cdr (assoc "PersonType" (cl-xsd:xsd-schema-types schema) + (ctype (cdr (assoc "PersonType" (io.github.cl-sdk.xsd:xsd-schema-types schema) :test #'string=)))) - (is (cl-xsd:xsd-complex-type-p ctype)) - (is (string= "PersonType" (cl-xsd:xsd-complex-type-name ctype))) - (is (eq :sequence (cl-xsd:xsd-complex-type-compositor ctype))) - (is (= 2 (length (cl-xsd:xsd-complex-type-elements ctype)))) - (is (= 1 (length (cl-xsd:xsd-complex-type-attributes ctype)))) + (is (io.github.cl-sdk.xsd:xsd-complex-type-p ctype)) + (is (string= "PersonType" (io.github.cl-sdk.xsd:xsd-complex-type-name ctype))) + (is (eq :sequence (io.github.cl-sdk.xsd:xsd-complex-type-compositor ctype))) + (is (= 2 (length (io.github.cl-sdk.xsd:xsd-complex-type-elements ctype)))) + (is (= 1 (length (io.github.cl-sdk.xsd:xsd-complex-type-attributes ctype)))) (is (eq :required - (cl-xsd:xsd-attribute-use - (first (cl-xsd:xsd-complex-type-attributes ctype))))))) + (io.github.cl-sdk.xsd:xsd-attribute-use + (first (io.github.cl-sdk.xsd:xsd-complex-type-attributes ctype))))))) (test load-xsd-parses-named-simple-type "load-xsd places a named xs:simpleType with restriction in the types alist." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " @@ -81,17 +81,17 @@ ")) - (stype (cdr (assoc "SizeType" (cl-xsd:xsd-schema-types schema) + (stype (cdr (assoc "SizeType" (io.github.cl-sdk.xsd:xsd-schema-types schema) :test #'string=)))) - (is (cl-xsd:xsd-simple-type-p stype)) - (is (string= "SizeType" (cl-xsd:xsd-simple-type-name stype))) - (is (eq :string (cl-xsd:xsd-simple-type-base stype))) + (is (io.github.cl-sdk.xsd:xsd-simple-type-p stype)) + (is (string= "SizeType" (io.github.cl-sdk.xsd:xsd-simple-type-name stype))) + (is (eq :string (io.github.cl-sdk.xsd:xsd-simple-type-base stype))) (is (equal '("small" "medium" "large") - (getf (cl-xsd:xsd-simple-type-facets stype) :enumeration))))) + (getf (io.github.cl-sdk.xsd:xsd-simple-type-facets stype) :enumeration))))) (test load-xsd-parses-occurs "load-xsd parses minOccurs/maxOccurs including 'unbounded'." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " @@ -103,16 +103,16 @@ ")) - (list-elem (cdr (assoc "list" (cl-xsd:xsd-schema-elements schema) + (list-elem (cdr (assoc "list" (io.github.cl-sdk.xsd:xsd-schema-elements schema) :test #'string=))) - (ctype (cl-xsd:xsd-element-type list-elem)) - (item-decl (first (cl-xsd:xsd-complex-type-elements ctype)))) - (is (= 0 (cl-xsd:xsd-element-min-occurs item-decl))) - (is (eq :unbounded (cl-xsd:xsd-element-max-occurs item-decl))))) + (ctype (io.github.cl-sdk.xsd:xsd-element-type list-elem)) + (item-decl (first (io.github.cl-sdk.xsd:xsd-complex-type-elements ctype)))) + (is (= 0 (io.github.cl-sdk.xsd:xsd-element-min-occurs item-decl))) + (is (eq :unbounded (io.github.cl-sdk.xsd:xsd-element-max-occurs item-decl))))) (test load-xsd-inline-complex-type "load-xsd handles inline anonymous xs:complexType inside xs:element." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " @@ -123,34 +123,34 @@ ")) - (root-elem (cdr (assoc "root" (cl-xsd:xsd-schema-elements schema) + (root-elem (cdr (assoc "root" (io.github.cl-sdk.xsd:xsd-schema-elements schema) :test #'string=))) - (ctype (cl-xsd:xsd-element-type root-elem))) - (is (cl-xsd:xsd-complex-type-p ctype)) - (is (null (cl-xsd:xsd-complex-type-name ctype))) ; anonymous - (is (= 1 (length (cl-xsd:xsd-complex-type-elements ctype)))))) + (ctype (io.github.cl-sdk.xsd:xsd-element-type root-elem))) + (is (io.github.cl-sdk.xsd:xsd-complex-type-p ctype)) + (is (null (io.github.cl-sdk.xsd:xsd-complex-type-name ctype))) ; anonymous + (is (= 1 (length (io.github.cl-sdk.xsd:xsd-complex-type-elements ctype)))))) (test load-xsd-no-prefix "load-xsd accepts a schema document without a namespace prefix." - (let ((schema (cl-xsd:load-xsd ""))) - (is (cl-xsd:xsd-schema-p schema)) - (is (= 1 (length (cl-xsd:xsd-schema-elements schema)))))) + (let ((schema (io.github.cl-sdk.xsd:load-xsd ""))) + (is (io.github.cl-sdk.xsd:xsd-schema-p schema)) + (is (= 1 (length (io.github.cl-sdk.xsd:xsd-schema-elements schema)))))) (test load-xsd-wrong-root-signals-error "load-xsd signals an error when the root element is not xs:schema." - (signals error (cl-xsd:load-xsd ""))) + (signals error (io.github.cl-sdk.xsd:load-xsd ""))) ;;; ── XSD: validate-xml — valid documents ────────────────────────────────── (test validate-simple-string-element "validate-xml accepts a document whose root element holds a string value." - (let ((schema (cl-xsd:load-xsd +simple-xsd+)) - (doc (cl-xml:parse-xml "hello"))) - (is (cl-xsd:validate-xml doc schema)))) + (let ((schema (io.github.cl-sdk.xsd:load-xsd +simple-xsd+)) + (doc (io.github.cl-sdk.xml:parse-xml "hello"))) + (is (io.github.cl-sdk.xsd:validate-xml doc schema)))) (test validate-complex-type-with-sequence "validate-xml accepts a document matching a complex type with xs:sequence." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " @@ -162,13 +162,13 @@ ")) - (doc (cl-xml:parse-xml + (doc (io.github.cl-sdk.xml:parse-xml "Alice30"))) - (is (cl-xsd:validate-xml doc schema)))) + (is (io.github.cl-sdk.xsd:validate-xml doc schema)))) (test validate-optional-elements-absent "validate-xml accepts a document where optional children are absent." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " @@ -179,12 +179,12 @@ ")) - (doc (cl-xml:parse-xml ""))) - (is (cl-xsd:validate-xml doc schema)))) + (doc (io.github.cl-sdk.xml:parse-xml ""))) + (is (io.github.cl-sdk.xsd:validate-xml doc schema)))) (test validate-unbounded-element "validate-xml accepts multiple occurrences of an unbounded element." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " @@ -196,13 +196,13 @@ ")) - (doc (cl-xml:parse-xml + (doc (io.github.cl-sdk.xml:parse-xml "abc"))) - (is (cl-xsd:validate-xml doc schema)))) + (is (io.github.cl-sdk.xsd:validate-xml doc schema)))) (test validate-xs-all-compositor "validate-xml accepts xs:all children in any order." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " @@ -214,14 +214,14 @@ ")) - (doc-ab (cl-xml:parse-xml "xy
")) - (doc-ba (cl-xml:parse-xml "yx"))) - (is (cl-xsd:validate-xml doc-ab schema)) - (is (cl-xsd:validate-xml doc-ba schema)))) + (doc-ab (io.github.cl-sdk.xml:parse-xml "xy")) + (doc-ba (io.github.cl-sdk.xml:parse-xml "yx"))) + (is (io.github.cl-sdk.xsd:validate-xml doc-ab schema)) + (is (io.github.cl-sdk.xsd:validate-xml doc-ba schema)))) (test validate-xs-choice-compositor "validate-xml accepts either branch of an xs:choice." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " @@ -233,14 +233,14 @@ ")) - (doc-a (cl-xml:parse-xml "hello")) - (doc-b (cl-xml:parse-xml "42"))) - (is (cl-xsd:validate-xml doc-a schema)) - (is (cl-xsd:validate-xml doc-b schema)))) + (doc-a (io.github.cl-sdk.xml:parse-xml "hello")) + (doc-b (io.github.cl-sdk.xml:parse-xml "42"))) + (is (io.github.cl-sdk.xsd:validate-xml doc-a schema)) + (is (io.github.cl-sdk.xsd:validate-xml doc-b schema)))) (test validate-enumeration-restriction "validate-xml accepts a value that is in an xs:enumeration list." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " @@ -253,12 +253,12 @@ ")) - (doc (cl-xml:parse-xml "medium"))) - (is (cl-xsd:validate-xml doc schema)))) + (doc (io.github.cl-sdk.xml:parse-xml "medium"))) + (is (io.github.cl-sdk.xsd:validate-xml doc schema)))) (test validate-length-facet "validate-xml accepts a string whose length satisfies xs:minLength/xs:maxLength." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " @@ -270,12 +270,12 @@ ")) - (doc (cl-xml:parse-xml "abc"))) - (is (cl-xsd:validate-xml doc schema)))) + (doc (io.github.cl-sdk.xml:parse-xml "abc"))) + (is (io.github.cl-sdk.xsd:validate-xml doc schema)))) (test validate-min-inclusive-facet "validate-xml accepts a numeric value satisfying xs:minInclusive." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " @@ -287,50 +287,50 @@ ")) - (doc (cl-xml:parse-xml "75"))) - (is (cl-xsd:validate-xml doc schema)))) + (doc (io.github.cl-sdk.xml:parse-xml "75"))) + (is (io.github.cl-sdk.xsd:validate-xml doc schema)))) ;;; ── XSD: validate-xml — invalid documents (error signaling) ───────────── (test validate-wrong-root-element "validate-xml signals xsd-validation-error when the root element is undeclared." - (let ((schema (cl-xsd:load-xsd +simple-xsd+)) - (doc (cl-xml:parse-xml "hello"))) - (signals cl-xsd:xsd-validation-error (cl-xsd:validate-xml doc schema)))) + (let ((schema (io.github.cl-sdk.xsd:load-xsd +simple-xsd+)) + (doc (io.github.cl-sdk.xml:parse-xml "hello"))) + (signals io.github.cl-sdk.xsd:xsd-validation-error (io.github.cl-sdk.xsd:validate-xml doc schema)))) (test validate-wrong-type-integer "validate-xml signals xsd-validation-error for a non-integer value on xs:integer." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " ")) - (doc (cl-xml:parse-xml "not-a-number"))) - (signals cl-xsd:xsd-validation-error (cl-xsd:validate-xml doc schema)))) + (doc (io.github.cl-sdk.xml:parse-xml "not-a-number"))) + (signals io.github.cl-sdk.xsd:xsd-validation-error (io.github.cl-sdk.xsd:validate-xml doc schema)))) (test validate-wrong-type-boolean "validate-xml signals xsd-validation-error for an invalid xs:boolean value." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " ")) - (doc (cl-xml:parse-xml "yes"))) - (signals cl-xsd:xsd-validation-error (cl-xsd:validate-xml doc schema)))) + (doc (io.github.cl-sdk.xml:parse-xml "yes"))) + (signals io.github.cl-sdk.xsd:xsd-validation-error (io.github.cl-sdk.xsd:validate-xml doc schema)))) (test validate-wrong-type-date "validate-xml signals xsd-validation-error for an invalid xs:date value." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " ")) - (doc (cl-xml:parse-xml "01/01/2000"))) - (signals cl-xsd:xsd-validation-error (cl-xsd:validate-xml doc schema)))) + (doc (io.github.cl-sdk.xml:parse-xml "01/01/2000"))) + (signals io.github.cl-sdk.xsd:xsd-validation-error (io.github.cl-sdk.xsd:validate-xml doc schema)))) (test validate-missing-required-child "validate-xml signals xsd-validation-error when a required xs:sequence child is absent." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " @@ -342,12 +342,12 @@ ")) - (doc (cl-xml:parse-xml "Alice"))) - (signals cl-xsd:xsd-validation-error (cl-xsd:validate-xml doc schema)))) + (doc (io.github.cl-sdk.xml:parse-xml "Alice"))) + (signals io.github.cl-sdk.xsd:xsd-validation-error (io.github.cl-sdk.xsd:validate-xml doc schema)))) (test validate-missing-required-attribute "validate-xml signals xsd-validation-error when a required attribute is absent." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " @@ -356,12 +356,12 @@ ")) - (doc (cl-xml:parse-xml ""))) - (signals cl-xsd:xsd-validation-error (cl-xsd:validate-xml doc schema)))) + (doc (io.github.cl-sdk.xml:parse-xml ""))) + (signals io.github.cl-sdk.xsd:xsd-validation-error (io.github.cl-sdk.xsd:validate-xml doc schema)))) (test validate-prohibited-attribute-present "validate-xml signals xsd-validation-error when a prohibited attribute appears." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " @@ -370,12 +370,12 @@ ")) - (doc (cl-xml:parse-xml ""))) - (signals cl-xsd:xsd-validation-error (cl-xsd:validate-xml doc schema)))) + (doc (io.github.cl-sdk.xml:parse-xml ""))) + (signals io.github.cl-sdk.xsd:xsd-validation-error (io.github.cl-sdk.xsd:validate-xml doc schema)))) (test validate-unexpected-element-in-sequence "validate-xml signals xsd-validation-error when an unexpected element appears." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " @@ -386,12 +386,12 @@ ")) - (doc (cl-xml:parse-xml "ok"))) - (signals cl-xsd:xsd-validation-error (cl-xsd:validate-xml doc schema)))) + (doc (io.github.cl-sdk.xml:parse-xml "ok"))) + (signals io.github.cl-sdk.xsd:xsd-validation-error (io.github.cl-sdk.xsd:validate-xml doc schema)))) (test validate-enumeration-violation "validate-xml signals xsd-validation-error when a value is not in the enumeration." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " @@ -404,12 +404,12 @@ ")) - (doc (cl-xml:parse-xml "purple"))) - (signals cl-xsd:xsd-validation-error (cl-xsd:validate-xml doc schema)))) + (doc (io.github.cl-sdk.xml:parse-xml "purple"))) + (signals io.github.cl-sdk.xsd:xsd-validation-error (io.github.cl-sdk.xsd:validate-xml doc schema)))) (test validate-max-length-violation "validate-xml signals xsd-validation-error when a string exceeds xs:maxLength." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " @@ -420,12 +420,12 @@ ")) - (doc (cl-xml:parse-xml "12345"))) - (signals cl-xsd:xsd-validation-error (cl-xsd:validate-xml doc schema)))) + (doc (io.github.cl-sdk.xml:parse-xml "12345"))) + (signals io.github.cl-sdk.xsd:xsd-validation-error (io.github.cl-sdk.xsd:validate-xml doc schema)))) (test validate-min-inclusive-violation "validate-xml signals xsd-validation-error when xs:minInclusive is violated." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " @@ -437,22 +437,22 @@ ")) - (doc (cl-xml:parse-xml "-5"))) - (signals cl-xsd:xsd-validation-error (cl-xsd:validate-xml doc schema)))) + (doc (io.github.cl-sdk.xml:parse-xml "-5"))) + (signals io.github.cl-sdk.xsd:xsd-validation-error (io.github.cl-sdk.xsd:validate-xml doc schema)))) ;;; ── XSD: xsd-validation-error condition ───────────────────────────────── (test xsd-validation-error-has-message "xsd-validation-error condition carries a message string." (handler-case - (cl-xsd:validate-xml (cl-xml:parse-xml "") - (cl-xsd:load-xsd +simple-xsd+)) - (cl-xsd:xsd-validation-error (e) - (is (stringp (cl-xsd:xsd-validation-error-message e)))))) + (io.github.cl-sdk.xsd:validate-xml (io.github.cl-sdk.xml:parse-xml "") + (io.github.cl-sdk.xsd:load-xsd +simple-xsd+)) + (io.github.cl-sdk.xsd:xsd-validation-error (e) + (is (stringp (io.github.cl-sdk.xsd:xsd-validation-error-message e)))))) (test xsd-validation-error-path-is-set-for-nested-failure "xsd-validation-error carries a non-nil path for a failure inside a nested element." - (let* ((schema (cl-xsd:load-xsd + (let* ((schema (io.github.cl-sdk.xsd:load-xsd " @@ -463,61 +463,61 @@ ")) - (doc (cl-xml:parse-xml "bad"))) - (handler-case (cl-xsd:validate-xml doc schema) - (cl-xsd:xsd-validation-error (e) - (is (not (null (cl-xsd:xsd-validation-error-path e)))))))) + (doc (io.github.cl-sdk.xml:parse-xml "bad"))) + (handler-case (io.github.cl-sdk.xsd:validate-xml doc schema) + (io.github.cl-sdk.xsd:xsd-validation-error (e) + (is (not (null (io.github.cl-sdk.xsd:xsd-validation-error-path e)))))))) ;;; ── XSD: built-in type validators ──────────────────────────────────────── (test builtin-integer-valid "xs:integer accepts digit strings and values with a leading sign." - (let ((schema (cl-xsd:load-xsd + (let ((schema (io.github.cl-sdk.xsd:load-xsd " "))) - (is (cl-xsd:validate-xml (cl-xml:parse-xml "0") schema)) - (is (cl-xsd:validate-xml (cl-xml:parse-xml "-42") schema)) - (is (cl-xsd:validate-xml (cl-xml:parse-xml "+999") schema)))) + (is (io.github.cl-sdk.xsd:validate-xml (io.github.cl-sdk.xml:parse-xml "0") schema)) + (is (io.github.cl-sdk.xsd:validate-xml (io.github.cl-sdk.xml:parse-xml "-42") schema)) + (is (io.github.cl-sdk.xsd:validate-xml (io.github.cl-sdk.xml:parse-xml "+999") schema)))) (test builtin-boolean-valid-values "xs:boolean accepts true, false, 1, and 0." - (let ((schema (cl-xsd:load-xsd + (let ((schema (io.github.cl-sdk.xsd:load-xsd " "))) (dolist (v '("true" "false" "1" "0")) - (is (cl-xsd:validate-xml - (cl-xml:parse-xml (format nil "~a" v)) schema))))) + (is (io.github.cl-sdk.xsd:validate-xml + (io.github.cl-sdk.xml:parse-xml (format nil "~a" v)) schema))))) (test builtin-decimal-valid "xs:decimal accepts decimal number strings." - (let ((schema (cl-xsd:load-xsd + (let ((schema (io.github.cl-sdk.xsd:load-xsd " "))) - (is (cl-xsd:validate-xml (cl-xml:parse-xml "3.14") schema)) - (is (cl-xsd:validate-xml (cl-xml:parse-xml "-0.5") schema)) - (is (cl-xsd:validate-xml (cl-xml:parse-xml "42") schema)))) + (is (io.github.cl-sdk.xsd:validate-xml (io.github.cl-sdk.xml:parse-xml "3.14") schema)) + (is (io.github.cl-sdk.xsd:validate-xml (io.github.cl-sdk.xml:parse-xml "-0.5") schema)) + (is (io.github.cl-sdk.xsd:validate-xml (io.github.cl-sdk.xml:parse-xml "42") schema)))) (test builtin-date-valid "xs:date accepts YYYY-MM-DD formatted strings." - (let ((schema (cl-xsd:load-xsd + (let ((schema (io.github.cl-sdk.xsd:load-xsd " "))) - (is (cl-xsd:validate-xml (cl-xml:parse-xml "
2024-01-15
") schema)))) + (is (io.github.cl-sdk.xsd:validate-xml (io.github.cl-sdk.xml:parse-xml "
2024-01-15
") schema)))) (test builtin-positive-integer-rejects-zero "xs:positiveInteger rejects zero." - (let ((schema (cl-xsd:load-xsd + (let ((schema (io.github.cl-sdk.xsd:load-xsd " "))) - (signals cl-xsd:xsd-validation-error - (cl-xsd:validate-xml (cl-xml:parse-xml "0") schema)))) + (signals io.github.cl-sdk.xsd:xsd-validation-error + (io.github.cl-sdk.xsd:validate-xml (io.github.cl-sdk.xml:parse-xml "0") schema)))) (test builtin-byte-range "xs:byte rejects a value outside [-128, 127]." - (let ((schema (cl-xsd:load-xsd + (let ((schema (io.github.cl-sdk.xsd:load-xsd " "))) - (is (cl-xsd:validate-xml (cl-xml:parse-xml "127") schema)) - (signals cl-xsd:xsd-validation-error - (cl-xsd:validate-xml (cl-xml:parse-xml "128") schema)))) + (is (io.github.cl-sdk.xsd:validate-xml (io.github.cl-sdk.xml:parse-xml "127") schema)) + (signals io.github.cl-sdk.xsd:xsd-validation-error + (io.github.cl-sdk.xsd:validate-xml (io.github.cl-sdk.xml:parse-xml "128") schema)))) diff --git a/t/package.lisp b/t/package.lisp index 7623aab..2a2896a 100644 --- a/t/package.lisp +++ b/t/package.lisp @@ -1,3 +1,3 @@ -(defpackage #:cl-xml.test +(defpackage #:io.github.cl-sdk.xml.test (:use #:cl #:fiveam #:trivial-gray-streams) (:export #:cl-xml-suite)) diff --git a/tests-runner.lisp b/tests-runner.lisp index 7b0c38a..1b4a7f4 100644 --- a/tests-runner.lisp +++ b/tests-runner.lisp @@ -4,7 +4,7 @@ (asdf:initialize-source-registry) -(ql:quickload :cl-xml.test) +(ql:quickload :io.github.cl-sdk.xml.test) (setf *debugger-hook* (lambda (c h) diff --git a/tokeniser.lisp b/tokeniser.lisp index 42b98aa..3fd51f2 100644 --- a/tokeniser.lisp +++ b/tokeniser.lisp @@ -1,4 +1,4 @@ -(in-package #:cl-xml) +(in-package #:io.github.cl-sdk.xml) ;;; Comment parsing — XML 1.0 §2.5 diff --git a/wsdl-package.lisp b/wsdl-package.lisp index 2da1dbf..453a7c4 100644 --- a/wsdl-package.lisp +++ b/wsdl-package.lisp @@ -1,5 +1,5 @@ -(defpackage #:cl-wsdl - (:use #:cl #:cl-xml) +(defpackage #:io.github.cl-sdk.wsdl + (:use #:cl #:io.github.cl-sdk.xml) (:export ;; WSDL 2.0 namespace constant #:+wsdl-2.0-namespace+ diff --git a/wsdl.lisp b/wsdl.lisp index b25cd01..8e33549 100644 --- a/wsdl.lisp +++ b/wsdl.lisp @@ -1,4 +1,4 @@ -(in-package #:cl-wsdl) +(in-package #:io.github.cl-sdk.wsdl) ;;;; WSDL (Web Services Description Language) — 2.0 implementation ;;;; diff --git a/xsd-package.lisp b/xsd-package.lisp index 0472e46..1825613 100644 --- a/xsd-package.lisp +++ b/xsd-package.lisp @@ -1,5 +1,5 @@ -(defpackage #:cl-xsd - (:use #:cl #:cl-xml) +(defpackage #:io.github.cl-sdk.xsd + (:use #:cl #:io.github.cl-sdk.xml) (:export ;; XSD schema structures #:xsd-schema diff --git a/xsd.lisp b/xsd.lisp index a88ea62..01a9d8e 100644 --- a/xsd.lisp +++ b/xsd.lisp @@ -1,4 +1,4 @@ -(in-package #:cl-xsd) +(in-package #:io.github.cl-sdk.xsd) ;;;; XSD (XML Schema Definition) — subset implementation ;;;;