about summary refs log tree commit diff
path: root/third_party/lisp/s-xml/src/sxml-dom.lisp
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-12-15T21·51+0300
committertazjin <mail@tazj.in>2021-12-15T22·09+0000
commitdb742c2035f9cfcf496b4a9b1640d1cf623a2c0f (patch)
treea9bcaf6632d910ae68185319cc5bcd408667a8d9 /third_party/lisp/s-xml/src/sxml-dom.lisp
parent75ca24c60a57ab894da4d404755b8b4094284ad8 (diff)
chore(3p/lisp): use nixpkgs sources for s-xml r/3258
this one was a little more difficult because it needs a patch, there's
something wonky with the definition order

fwiw, the upstream cvs repository ... server errors.

Change-Id: I2d99359edec36b578389f1be1fcf077743c29c4e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4342
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Diffstat (limited to 'third_party/lisp/s-xml/src/sxml-dom.lisp')
-rw-r--r--third_party/lisp/s-xml/src/sxml-dom.lisp76
1 files changed, 0 insertions, 76 deletions
diff --git a/third_party/lisp/s-xml/src/sxml-dom.lisp b/third_party/lisp/s-xml/src/sxml-dom.lisp
deleted file mode 100644
index c9e0f9e0db4e..000000000000
--- a/third_party/lisp/s-xml/src/sxml-dom.lisp
+++ /dev/null
@@ -1,76 +0,0 @@
-;;;; -*- mode: lisp -*-
-;;;;
-;;;; $Id: sxml-dom.lisp,v 1.4 2005/09/20 09:57:48 scaekenberghe Exp $
-;;;;
-;;;; LXML implementation of the generic DOM parser and printer.
-;;;;
-;;;; Copyright (C) 2003, 2004 Sven Van Caekenberghe, Beta Nine BVBA.
-;;;;
-;;;; You are granted the rights to distribute and use this software
-;;;; as governed by the terms of the Lisp Lesser General Public License
-;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
-
-(in-package :s-xml)
-
-;;; the sxml hooks to generate sxml
-
-(defun sxml-new-element-hook (name attributes seed)
-  (declare (ignore name attributes seed))
-  '())
-
-(defun sxml-finish-element-hook (name attributes parent-seed seed)
-  (let ((xml-element (append (list name)
-			     (when attributes
-			       (list (let (list)
-				       (dolist (attribute attributes (cons :@ list))
-					 (push (list (car attribute) (cdr attribute)) list)))))
-			     (nreverse seed))))
-    (cons xml-element parent-seed)))
-
-(defun sxml-text-hook (string seed)
-  (cons string seed))
-
-;;; the standard DOM interfaces
-
-(defmethod parse-xml-dom (stream (output-type (eql :sxml)))
-  (car (start-parse-xml stream
-			(make-instance 'xml-parser-state
-				       :new-element-hook #'sxml-new-element-hook
-				       :finish-element-hook #'sxml-finish-element-hook
-				       :text-hook #'sxml-text-hook))))
-
-(defmethod print-xml-dom (dom (input-type (eql :sxml)) stream pretty level)
-  (declare (special *namespaces*))
-  (cond ((stringp dom) (print-string-xml dom stream))
-	((consp dom)
-	 (let ((tag (first dom))
-	       attributes
-	       children)
-	   (if (and (consp (second dom)) (eq (first (second dom)) :@))
-	       (setf attributes (rest (second dom))
-		     children (rest (rest dom)))
-	     (setf children (rest dom)))
-           (let ((*namespaces* (extend-namespaces (loop :for (name value) :in attributes 
-                                                        :collect (cons name value))
-                                                  *namespaces*)))
-             (write-char #\< stream)
-             (print-identifier tag stream)
-             (loop :for (name value) :in attributes
-                   :do (print-attribute name value stream))
-             (if children
-                 (progn
-                   (write-char #\> stream)
-                   (if (and (= (length children) 1) (stringp (first children)))
-                       (print-string-xml (first children) stream)
-                     (progn
-                       (dolist (child children)
-                         (when pretty (print-spaces (* 2 level) stream))
-                         (if (stringp child)
-                             (print-string-xml child stream)
-                           (print-xml-dom child input-type stream pretty (1+ level))))
-                       (when pretty (print-spaces (* 2 (1- level)) stream))))
-                   (print-closing-tag tag stream))
-               (write-string "/>" stream)))))
-	(t (error "Input not recognized as SXML ~s" dom))))
-
-;;;; eof