Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 16 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -22,7 +20,7 @@ A Common Lisp XML reader, writer, and custom parser.

```lisp
(defvar *doc*
(cl-xml:parse-xml "<?xml version=\"1.0\"?>
(io.github.cl-sdk.xml:parse-xml "<?xml version=\"1.0\"?>
<!-- preamble -->
<root>
<item id=\"1\">hello &amp; world</item>
Expand All @@ -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 "<root><child /></root>" :handler (make-instance 'my-handler))
(io.github.cl-sdk.xml:parse-xml "<root><child /></root>" :handler (make-instance 'my-handler))
;; open root nil
;; open child nil
;; close child
Expand Down Expand Up @@ -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*)
;; => (#<xml-pi "xml" …> #<xml-comment " preamble ">)

(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"
```

Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion api.lisp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(in-package #:cl-xml)
(in-package #:io.github.cl-sdk.xml)

;;; Event-to-handler bridge

Expand Down
2 changes: 1 addition & 1 deletion chars.lisp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(in-package #:cl-xml)
(in-package #:io.github.cl-sdk.xml)

;;; Character classification — XML 1.0 §2.3

Expand Down
2 changes: 1 addition & 1 deletion dom-builder.lisp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(in-package #:cl-xml)
(in-package #:io.github.cl-sdk.xml)

;;; Default DOM-building SAX handler

Expand Down
2 changes: 1 addition & 1 deletion events.lisp
Original file line number Diff line number Diff line change
@@ -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.).
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
description = "cl-xml";
description = "io.github.cl-sdk.xml";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-25.11";
Expand Down
6 changes: 3 additions & 3 deletions cl-soap.asd → io.github.cl-sdk.soap.asd
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
(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 <dias.h.bruno@gmail.com>"
:maintainer "Bruno Dias <dias.h.bruno@gmail.com>"
: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)
:depends-on (#:io.github.cl-sdk.xml)
:components ((:file "soap-package")
(:file "soap" :depends-on ("soap-package"))))
6 changes: 3 additions & 3 deletions cl-soap.test.asd → io.github.cl-sdk.soap.test.asd
Original file line number Diff line number Diff line change
@@ -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 <dias.h.bruno@gmail.com>"
: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")
Expand Down
6 changes: 3 additions & 3 deletions cl-wsdl.asd → io.github.cl-sdk.wsdl.asd
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
(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 <dias.h.bruno@gmail.com>"
:maintainer "Bruno Dias <dias.h.bruno@gmail.com>"
: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)
:depends-on (#:io.github.cl-sdk.xml)
:components ((:file "wsdl-package")
(:file "wsdl" :depends-on ("wsdl-package"))))
6 changes: 3 additions & 3 deletions cl-wsdl.test.asd → io.github.cl-sdk.wsdl.test.asd
Original file line number Diff line number Diff line change
@@ -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 <dias.h.bruno@gmail.com>"
: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")
Expand Down
2 changes: 1 addition & 1 deletion cl-xml.asd → io.github.cl-sdk.xml.asd
Original file line number Diff line number Diff line change
@@ -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"))
Expand Down
6 changes: 3 additions & 3 deletions cl-xml.test.asd → io.github.cl-sdk.xml.test.asd
Original file line number Diff line number Diff line change
@@ -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 <dias.h.bruno@gmail.com>"
: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")
Expand Down
6 changes: 3 additions & 3 deletions cl-xsd.asd → io.github.cl-sdk.xsd.asd
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
(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 <dias.h.bruno@gmail.com>"
:maintainer "Bruno Dias <dias.h.bruno@gmail.com>"
: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)
:depends-on (#:io.github.cl-sdk.xml)
:components ((:file "xsd-package")
(:file "xsd" :depends-on ("xsd-package"))))
6 changes: 3 additions & 3 deletions cl-xsd.test.asd → io.github.cl-sdk.xsd.test.asd
Original file line number Diff line number Diff line change
@@ -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 <dias.h.bruno@gmail.com>"
: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")
Expand Down
2 changes: 1 addition & 1 deletion namespace.lisp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(in-package #:cl-xml)
(in-package #:io.github.cl-sdk.xml)

;;; Namespace resolution — Namespaces in XML 1.0

Expand Down
2 changes: 1 addition & 1 deletion package.lisp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defpackage #:cl-xml
(defpackage #:io.github.cl-sdk.xml
(:use #:cl #:trivial-gray-streams)
(:export
;; Document
Expand Down
2 changes: 1 addition & 1 deletion sax.lisp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(in-package #:cl-xml)
(in-package #:io.github.cl-sdk.xml)

;;; SAX handler protocol — event-driven parsing interface

Expand Down
4 changes: 2 additions & 2 deletions soap-package.lisp
Original file line number Diff line number Diff line change
@@ -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+
Expand Down
2 changes: 1 addition & 1 deletion soap.lisp
Original file line number Diff line number Diff line change
@@ -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
;;;;
Expand Down
2 changes: 1 addition & 1 deletion structures.lisp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(in-package #:cl-xml)
(in-package #:io.github.cl-sdk.xml)

;;; Data structures

Expand Down
4 changes: 2 additions & 2 deletions t/cl-soap-package.lisp
Original file line number Diff line number Diff line change
@@ -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))
Loading
Loading