From ddb83b1fb2d305e0c06fc067d82d6bab5458b0fd Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Fri, 30 Oct 2009 20:52:07 +0100 Subject: Add third-party XML processing libraries. Ignore-this: 5ca28497555bf944858ca2f58bc8a62b darcs-hash:a0b0f9baa7c9b1259e755435db1fb17123630a6c --- third-party/s-xml/test/ant-build-file.xml | 252 ++++++++++++++++++++++ third-party/s-xml/test/plist.xml | 38 ++++ third-party/s-xml/test/simple.xml | 5 + third-party/s-xml/test/test-lxml-dom.lisp | 86 ++++++++ third-party/s-xml/test/test-sxml-dom.lisp | 76 +++++++ third-party/s-xml/test/test-xml-struct-dom.lisp | 84 ++++++++ third-party/s-xml/test/test-xml.lisp | 86 ++++++++ third-party/s-xml/test/xhtml-page.xml | 271 ++++++++++++++++++++++++ 8 files changed, 898 insertions(+) create mode 100644 third-party/s-xml/test/ant-build-file.xml create mode 100644 third-party/s-xml/test/plist.xml create mode 100644 third-party/s-xml/test/simple.xml create mode 100644 third-party/s-xml/test/test-lxml-dom.lisp create mode 100644 third-party/s-xml/test/test-sxml-dom.lisp create mode 100644 third-party/s-xml/test/test-xml-struct-dom.lisp create mode 100644 third-party/s-xml/test/test-xml.lisp create mode 100644 third-party/s-xml/test/xhtml-page.xml (limited to 'third-party/s-xml/test') diff --git a/third-party/s-xml/test/ant-build-file.xml b/third-party/s-xml/test/ant-build-file.xml new file mode 100644 index 0000000..8aef4cc --- /dev/null +++ b/third-party/s-xml/test/ant-build-file.xml @@ -0,0 +1,252 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third-party/s-xml/test/plist.xml b/third-party/s-xml/test/plist.xml new file mode 100644 index 0000000..910e632 --- /dev/null +++ b/third-party/s-xml/test/plist.xml @@ -0,0 +1,38 @@ + + + + + AppleDockIconEnabled + + AppleNavServices:GetFile:0:Path + file://localhost/Users/sven/Pictures/ + AppleNavServices:GetFile:0:Position + + AOUBXw== + + AppleNavServices:GetFile:0:Size + + AAAAAAFeAcI= + + AppleNavServices:PutFile:0:Disclosure + + AQ== + + AppleNavServices:PutFile:0:Path + file://localhost/Users/sven/Desktop/ + AppleNavServices:PutFile:0:Position + + AUIBVQ== + + AppleNavServices:PutFile:0:Size + + AAAAAACkAdY= + + AppleSavePanelExpanded + YES + NSDefaultOpenDirectory + ~/Desktop + NSNoBigString + + + diff --git a/third-party/s-xml/test/simple.xml b/third-party/s-xml/test/simple.xml new file mode 100644 index 0000000..08ad942 --- /dev/null +++ b/third-party/s-xml/test/simple.xml @@ -0,0 +1,5 @@ + + + + Hello World! + diff --git a/third-party/s-xml/test/test-lxml-dom.lisp b/third-party/s-xml/test/test-lxml-dom.lisp new file mode 100644 index 0000000..f7aadbe --- /dev/null +++ b/third-party/s-xml/test/test-lxml-dom.lisp @@ -0,0 +1,86 @@ +;;;; -*- mode: lisp -*- +;;;; +;;;; $Id: test-lxml-dom.lisp,v 1.3 2008-02-15 13:54:57 scaekenberghe Exp $ +;;;; +;;;; Unit and functional tests for lxml-dom.lisp +;;;; +;;;; Copyright (C) 2002, 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) + +(assert + (equal (with-input-from-string (stream " ") + (parse-xml stream :output-type :lxml)) + :|foo|)) + +(assert + (equal (parse-xml-string "this is some text" + :output-type :lxml) + '(:|tag1| + ((:|tag2| :|att1| "one")) + "this is some text"))) + +(assert + (equal (parse-xml-string "<foo>" + :output-type :lxml) + '(:TAG ""))) + +(assert + (equal (parse-xml-string + "

This is some bold text, with a leading & trailing space

" + :output-type :lxml) + '(:p + ((:index :item "one")) + " This is some " + (:b "bold") + " text, with a leading & trailing space "))) + +(assert + (consp (parse-xml-file (merge-pathnames "test/xhtml-page.xml" + (asdf:component-pathname + (asdf:find-system :s-xml.test))) + :output-type :lxml))) + +(assert + (consp (parse-xml-file (merge-pathnames "test/ant-build-file.xml" + (asdf:component-pathname + (asdf:find-system :s-xml.test))) + :output-type :lxml))) + +(assert + (consp (parse-xml-file (merge-pathnames "test/plist.xml" + (asdf:component-pathname + (asdf:find-system :s-xml.test))) + :output-type :lxml))) + +(assert + (string-equal (print-xml-string :|foo| :input-type :lxml) + "")) + +(assert + (string-equal (print-xml-string '((:|foo| :|bar| "1")) :input-type :lxml) + "")) + +(assert + (string-equal (print-xml-string '(:foo "some text") :input-type :lxml) + "some text")) + +(assert + (string-equal (print-xml-string '(:|foo| :|bar|) :input-type :lxml) + "")) + +(assert (string-equal (second + (with-input-from-string (stream "Hello, world!]]>") + (parse-xml stream :output-type :lxml))) + "Hello, world!")) + +(assert (string-equal (second + (with-input-from-string (stream "Hello, < world!]]>") + (parse-xml stream :output-type :lxml))) + "Hello, < world!")) + +;;;; eof diff --git a/third-party/s-xml/test/test-sxml-dom.lisp b/third-party/s-xml/test/test-sxml-dom.lisp new file mode 100644 index 0000000..41cf72f --- /dev/null +++ b/third-party/s-xml/test/test-sxml-dom.lisp @@ -0,0 +1,76 @@ +;;;; -*- mode: lisp -*- +;;;; +;;;; $Id: test-sxml-dom.lisp,v 1.2 2008-02-15 13:54:57 scaekenberghe Exp $ +;;;; +;;;; Unit and functional tests for sxml-dom.lisp +;;;; +;;;; Copyright (C) 2002, 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) + +(assert + (equal (with-input-from-string (stream " ") + (parse-xml stream :output-type :sxml)) + '(:|foo|))) + +(assert + (equal (parse-xml-string "this is some text" + :output-type :sxml) + '(:|tag1| + (:|tag2| (:@ (:|att1| "one"))) + "this is some text"))) + +(assert + (equal (parse-xml-string "<foo>" + :output-type :sxml) + '(:TAG ""))) + +(assert + (equal (parse-xml-string + "

This is some bold text, with a leading & trailing space

" + :output-type :sxml) + '(:p + (:index (:@ (:item "one"))) + " This is some " + (:b "bold") + " text, with a leading & trailing space "))) + +(assert + (consp (parse-xml-file (merge-pathnames "test/xhtml-page.xml" + (asdf:component-pathname + (asdf:find-system :s-xml.test))) + :output-type :sxml))) + +(assert + (consp (parse-xml-file (merge-pathnames "test/ant-build-file.xml" + (asdf:component-pathname + (asdf:find-system :s-xml.test))) + :output-type :sxml))) + +(assert + (consp (parse-xml-file (merge-pathnames "test/plist.xml" + (asdf:component-pathname + (asdf:find-system :s-xml.test))) + :output-type :sxml))) + +(assert + (string-equal (print-xml-string '(:|foo|) :input-type :sxml) + "")) + +(assert + (string-equal (print-xml-string '(:|foo| (:@ (:|bar| "1"))) :input-type :sxml) + "")) + +(assert + (string-equal (print-xml-string '(:foo "some text") :input-type :sxml) + "some text")) + +(assert + (string-equal (print-xml-string '(:|foo| (:|bar|)) :input-type :sxml) + "")) + +;;;; eof \ No newline at end of file diff --git a/third-party/s-xml/test/test-xml-struct-dom.lisp b/third-party/s-xml/test/test-xml-struct-dom.lisp new file mode 100644 index 0000000..607402b --- /dev/null +++ b/third-party/s-xml/test/test-xml-struct-dom.lisp @@ -0,0 +1,84 @@ +;;;; -*- mode: lisp -*- +;;;; +;;;; $Id: test-xml-struct-dom.lisp,v 1.3 2008-02-15 13:54:57 scaekenberghe Exp $ +;;;; +;;;; Unit and functional tests for xml-struct-dom.lisp +;;;; +;;;; Copyright (C) 2002, 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) + +(assert + (xml-equal (with-input-from-string (stream " ") + (parse-xml stream :output-type :xml-struct)) + (make-xml-element :name :|foo|))) + +(assert + (xml-equal (parse-xml-string "this is some text" + :output-type :xml-struct) + (make-xml-element :name :|tag1| + :children (list (make-xml-element :name :|tag2| + :attributes '((:|att1| . "one"))) + "this is some text")))) + +(assert + (xml-equal (parse-xml-string "<foo>" + :output-type :xml-struct) + (make-xml-element :name :|tag| + :children (list "")))) + +(assert + (xml-equal (parse-xml-string + "

This is some bold text, with a leading & trailing space

" + :output-type :xml-struct) + (make-xml-element :name :p + :children (list (make-xml-element :name :index + :attributes '((:item . "one"))) + " This is some " + (make-xml-element :name :b + :children (list "bold")) + " text, with a leading & trailing space ")))) + +(assert + (xml-element-p (parse-xml-file (merge-pathnames "test/xhtml-page.xml" + (asdf:component-pathname + (asdf:find-system :s-xml.test))) + :output-type :xml-struct))) + +(assert + (xml-element-p (parse-xml-file (merge-pathnames "test/ant-build-file.xml" + (asdf:component-pathname + (asdf:find-system :s-xml.test))) + :output-type :xml-struct))) + +(assert + (xml-element-p (parse-xml-file (merge-pathnames "test/plist.xml" + (asdf:component-pathname + (asdf:find-system :s-xml.test))) + :output-type :xml-struct))) + +(assert + (string-equal (print-xml-string (make-xml-element :name "foo") + :input-type :xml-struct) + "")) + +(assert + (string-equal (print-xml-string (make-xml-element :name "foo" :attributes '((:|bar| . "1"))) + :input-type :xml-struct) + "")) + +(assert + (string-equal (print-xml-string (make-xml-element :name "foo" :children (list "some text")) + :input-type :xml-struct) + "some text")) + +(assert + (string-equal (print-xml-string (make-xml-element :name "foo" :children (list (make-xml-element :name "bar"))) + :input-type :xml-struct) + "")) + +;;;; eof \ No newline at end of file diff --git a/third-party/s-xml/test/test-xml.lisp b/third-party/s-xml/test/test-xml.lisp new file mode 100644 index 0000000..6d636a8 --- /dev/null +++ b/third-party/s-xml/test/test-xml.lisp @@ -0,0 +1,86 @@ +;;;; -*- mode: lisp -*- +;;;; +;;;; $Id: test-xml.lisp,v 1.4 2006-01-19 20:00:06 scaekenberghe Exp $ +;;;; +;;;; Unit and functional tests for xml.lisp +;;;; +;;;; Copyright (C) 2002, 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) + +(assert + (whitespace-char-p (character " "))) + +(assert + (whitespace-char-p (character " "))) + +(assert + (whitespace-char-p (code-char 10))) + +(assert + (whitespace-char-p (code-char 13))) + +(assert + (not (whitespace-char-p #\A))) + +(assert + (char= (with-input-from-string (stream " ABC") + (skip-whitespace stream)) + #\A)) + +(assert + (char= (with-input-from-string (stream "ABC") + (skip-whitespace stream)) + #\A)) + +(assert + (string-equal (with-output-to-string (stream) (print-string-xml "" stream)) + "<foo>")) + +(assert + (string-equal (with-output-to-string (stream) (print-string-xml "' '" stream)) + "' '")) + +(assert + (let ((string (map 'string #'identity '(#\return #\tab #\newline)))) + (string-equal (with-output-to-string (stream) (print-string-xml string stream)) + string))) + +(defun simple-echo-xml (in out) + (start-parse-xml + in + (make-instance 'xml-parser-state + :new-element-hook #'(lambda (name attributes seed) + (declare (ignore seed)) + (format out "<~a~:{ ~a='~a'~}>" + name + (mapcar #'(lambda (p) (list (car p) (cdr p))) + (reverse attributes)))) + :finish-element-hook #'(lambda (name attributes parent-seed seed) + (declare (ignore attributes parent-seed seed)) + (format out "" name)) + :text-hook #'(lambda (string seed) + (declare (ignore seed)) + (princ string out))))) + +(defun simple-echo-xml-string (string) + (with-input-from-string (in string) + (with-output-to-string (out) + (simple-echo-xml in out)))) + +(dolist (*ignore-namespaces* '(nil t)) + (assert + (let ((xml "TextMore text!")) + (equal (simple-echo-xml-string xml) + xml)))) + +(assert + (let ((xml "

")) + (equal (simple-echo-xml-string xml) + xml))) + +;;;; eof \ No newline at end of file diff --git a/third-party/s-xml/test/xhtml-page.xml b/third-party/s-xml/test/xhtml-page.xml new file mode 100644 index 0000000..79f3ae3 --- /dev/null +++ b/third-party/s-xml/test/xhtml-page.xml @@ -0,0 +1,271 @@ + + + + + +XHTML Tutorial + + + + + + + + + + + + + + + + + + +
+
+HOME
+
+XHTML Tutorial
+XHTML HOME
+XHTML Introduction
+XHTML Why
+XHTML v HTML
+XHTML Syntax
+XHTML DTD
+XHTML HowTo
+XHTML Validation
+
+Quiz +
+XHTML Quiz
+
+References +
+XHTML Tag List
+XHTML Attributes
+XHTML Events
+
+ + + + +
+
+ +Corel XMetal 3 + + +
Please Visit Our Sponsors ! +
+

XHTML Tutorial

+Previous +Next + +
+ +

XHTML Tutorial

+

XHTML is the next generation of HTML! In our XHTML tutorial you will learn the difference between HTML and XHTML, and how to use XHTML in your future +applications. You will also see how we converted this Web site into XHTML. Start Learning +XHTML!

+ +

XHTML Quiz Test

+

Test your XHTML skills at W3Schools! Start XHTML +Quiz! 

+ +

XHTML References

+

At W3Schools you will find complete XHTML references about tags, attributes +and events. XHTML 1.0 References.

+
+

Table of Contents

+

Introduction to XHTML
+This chapter gives a brief introduction to XHTML and explains what XHTML is.

+

XHTML - Why?
+This chapter explains why we needed a new language like XHTML.

+

Differences between XHTML and HTML
+This chapter explains the main differences in syntax between XHTML and HTML.

+

XHTML Syntax 
+This chapter explains the basic syntax of XHTML.

+

XHTML DTD 
+This chapter explains the three different XHTML Document Type Definitions.

+

XHTML HowTo
+This chapter explains how this web site was converted from HTML to XHTML.

+

XHTML Validation
+This chapter explains how to validate XHTML documents.

+
+

XHTML References

+

XHTML 1.0 Reference
+
Our complete XHTML 1.0 reference is an alphabetical list of all XHTML tags +with lots of  examples and tips.

+

XHTML 1.0 Standard Attributes
+
All the tags have attributes. The attributes for each tag are listed in the +examples in the "XHTML 1.0 Reference" page. The attributes listed here +are the core and language attributes all the tags has as standard (with +few exceptions). This reference describes the attributes, and shows possible +values for each.

+

XHTML 1.0 Event Attributes
+
All the standard event attributes of the tags. This reference describes the attributes, and shows possible +values for each.

+
+Previous +Next + + +
+

+Jump to: Top of Page +or HOME or + +Printer Friendly +Printer friendly page +

+
+ +

Search W3Schools:

+
+ + + +
+ +
+

What Others Say About Us

+

Does the world know about us? Check out these places:

+

+Dogpile +Alta Vista +MSN +Google +Excite +Lycos +Yahoo +Ask Jeeves +

+
+

We Help You For Free. You Can Help Us!

+ + +
+

+W3Schools is for training only. We do not warrant its correctness or its fitness for use. +The risk of using it remains entirely with the user. While using this site, you agree to have read and accepted our +terms of use and +privacy policy.

+

+Copyright 1999-2002 by Refsnes Data. All Rights Reserved

+
+ + + + +
+ +Validate + +How we converted to XHTML + + +Validate +
+
+
+ + +

+ +Web charting +
+Web based charting
for ASP.NET
+ +

+
+ + +
+
+ +Your own Web Site?
+
Read W3Schools +
Hosting Tutorial
+
+
+
+ + +
+
+$15 Domain Name
Registration
Save $20 / year!
+
+
+
+ + + + +
+
+SELECTED LINKS +

+University Online
+Master Degree
Bachelor Degree
+

+Web Software +

+The Future of
Web Development
+

+Jobs and Careers +

+Web Security +
+Web Statistics +
+Web Standards +

+
+ + + + +
+
+ +Recommended
+Reading:


+ + +HTML XHTML + + +

+ + + +
+
+PARTNERS
+
+W3Schools
+TopXML
+VisualBuilder
+XMLPitstop
+DevelopersDex
+DevGuru
+Programmers Heaven
+The Code Project
+Tek Tips Forum
+ZVON.ORG
+TopXML Search
+
+
+
+ + + -- cgit v1.2.3