about summary refs log tree commit diff
path: root/third_party/lisp/s-xml/test
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/lisp/s-xml/test')
-rw-r--r--third_party/lisp/s-xml/test/ant-build-file.xml252
-rw-r--r--third_party/lisp/s-xml/test/plist.xml38
-rw-r--r--third_party/lisp/s-xml/test/simple.xml5
-rw-r--r--third_party/lisp/s-xml/test/test-lxml-dom.lisp86
-rw-r--r--third_party/lisp/s-xml/test/test-sxml-dom.lisp76
-rw-r--r--third_party/lisp/s-xml/test/test-xml-struct-dom.lisp84
-rw-r--r--third_party/lisp/s-xml/test/test-xml.lisp86
-rw-r--r--third_party/lisp/s-xml/test/xhtml-page.xml271
8 files changed, 898 insertions, 0 deletions
diff --git a/third_party/lisp/s-xml/test/ant-build-file.xml b/third_party/lisp/s-xml/test/ant-build-file.xml
new file mode 100644
index 000000000000..91d78707b8a1
--- /dev/null
+++ b/third_party/lisp/s-xml/test/ant-build-file.xml
@@ -0,0 +1,252 @@
+<!-- $Id: ant-build-file.xml,v 1.1 2003/03/18 08:22:09 sven Exp $ -->
+<!-- Ant 1.2 build file -->
+
+<project name="Libretto" default="compile" basedir=".">
+
+  <!-- set global properties for this build -->
+  <property name="src" value="${basedir}/src" />
+  <property name="rsrc" value="${basedir}/rsrc" />
+  <property name="build" value="${basedir}/bin" />
+  <property name="api" value="${basedir}/api" />
+  <property name="lib" value="${basedir}/lib" />
+  <property name="junit" value="${basedir}/junit" />
+  <property name="rsrc" value="${basedir}/rsrc" />
+  
+  <target name="prepare">
+    <!-- Create the time stamp -->
+    <tstamp/>
+    <!-- Create the build directory structure used by compile -->
+    <mkdir dir="${build}" />
+    <mkdir dir="${api}" />
+    <mkdir dir="${junit}" />
+    <copy file="${rsrc}/build/build.version" tofile="${build}/build.properties"/>
+    <replace file="${build}/build.properties" token="@@@BUILD_ID@@@" value="${DSTAMP}-${TSTAMP}"/>
+  </target>
+
+  <target name="compile" depends="copy-rsrc">
+    <!-- Compile the java code from ${src} into ${build} -->
+    <javac srcdir="${src}" destdir="${build}" debug="on">
+      <classpath>
+        <fileset dir="${lib}">
+          <include name="log4j-core.jar" />
+          <include name="jaxp.jar" />
+          <include name="crimson.jar" />
+          <include name="jdom.jar" />
+          <include name="beanshell.jar" />
+        </fileset>
+      </classpath>
+    </javac>
+  </target>
+
+  <target name="compile-junit" depends="copy-rsrc">
+    <!-- Compile the java code from ${src} into ${build} -->
+    <javac srcdir="${junit}" destdir="${build}" debug="on">
+      <classpath>
+        <fileset dir="${lib}">
+          <include name="*.jar" />
+        </fileset>
+      </classpath>
+    </javac>
+  </target>
+
+  <target name="copy-rsrc" depends="prepare">
+    <!-- Copy various resource files into ${build} -->
+    <copy todir="${build}">
+      <fileset
+        dir="${basedir}"
+        includes="images/*.gif, images/*.jpg" />
+    </copy>
+    <copy todir="${build}">
+      <fileset
+        dir="${src}"
+        includes="be/beta9/libretto/data/*.txt" />
+    </copy>
+    <copy todir="${build}">
+      <fileset
+        dir="${rsrc}/log4j"
+        includes="log4j.properties" />
+    </copy>
+  </target>
+  
+  <target name="c-header" depends="compile">
+      <javah destdir="${rsrc}/VC_source" class="be.beta9.libretto.io.ParallelPort">
+         <classpath>
+            <pathelement location="${build}" />
+         </classpath>
+      </javah>
+  </target>
+  
+  <target name="test-parport" depends="compile">
+      <java
+      classname="be.beta9.libretto.io.ParallelPortWriter"
+      fork="yes">
+      <classpath>
+        <pathelement location="${build}" />
+        <fileset dir="${lib}">
+          <include name="*.jar" />
+        </fileset>
+      </classpath>
+    </java>
+  </target>
+  
+  <target name="jar-simple" depends="compile">
+    <!-- Put everything in ${build} into the a jar file -->
+    <jar
+      jarfile="${basedir}/libretto.jar"
+      basedir="${build}"
+      manifest="${rsrc}/manifest/libretto.mf"/>
+  </target>
+
+  <target name="jar" depends="compile">
+    <!-- Put everything in ${build} into the a jar file including all dependecies -->
+    <unjar src="${lib}/jaxp.jar" dest="${build}" />
+    <unjar src="${lib}/crimson.jar" dest="${build}" />
+    <unjar src="${lib}/jdom.jar" dest="${build}" />
+    <unjar src="${lib}/log4j-core.jar" dest="${build}" />
+    <jar
+      jarfile="${basedir}/libretto.jar"
+      basedir="${build}"
+      manifest="${rsrc}/manifest/libretto.mf"/>
+  </target>
+  
+  <target name="client-jar" depends="background-jar">
+    <!-- Put everything in ${build} into the a jar file including all dependecies -->
+    <unjar src="${lib}/log4j-core.jar" dest="${build}" />
+    <jar jarfile="${basedir}/libretto-client.jar" manifest="${rsrc}/manifest/libretto-client.mf">
+      <fileset dir="${build}">
+        <include name="build.properties"/>
+        <include name="log4j.properties"/>
+        <include name="be/beta9/libretto/io/*.class"/>
+        <include name="be/beta9/libretto/application/Build.class"/>
+        <include name="be/beta9/libretto/net/LibrettoTextClient*.class"/>
+        <include name="be/beta9/libretto/net/TestClientMessage.class"/>
+        <include name="be/beta9/libretto/net/ClientStatusMessageResult.class"/>
+        <include name="be/beta9/libretto/net/Client*.class"/>
+        <include name="be/beta9/libretto/net/Constants.class"/>
+        <include name="be/beta9/libretto/net/TextMessage.class"/>
+        <include name="be/beta9/libretto/net/MessageResult.class"/>
+        <include name="be/beta9/libretto/net/MessageException.class"/>
+        <include name="be/beta9/libretto/net/SingleTextMessage.class"/>
+        <include name="be/beta9/libretto/net/Message.class"/>
+        <include name="be/beta9/libretto/net/Util.class"/>
+        <include name="be/beta9/libretto/gui/ShowSingleTextFrame*.class"/>
+        <include name="be/beta9/libretto/gui/AWTTextView*.class"/>
+        <include name="be/beta9/libretto/model/AttributedString*.class"/>
+        <include name="be/beta9/libretto/model/AWTTextStyle.class"/>
+        <include name="be/beta9/libretto/model/LTextStyle.class"/>
+        <include name="be/beta9/libretto/model/AWTCharacterAttributes.class"/>
+        <include name="be/beta9/libretto/model/Java2DTextStyle.class"/>
+        <include name="be/beta9/libretto/model/LCharacterAttributes.class"/>
+        <include name="be/beta9/libretto/model/Java2DCharacterAttributes.class"/>
+        <include name="be/beta9/libretto/util/TextStyleManager.class"/>
+        <include name="be/beta9/libretto/util/Bean.class"/>
+        <include name="be/beta9/libretto/util/LibrettoSaxReader.class"/>
+        <include name="be/beta9/libretto/util/Preferences.class"/>
+        <include name="be/beta9/libretto/util/Utilities.class"/>
+        <include name="org/apache/log4j/**"/>
+      </fileset>
+    </jar>
+  </target>
+  
+  <target name="background-jar" depends="compile">
+    <!-- Put everything in ${build} into the a jar file including all dependecies -->
+    <jar jarfile="${basedir}/background.jar" manifest="${rsrc}/manifest/background-black-window.mf">
+      <fileset dir="${build}">
+        <include name="be/beta9/libretto/gui/BackgroundBlackWindow.class"/>
+      </fileset>
+    </jar>
+  </target>
+
+  <target name="run" depends="compile">
+    <!-- Execute the main application -->
+    <java
+      classname="be.beta9.libretto.application.Libretto"
+      fork="yes">
+      <classpath>
+        <pathelement location="${build}" />
+        <fileset dir="${lib}">
+          <include name="log4j-core.jar" />
+          <include name="jaxp.jar" />
+          <include name="crimson.jar" />
+          <include name="jdom.jar" />
+        </fileset>
+      </classpath>
+    </java>
+  </target>
+
+  <target name="debug" depends="compile">
+    <!-- Execute the main application in debug mode -->
+    <java
+      classname="be.beta9.libretto.application.LibrettoDebug"
+      fork="yes">
+      <classpath>
+        <pathelement location="${build}" />
+        <fileset dir="${lib}">
+          <include name="*.jar" />
+        </fileset>
+      </classpath>
+    </java>
+  </target>
+
+  <target name="junit" depends="compile-junit">
+    <!-- Execute all junit tests -->
+    <java
+      classname="be.beta9.libretto.AllTests"
+      fork="yes">
+      <classpath>
+        <pathelement location="${build}" />
+        <fileset dir="${lib}">
+          <include name="*.jar" />
+        </fileset>
+      </classpath>
+    </java>
+  </target>
+
+  <target name="clean">
+    <!-- Delete the ${build} directory trees -->
+    <delete dir="${build}" />
+    <delete dir="${api}" />
+  </target>
+  
+  <target name="api" depends="prepare">
+    <!-- Generate javadoc -->
+    <javadoc
+      packagenames="be.beta9.libretto.*"
+      sourcepath="${src}"
+      destdir="${api}"
+      windowtitle="Libretto"
+      author="true"
+      version="true"
+      use="true"/>
+  </target>
+  
+  <target name="zip-all" depends="jar, client-jar">
+    <zip zipfile="libretto.zip">
+    <fileset dir="${basedir}">
+      <include name="libretto.jar"/>
+      <include name="libretto-client.jar"/>
+        </fileset>
+    </zip>
+  </target>
+
+  <target name="upload" depends="clean, zip-all">
+    <ftp
+      server="users.pandora.be"
+      userid="a002458"
+      password="bast0s"
+      remotedir="libretto"
+      verbose="true"
+      passive="true">
+        <fileset dir="${basedir}">
+        <include name="libretto.jar" />
+        <include name="libretto-client.jar" />
+        <include name="libretto.zip" />
+    </fileset>
+    </ftp>
+  </target>
+
+</project>
+
+
+
+
diff --git a/third_party/lisp/s-xml/test/plist.xml b/third_party/lisp/s-xml/test/plist.xml
new file mode 100644
index 000000000000..910e6326ea63
--- /dev/null
+++ b/third_party/lisp/s-xml/test/plist.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>AppleDockIconEnabled</key>
+	<true/>
+	<key>AppleNavServices:GetFile:0:Path</key>
+	<string>file://localhost/Users/sven/Pictures/</string>
+	<key>AppleNavServices:GetFile:0:Position</key>
+	<data>
+	AOUBXw==
+	</data>
+	<key>AppleNavServices:GetFile:0:Size</key>
+	<data>
+	AAAAAAFeAcI=
+	</data>
+	<key>AppleNavServices:PutFile:0:Disclosure</key>
+	<data>
+	AQ==
+	</data>
+	<key>AppleNavServices:PutFile:0:Path</key>
+	<string>file://localhost/Users/sven/Desktop/</string>
+	<key>AppleNavServices:PutFile:0:Position</key>
+	<data>
+	AUIBVQ==
+	</data>
+	<key>AppleNavServices:PutFile:0:Size</key>
+	<data>
+	AAAAAACkAdY=
+	</data>
+	<key>AppleSavePanelExpanded</key>
+	<string>YES</string>
+	<key>NSDefaultOpenDirectory</key>
+	<string>~/Desktop</string>
+	<key>NSNoBigString</key>
+	<true/>
+</dict>
+</plist>
diff --git a/third_party/lisp/s-xml/test/simple.xml b/third_party/lisp/s-xml/test/simple.xml
new file mode 100644
index 000000000000..08ad9424e3ae
--- /dev/null
+++ b/third_party/lisp/s-xml/test/simple.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<!-- This is a very simple XML document -->
+<root id="123">
+  <text>Hello World!</text>
+</root>
diff --git a/third_party/lisp/s-xml/test/test-lxml-dom.lisp b/third_party/lisp/s-xml/test/test-lxml-dom.lisp
new file mode 100644
index 000000000000..248e1e4b907f
--- /dev/null
+++ b/third_party/lisp/s-xml/test/test-lxml-dom.lisp
@@ -0,0 +1,86 @@
+;;;; -*- mode: lisp -*-
+;;;;
+;;;; $Id: test-lxml-dom.lisp,v 1.2 2005/11/06 12:44:48 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 " <foo/>")
+	  (parse-xml stream :output-type :lxml))
+	:|foo|))
+
+(assert
+ (equal (parse-xml-string "<tag1><tag2 att1='one'/>this is some text</tag1>"
+			  :output-type :lxml)
+	'(:|tag1|
+	   ((:|tag2| :|att1| "one"))
+	   "this is some text")))
+
+(assert
+ (equal (parse-xml-string "<TAG>&lt;foo&gt;</TAG>"
+			  :output-type :lxml)
+	'(:TAG "<foo>")))
+
+(assert
+ (equal (parse-xml-string
+	 "<P><INDEX ITEM='one'/> This is some <B>bold</B> text, with a leading &amp; trailing space </P>"
+	 :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)
+	       "<foo/>"))
+
+(assert
+ (string-equal (print-xml-string '((:|foo| :|bar| "1")) :input-type :lxml)
+	       "<foo bar=\"1\"/>"))
+
+(assert
+ (string-equal (print-xml-string '(:foo "some text") :input-type :lxml)
+	       "<FOO>some text</FOO>"))
+
+(assert
+ (string-equal (print-xml-string '(:|foo| :|bar|) :input-type :lxml)
+	       "<foo><bar/></foo>"))
+
+(assert (string-equal (second
+                       (with-input-from-string (stream "<foo><![CDATA[<greeting>Hello, world!</greeting>]]></foo>")
+                         (parse-xml stream :output-type :lxml)))
+                      "<greeting>Hello, world!</greeting>"))
+	   
+(assert (string-equal (second
+                       (with-input-from-string (stream "<foo><![CDATA[<greeting>Hello, < world!</greeting>]]></foo>")
+                         (parse-xml stream :output-type :lxml)))
+                      "<greeting>Hello, < world!</greeting>"))
+
+;;;; eof
diff --git a/third_party/lisp/s-xml/test/test-sxml-dom.lisp b/third_party/lisp/s-xml/test/test-sxml-dom.lisp
new file mode 100644
index 000000000000..7164d5ef0d66
--- /dev/null
+++ b/third_party/lisp/s-xml/test/test-sxml-dom.lisp
@@ -0,0 +1,76 @@
+;;;; -*- mode: lisp -*-
+;;;;
+;;;; $Id: test-sxml-dom.lisp,v 1.1.1.1 2004/06/07 18:49:59 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 " <foo/>")
+	  (parse-xml stream :output-type :sxml))
+	'(:|foo|)))
+
+(assert
+ (equal (parse-xml-string "<tag1><tag2 att1='one'/>this is some text</tag1>"
+			  :output-type :sxml)
+	'(:|tag1|
+	   (:|tag2| (:@ (:|att1| "one")))
+	   "this is some text")))
+
+(assert
+ (equal (parse-xml-string "<TAG>&lt;foo&gt;</TAG>"
+			  :output-type :sxml)
+	'(:TAG "<foo>")))
+
+(assert
+ (equal (parse-xml-string
+	 "<P><INDEX ITEM='one'/> This is some <B>bold</B> text, with a leading &amp; trailing space </P>"
+	 :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)
+	       "<foo/>"))
+
+(assert
+ (string-equal (print-xml-string '(:|foo| (:@ (:|bar| "1"))) :input-type :sxml)
+	       "<foo bar=\"1\"/>"))
+
+(assert
+ (string-equal (print-xml-string '(:foo "some text") :input-type :sxml)
+	       "<FOO>some text</FOO>"))
+
+(assert
+ (string-equal (print-xml-string '(:|foo| (:|bar|)) :input-type :sxml)
+	       "<foo><bar/></foo>"))
+
+;;;; eof
\ No newline at end of file
diff --git a/third_party/lisp/s-xml/test/test-xml-struct-dom.lisp b/third_party/lisp/s-xml/test/test-xml-struct-dom.lisp
new file mode 100644
index 000000000000..f5ee1cc92583
--- /dev/null
+++ b/third_party/lisp/s-xml/test/test-xml-struct-dom.lisp
@@ -0,0 +1,84 @@
+;;;; -*- mode: lisp -*-
+;;;;
+;;;; $Id: test-xml-struct-dom.lisp,v 1.2 2005/08/29 15:01:49 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 " <foo/>")
+	      (parse-xml stream :output-type :xml-struct))
+	    (make-xml-element :name :|foo|)))
+
+(assert
+ (xml-equal (parse-xml-string "<tag1><tag2 att1='one'/>this is some text</tag1>"
+			      :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 "<tag>&lt;foo&gt;</tag>"
+			      :output-type :xml-struct)
+	    (make-xml-element :name :|tag|
+			      :children (list "<foo>"))))
+
+(assert
+ (xml-equal (parse-xml-string
+	     "<P><INDEX ITEM='one'/> This is some <B>bold</B> text, with a leading &amp; trailing space </P>"
+	     :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)
+	       "<foo/>"))
+
+(assert
+ (string-equal (print-xml-string (make-xml-element :name "foo" :attributes '((:|bar| . "1")))
+				 :input-type :xml-struct)
+	       "<foo bar=\"1\"/>"))
+
+(assert
+ (string-equal (print-xml-string (make-xml-element :name "foo" :children (list "some text"))
+				 :input-type :xml-struct)
+	       "<foo>some text</foo>"))
+
+(assert
+ (string-equal (print-xml-string (make-xml-element :name "foo" :children (list (make-xml-element :name "bar")))
+				 :input-type :xml-struct)
+	       "<foo><bar/></foo>"))
+
+;;;; eof
\ No newline at end of file
diff --git a/third_party/lisp/s-xml/test/test-xml.lisp b/third_party/lisp/s-xml/test/test-xml.lisp
new file mode 100644
index 000000000000..daef58ea4639
--- /dev/null
+++ b/third_party/lisp/s-xml/test/test-xml.lisp
@@ -0,0 +1,86 @@
+;;;; -*- mode: lisp -*-
+;;;;
+;;;; $Id: test-xml.lisp,v 1.3 2005/11/06 12:44:48 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 "<foo>" stream))
+	       "&lt;foo&gt;"))
+
+(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 "</~a>" 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 "<FOO ATT1='1' ATT2='2'><B>Text</B><EMPTY></EMPTY>More text!<SUB><SUB></SUB></SUB></FOO>"))
+   (equal (simple-echo-xml-string xml)
+            xml))))
+
+(assert 
+  (let ((xml "<p> </p>"))
+    (equal (simple-echo-xml-string xml)
+           xml)))
+
+;;;; eof
\ No newline at end of file
diff --git a/third_party/lisp/s-xml/test/xhtml-page.xml b/third_party/lisp/s-xml/test/xhtml-page.xml
new file mode 100644
index 000000000000..79f3ae3bade6
--- /dev/null
+++ b/third_party/lisp/s-xml/test/xhtml-page.xml
@@ -0,0 +1,271 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

+

+<html>

+<head>

+

+<title>XHTML Tutorial</title>

+<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />

+<meta name="Keywords" content="XML,tutorial,HTML,DHTML,CSS,XSL,XHTML,JavaScript,ASP,ADO,VBScript,DOM,authoring,programming,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,demos,tips,links,FAQ,tag list,forms,frames,color table,W3C,Cascading Style Sheets,Active Server Pages,Dynamic HTML,Internet database development,Webbuilder,Sitebuilder,Webmaster,HTMLGuide,SiteExpert" />

+<meta name="Description" content="HTML,CSS,JavaScript,DHTML,XML,XHTML,ASP,ADO and VBScript tutorial from W3Schools." />

+<meta http-equiv="pragma" content="no-cache" />

+<meta http-equiv="cache-control" content="no-cache" />

+

+<link rel="stylesheet" type="text/css" href="../stdtheme.css" />

+

+</head>

+<body>

+

+<table border="0" cellpadding="0" cellspacing="0" width="775">

+<tr>

+<td width="140" class="content" valign="top">

+<br />

+<a class="left" href="../default.asp" target="_top"><b>HOME</b></a><br />

+<br />

+<b>XHTML Tutorial</b><br />

+<a class="left" target="_top" href="default.asp" style='font-weight:bold;color:#000000;background-color:transparent;'>XHTML HOME</a><br />

+<a class="left" target="_top" href="xhtml_intro.asp" >XHTML Introduction</a><br />

+<a class="left" target="_top" href="xhtml_why.asp" >XHTML Why</a><br />

+<a class="left" target="_top" href="xhtml_html.asp" >XHTML v HTML</a><br />

+<a class="left" target="_top" href="xhtml_syntax.asp" >XHTML Syntax</a><br />

+<a class="left" target="_top" href="xhtml_dtd.asp" >XHTML DTD</a><br />

+<a class="left" target="_top" href="xhtml_howto.asp" >XHTML HowTo</a><br />

+<a class="left" target="_top" href="xhtml_validate.asp" >XHTML Validation</a><br />

+<br />

+<b>Quiz</b>

+<br />

+<a class="left" target="_top" href="xhtml_quiz.asp" >XHTML Quiz</a><br />

+<br />

+<b>References</b>

+<br />

+<a class="left" target="_top" href="xhtml_reference.asp" >XHTML Tag List</a><br />

+<a class="left" target="_top" href="xhtml_standardattributes.asp" >XHTML Attributes</a><br />

+<a class="left" target="_top" href="xhtml_eventattributes.asp" >XHTML Events</a><br />

+</td>

+<td width="490" valign="top">

+<table width="100%" bgcolor="#FFFFFF" border="1" cellpadding="7" cellspacing="0">

+<tr>

+<td>

+<center>

+<a href="http://ad.doubleclick.net/jump/N1951.w3schools/B1097963;sz=468x60;ord=[timestamp]?" target="_new">

+<img src="http://ad.doubleclick.net/ad/N1951.w3schools/B1097963;sz=468x60;ord=[timestamp]?" 

+border="0" width="468" height="60" alt="Corel XMetal 3" /></a>

+

+

+<br />Please Visit Our Sponsors !

+</center>

+<h1>XHTML Tutorial</h1>

+<a href="../default.asp"><img border="0" src="../images/btn_previous.gif" alt="Previous" /></a>

+<a href="xhtml_intro.asp"><img border="0" src="../images/btn_next.gif" width="100" height="20" alt="Next" /></a>

+

+<hr />

+

+<h2>XHTML Tutorial</h2>

+<p>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. <a href="xhtml_intro.asp">Start&nbsp;Learning

+XHTML!</a></p>

+

+<h2>XHTML Quiz Test</h2>

+<p>Test your XHTML skills at W3Schools! <a href="xhtml_quiz.asp">Start XHTML

+Quiz!</a>&nbsp;</p>

+

+<h2>XHTML References</h2>

+<p>At W3Schools you will find complete XHTML references about tags, attributes

+and events. <a href="xhtml_reference.asp">XHTML 1.0 References</a>.</p>

+<hr />

+<h2>Table of Contents</h2>

+<p><a href="xhtml_intro.asp">Introduction to XHTML</a><br />

+This chapter gives a brief introduction to XHTML and explains what XHTML is.</p>

+<p><a href="xhtml_why.asp">XHTML - Why?</a><br />

+This chapter explains why we needed a new language like XHTML.</p>

+<p><a href="xhtml_html.asp">Differences between XHTML and HTML</a><br />

+This chapter explains the main differences in syntax between XHTML and HTML.</p>

+<p><a href="xhtml_syntax.asp">XHTML Syntax</a>&nbsp;<br />

+This chapter explains the basic syntax of XHTML.</p>

+<p><a href="xhtml_dtd.asp">XHTML DTD</a>&nbsp;<br />

+This chapter explains the three different XHTML Document Type Definitions.</p>

+<p><a href="xhtml_howto.asp">XHTML HowTo</a><br />

+This chapter explains how this web site was converted from HTML to XHTML.</p>

+<p><a href="xhtml_validate.asp">XHTML Validation</a><br />

+This chapter explains how to validate XHTML documents.</p>

+<hr />

+<h2>XHTML References</h2>

+<p><a href="xhtml_reference.asp">XHTML 1.0 Reference<br />

+</a>Our complete XHTML 1.0 reference is an alphabetical list of all XHTML tags

+with lots of&nbsp; examples and tips.</p>

+<p><a href="xhtml_standardattributes.asp">XHTML 1.0 Standard Attributes<br />

+</a>All the tags have attributes. The attributes for each tag are listed in the

+examples in the &quot;XHTML 1.0 Reference&quot; 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.</p>

+<p><a href="xhtml_eventattributes.asp">XHTML 1.0 Event Attributes<br />

+</a>All the standard event attributes of the tags. This reference describes the attributes, and shows possible

+values for each.</p>

+<hr />

+<a href="../default.asp"><img border="0" src="../images/btn_previous.gif" width="100" height="20" alt="Previous" /></a>

+<a href="xhtml_intro.asp"><img border="0" src="../images/btn_next.gif" width="100" height="20" alt="Next" /></a>

+

+

+<hr />

+<p>

+Jump to: <a href="#top" target="_top"><b>Top of Page</b></a>

+or <a href="/" target="_top"><b>HOME</b></a> or

+<a href='/xhtml/default.asp?output=print' target="_blank">

+<img src="../images/print.gif" alt="Printer Friendly" border="0" />

+<b>Printer friendly page</b></a>

+</p>

+<hr />

+

+<h2>Search W3Schools:</h2>

+<form method="get" name="searchform" action="http://www.google.com/search" target="_blank">

+<input type="hidden" name="as_sitesearch" value="www.w3schools.com" />

+<input type="text" size="30" name="as_q" />

+<input type="submit" value=" Go! " />

+</form>

+

+<hr />

+<h2>What Others Say About Us</h2>

+<p>Does the world know about us? Check out these places:</p>

+<p>

+<a href="http://search.dogpile.com/texis/search?q=W3schools" target="_blank">Dogpile</a>

+<a href="http://www.altavista.com/cgi-bin/query?q=W3Schools" target="_blank">Alta Vista</a>

+<a href="http://search.msn.com/results.asp?q=W3Schools" target="_blank">MSN</a>

+<a href="http://www.google.com/search?q=W3Schools" target="_blank">Google</a>

+<a href="http://search.excite.com/search.gw?search=W3Schools" target="_blank">Excite</a>

+<a href="http://search.lycos.com/main/?query=W3Schools" target="_blank">Lycos</a>

+<a href="http://search.yahoo.com/search?p=w3schools" target="_blank">Yahoo</a>

+<a href="http://www.ask.com/main/askJeeves.asp?ask=W3Schools" target="_blank">Ask Jeeves</a>

+</p>

+<hr />

+<h2>We Help You For Free. You Can Help Us!</h2>

+<ul>

+<li><a href="../tellyourgroup.htm" target="blank">Tell your newsgroup or mailing list</a></li>

+<li><a href="../about/about_linking.asp">Link to us from your pages</a></li>

+<li><a href="../about/about_helpers.asp">Help us correct errors and broken links</a></li>

+<li><a href="../about/about_helpers.asp">Help us with spelling and grammar</a></li>

+<li><a href="http://validator.w3.org/check/referer" target="_blank">Validate the XHTML code of this page</a></li>

+</ul>

+

+<hr />

+<p>

+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

+<a href="../about/about_copyright.asp">terms of use</a> and 

+<a href="../about/about_privacy.asp">privacy policy</a>.</p>

+<p>

+<a href="../about/about_copyright.asp">Copyright 1999-2002</a> by Refsnes Data. All Rights Reserved</p>

+<hr />

+<table border="0" width="100%" cellspacing="0" cellpadding="0"><tr>

+<td width="25%" align="left">

+<a href="http://validator.w3.org/check/referer" target="_blank">

+<img src="../images/vxhtml.gif" alt="Validate" width="88" height="31" border="0" /></a>

+</td>

+<td width="50%" align="center">

+<a href="../xhtml/" target="_top">How we converted to XHTML</a>

+</td>

+<td width="25%" align="right">

+<a href="http://jigsaw.w3.org/css-validator/check/referer" target="_blank">

+<img src="../images/vcss.gif" alt="Validate" width="88" height="31" border="0" /></a>

+</td>

+</tr></table>

+</td>

+</tr>

+</table>

+</td>

+

+

+ 

+<td width="144" align="center" valign="top">

+

+<table border="1" width="100%" bgcolor="#ffffff" cellpadding="0" cellspacing="0"><tr>

+<td align="center" class="right"><br />

+

+<a href="http://www.dotnetcharting.com" target="_blank"><img src="../images/dnc-icon.gif" alt="Web charting" border="0" /></a>

+<br />

+<a class="right" href="http://www.dotnetcharting.com" target="_blank">Web based charting<br />for ASP.NET</a>

+

+<br /><br />

+</td></tr></table>

+

+<table border="1" width="100%" bgcolor="#ffffff" cellpadding="0" cellspacing="0"><tr>

+<td align="center" class="right">

+<br />

+<a href="../hosting/default.asp">

+Your own Web Site?<br />

+<br />Read W3Schools

+<br />Hosting Tutorial</a>

+<br />

+<br />

+</td></tr></table>

+

+<table border="1" width="100%" bgcolor="#ffffff" cellpadding="0" cellspacing="0"><tr>

+<td align="center" class="right">

+<br />

+<a class="red" href="http://www.dotdnr.com" target="_blank">$15 Domain Name<br />Registration<br />Save $20 / year!</a>

+<br />

+<br />

+</td></tr></table>

+

+

+

+<table border="1" width="100%" bgcolor="#ffffff" cellpadding="0" cellspacing="0">

+<tr><td align="center" class="right">

+<br />

+<b>SELECTED LINKS</b>

+<br /><br />

+<a class="right" href="http://opogee.com/clk/dangtingcentiaonie" target="_blank">University Online<br />

+Master Degree<br />Bachelor Degree</a>

+<br /><br />

+<a class="right" href="../software/default.asp" target="_top">Web Software</a>

+<br /><br />

+<a class="right" href="../appml/default.asp" target="_top">The Future of<br />Web Development</a>

+<br /><br />

+<a class="right" href="../careers/default.asp" target="_top">Jobs and Careers</a>

+<br /><br />

+<a class="right" href="../site/site_security.asp" target="_top">Web Security</a>

+<br />

+<a class="right" href="../browsers/browsers_stats.asp" target="_top">Web Statistics</a>

+<br />

+<a class="right" href="../w3c" target="_top">Web Standards</a>

+<br /><br />

+</td></tr></table>

+

+

+<table border="1" width="100%" bgcolor="#ffffff" cellpadding="0" cellspacing="0"><tr>

+<td align="center" class="right">

+<br />

+

+<b>Recommended<br />

+Reading:</b><br /><br />

+

+<a class="right" target="_blank"

+href="http://www.amazon.com/exec/obidos/ASIN/059600026X/w3schools03">

+<img src="../images/book_amazon_xhtml.jpg" border="0" alt="HTML XHTML" /></a>

+

+

+<br /><br /></td>

+</tr></table>

+

+<table border="1" width="100%" bgcolor="#ffffff" cellpadding="0" cellspacing="0"><tr>

+<td align="center" class="right">

+<br />

+<b>PARTNERS</b><br />

+<br />

+<a class="right" href="http://www.W3Schools.com" target="_blank">W3Schools</a><br />

+<a class="right" href="http://www.topxml.com" target="_blank">TopXML</a><br />

+<a class="right" href="http://www.visualbuilder.com" target="_blank">VisualBuilder</a><br />

+<a class="right" href="http://www.xmlpitstop.com" target="_blank">XMLPitstop</a><br />

+<a class="right" href="http://www.developersdex.com" target="_blank">DevelopersDex</a><br />

+<a class="right" href="http://www.devguru.com" target="_blank">DevGuru</a><br />

+<a class="right" href="http://www.programmersheaven.com/" target="_blank">Programmers Heaven</a><br />

+<a class="right" href="http://www.codeproject.com" target="_blank">The Code Project</a><br />

+<a class="right" href="http://www.tek-tips.com" target="_blank">Tek Tips Forum</a><br />

+<a class="right" href="http://www.zvon.ORG/" target="_blank">ZVON.ORG</a><br />

+<a class="right" href="http://www.topxml.com/search.asp" target="_blank">TopXML Search</a><br />

+<br />

+</td>

+</tr></table>

+</td></tr></table>

+

+</body>

+</html>