summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author(no author) <(no author)>2003-11-26 02:12:18 +0000
committer(no author) <(no author)@f4007aff-3deb-0310-84d5-95a897f41757>2003-11-26 02:12:18 +0000
commit507524b97ef3bedb42f6c15ec93eedff8ee4b150 (patch)
tree4b825dc642cb6eb9a060e54bf8d69288fbee4904
parent38a93ec51b23826a8f0f2b91fbaea5956ea5bda4 (diff)
New repository initialized by cvs2svn.
-rw-r--r--.cvsignore22
-rw-r--r--AUTHORS1
-rw-r--r--BUGS3
-rw-r--r--COPYING31
-rw-r--r--ChangeLog19
-rw-r--r--INSTALL12
-rw-r--r--Makefile.am7
-rw-r--r--NEWS1
-rw-r--r--README3
-rw-r--r--config.win32.h127
-rw-r--r--configure.in110
-rw-r--r--doc/rtfx.xsd486
-rw-r--r--doc/sample.rtf68
-rw-r--r--doc/sample.xml1
-rw-r--r--src/.cvsignore4
-rw-r--r--src/Makefile.am14
-rw-r--r--src/domhelpers.cpp370
-rw-r--r--src/domhelpers.h165
-rw-r--r--src/levelhandler.cpp134
-rw-r--r--src/levelhandler.h88
-rw-r--r--src/reference.h157
-rw-r--r--src/rtfformatting.h190
-rw-r--r--src/rtfparser.cpp442
-rw-r--r--src/rtfparser.h143
-rw-r--r--src/rtfx.173
-rw-r--r--src/rtfx.cpp140
-rw-r--r--src/sablo.h2173
-rw-r--r--src/sablotr.cpp137
-rw-r--r--src/tags.h120
-rw-r--r--src/usuals.h69
-rw-r--r--src/xmlcomposehelpers.cpp159
-rw-r--r--src/xmlcomposehelpers.h167
-rw-r--r--src/xmlcomposer.cpp1245
-rw-r--r--src/xmlcomposer.h311
-rw-r--r--src/xmlfixups.cpp794
-rw-r--r--src/xmlfixups.h155
-rw-r--r--win32/.cvsignore8
-rw-r--r--win32/Makefile.am41
-rw-r--r--win32/rtfx.dsp182
-rw-r--r--win32/rtfx.dsw29
-rw-r--r--win32/sablot/INSTALL364
-rw-r--r--win32/sablot/INSTALL_WIN224
-rw-r--r--win32/sablot/README174
-rw-r--r--win32/sablot/README_JS214
-rw-r--r--win32/sablot/RELEASE792
-rw-r--r--win32/sablot/bin/sabcmd.exebin53248 -> 0 bytes
-rw-r--r--win32/sablot/bin/sablot.dllbin364544 -> 0 bytes
-rw-r--r--win32/sablot/include/sabdbg.h116
-rw-r--r--win32/sablot/include/sablot.h1134
-rw-r--r--win32/sablot/include/sdom.h1878
-rw-r--r--win32/sablot/include/shandler.h738
-rw-r--r--win32/sablot/include/sxpath.h664
-rw-r--r--win32/sablot/lib/sablot.libbin28652 -> 0 bytes
-rw-r--r--win32/sablot/lib/sablotd.libbin28044 -> 0 bytes
54 files changed, 0 insertions, 14699 deletions
diff --git a/.cvsignore b/.cvsignore
deleted file mode 100644
index e35eeee..0000000
--- a/.cvsignore
+++ /dev/null
@@ -1,22 +0,0 @@
-test-files
-config.h
-autom4te.cache
-Makefile
-Makefile.in
-aclocal.m4
-config.h
-config.h.in
-config.log
-config.status
-configure
-depcomp
-install-sh
-missing
-mkinstalldirs
-stamp-*
-*~
-*.zip
-*.tar.gz
-.project
-.cdtproject
-
diff --git a/AUTHORS b/AUTHORS
deleted file mode 100644
index d2e76d6..0000000
--- a/AUTHORS
+++ /dev/null
@@ -1 +0,0 @@
-nielsen@memberwebs.com
diff --git a/BUGS b/BUGS
deleted file mode 100644
index ebe310c..0000000
--- a/BUGS
+++ /dev/null
@@ -1,3 +0,0 @@
-RTFX Bugs
- - No font support
- - No color support
diff --git a/COPYING b/COPYING
deleted file mode 100644
index 763af15..0000000
--- a/COPYING
+++ /dev/null
@@ -1,31 +0,0 @@
-
-Copyright (c) 2004, Nate Nielsen
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
- * Redistributions of source code must retain the above
- copyright notice, this list of conditions and the
- following disclaimer.
- * Redistributions in binary form must reproduce the
- above copyright notice, this list of conditions and
- the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- * The names of contributors to this software may not be
- used to endorse or promote products derived from this
- software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
-THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index cffbbb3..0000000
--- a/ChangeLog
+++ /dev/null
@@ -1,19 +0,0 @@
-Version 0.9.3
- - Code cleanup
- - Fixed bug with non-existant destinations
-
-Version 0.9.2
- - Updated windows version to new sablot library
- - Added support for foot notes
- - Added support for super and sub script
- - Removes extraneous duplicate tags
- - Other small bug fixes
-
-Version 0.9.1
- - Changed name to 'rtfx' due to a naming conflict
-
-Version 0.9
- - Ported to Linux/FreeBSD
-
-Version 0.7
- - Stable released used regularly
diff --git a/INSTALL b/INSTALL
deleted file mode 100644
index e6a2bed..0000000
--- a/INSTALL
+++ /dev/null
@@ -1,12 +0,0 @@
-======================================================================
- RTFX 0.9.1 INSTALL
-
-REQUIREMENTS
- You'll need to have a version of the sablotron XML library
- (0.9.6 or later) installed.
-
-QUICK INSTALLATION:
- # tar -zxvf rtfx-0.9.1.tar.gz
- # ./configure
- # make && make install
-
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index a1b0af6..0000000
--- a/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-
-EXTRA_DIST = BUGS test-files config.win32.h
-SUBDIRS = src win32
-
-dist-hook:
- rm -rf `find $(distdir)/ -name CVS`
-
diff --git a/NEWS b/NEWS
deleted file mode 100644
index c7ab92a..0000000
--- a/NEWS
+++ /dev/null
@@ -1 +0,0 @@
-See ChangeLog \ No newline at end of file
diff --git a/README b/README
deleted file mode 100644
index 9d48435..0000000
--- a/README
+++ /dev/null
@@ -1,3 +0,0 @@
-=================================================================
- RTFX 0.9.1 README
-
diff --git a/config.win32.h b/config.win32.h
deleted file mode 100644
index 1d253c3..0000000
--- a/config.win32.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/* config.h. Generated by configure. */
-/* config.h.in. Generated from configure.in by autoheader. */
-
-/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
- systems. This function is required for `alloca.c' support on those systems.
- */
-/* #undef CRAY_STACKSEG_END */
-
-/* Define to 1 if using `alloca.c'. */
-/* #undef C_ALLOCA */
-
-/* Define to 1 if you have `alloca', as a function or macro. */
-#define HAVE_ALLOCA 1
-
-/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
- */
-/* #undef HAVE_ALLOCA_H */
-
-/* Define to 1 if you have the <assert.h> header file. */
-#define HAVE_ASSERT_H 1
-
-/* Define to 1 if you have the <errno.h> header file. */
-#define HAVE_ERRNO_H 1
-
-/* Define to 1 if you have the <exception> header file. */
-#define HAVE_EXCEPTION 1
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-/* #undef HAVE_INTTYPES_H */
-
-/* Define to 1 if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define to 1 if you have the `memset' function. */
-#define HAVE_MEMSET 1
-
-/* Define to 1 if you have the <sablot.h> header file. */
-#define HAVE_SABLOT_H 1
-
-/* Define to 1 if you have the <sdom.h> header file. */
-#define HAVE_SDOM_H 1
-
-/* Define to 1 if you have the `sprintf' function. */
-#define HAVE_SPRINTF 1
-
-/* Define to 1 if you have the <stack> header file. */
-#define HAVE_STACK 1
-
-/* Define to 1 if you have the <stddef.h> header file. */
-#define HAVE_STDDEF_H 1
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#define HAVE_STDINT_H 1
-
-/* Define to 1 if you have the <stdio.h> header file. */
-#define HAVE_STDIO_H 1
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the `strchr' function. */
-#define HAVE_STRCHR 1
-
-/* Define to 1 if you have the `strerror' function. */
-#define HAVE_STRERROR 1
-
-/* Define to 1 if you have the <string> header file. */
-#define HAVE_STRING 1
-
-/* Define to 1 if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-/* #undef HAVE_SYS_STAT_H */
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the <unistd.h> header file. */
-/* #undef HAVE_UNISTD_H */
-
-/* Define to 1 if you have the <wchar.h> header file. */
-#define HAVE_WCHAR_H 1
-
-/* Define to 1 if the system has the type `wstring'. */
-#define HAVE_WSTRING 1
-
-/* Name of package */
-#define PACKAGE "rtfx"
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT "nielsen@memberwebs.com"
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME "rtfx"
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "rtfx 0.9.2"
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME "rtfx"
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION "0.9.2"
-
-/* If using the C implementation of alloca, define if you know the
- direction of stack growth for your system; otherwise it will be
- automatically deduced at run-time.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown */
-/* #undef STACK_DIRECTION */
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Version number of package */
-#define VERSION "0.9.2"
-
-/* Define to empty if `const' does not conform to ANSI C. */
-/* #undef const */
-
-/* Define to `unsigned' if <sys/types.h> does not define. */
-/* #undef size_t */
diff --git a/configure.in b/configure.in
deleted file mode 100644
index 21f472a..0000000
--- a/configure.in
+++ /dev/null
@@ -1,110 +0,0 @@
-dnl
-dnl Copyright (c) 2004, Nate Nielsen
-dnl All rights reserved.
-dnl
-dnl Redistribution and use in source and binary forms, with or without
-dnl modification, are permitted provided that the following conditions
-dnl are met:
-dnl
-dnl * Redistributions of source code must retain the above
-dnl copyright notice, this list of conditions and the
-dnl following disclaimer.
-dnl * Redistributions in binary form must reproduce the
-dnl above copyright notice, this list of conditions and
-dnl the following disclaimer in the documentation and/or
-dnl other materials provided with the distribution.
-dnl * The names of contributors to this software may not be
-dnl used to endorse or promote products derived from this
-dnl software without specific prior written permission.
-dnl
-dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-dnl "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-dnl FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-dnl COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-dnl INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-dnl BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-dnl OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-dnl AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-dnl OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
-dnl THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-dnl DAMAGE.
-dnl
-dnl
-dnl CONTRIBUTORS
-dnl Nate Nielsen <nielsen@memberwebs.com>
-dnl
-
-dnl Process this file with autoconf to produce a configure script.
-AC_INIT(rtfx, 0.9.3, nielsen@memberwebs.com)
-AM_INIT_AUTOMAKE(rtfx, 0.9.3)
-
-LDFLAGS="$LDFLAGS -L/usr/local/lib"
-CPPFLAGS="$CPPFLAGS -I/usr/local/include"
-CFLAGS="$CFLAGS -I/usr/local/include"
-
-AC_LANG_CPLUSPLUS
-
-AC_CONFIG_SRCDIR([src/rtfx.cpp])
-AM_CONFIG_HEADER([config.h])
-
-# Checks for programs.
-AC_PROG_CC
-AC_PROG_CXX
-AC_PROG_INSTALL
-AC_PROG_LN_S
-AC_PROG_MAKE_SET
-
-# Debug mode
-AC_ARG_ENABLE(debug,
- AC_HELP_STRING([--enable-debug],
- [Compile binaries in debug mode]))
-
-if test "$enable_debug" = "yes"; then
- CFLAGS="$CFLAGS -g -O0"
- AC_DEFINE_UNQUOTED(_DEBUG, 1, [In debug mode])
- echo "enabling debug compile mode"
-fi
-
-# Check for libraries
-AC_CHECK_LIB(c, iconv, [ LIB_ICONV=""; ],
- [ AC_CHECK_LIB(iconv, iconv, [ LIB_ICONV="-liconv"; LIBS="-liconv $LIBS" ],
- [echo "ERROR: Must have iconv routines."; exit 1])
- ])
-
-# Sablotron can depend on these libraries so include if present
-AC_CHECK_LIB(termcap, tgetnum)
-AC_CHECK_LIB(readline, readline)
-AC_CHECK_LIB(expat, XML_Parse)
-AC_CHECK_LIB(js, JS_NewContext)
-
-# Check for Sablotron
-AC_CHECK_LIB(sablot, SDOM_createElement, ,
- [echo "ERROR: Must install sablotron libraries."; exit 1])
-
-# Checks for header files.
-AC_FUNC_ALLOCA
-AC_HEADER_STDC
-AC_CHECK_HEADERS([stddef.h stdlib.h wchar.h assert.h stdio.h errno.h], ,
- [echo "ERROR: Required C header missing"; exit 1])
-AC_CHECK_HEADERS([string exception stack], ,
- [echo "ERROR: Required STL header missing"; exit 1])
-AC_CHECK_HEADERS([sablot.h sdom.h], ,
- [echo "ERROR: Required Sablotron header missing"; exit 1])
-
-
-# Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST
-AC_TYPE_SIZE_T
-AC_CHECK_TYPES(wstring, , , [
- #include <wchar.h>
- #include <string>
- using std::wstring;
-])
-
-# Required Functions
-AC_CHECK_FUNCS([memset strchr strerror sprintf], ,
- [echo "ERROR: Required function missing"; exit 1])
-
-AC_CONFIG_FILES([Makefile src/Makefile win32/Makefile])
-AC_OUTPUT
diff --git a/doc/rtfx.xsd b/doc/rtfx.xsd
deleted file mode 100644
index 922b0a6..0000000
--- a/doc/rtfx.xsd
+++ /dev/null
@@ -1,486 +0,0 @@
-<?xml version="1.0"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://memberwebs.com/ns/rtfx/"
- xmlns="http://memberwebs.com/ns/rtfx/" elementFormDefault="qualified">
-
- <!--
- Copyright (c) 2004, Nate Nielsen
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- * Redistributions of source code must retain the above
- copyright notice, this list of conditions and the
- following disclaimer.
- * Redistributions in binary form must reproduce the
- above copyright notice, this list of conditions and
- the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- * The names of contributors to this software may not be
- used to endorse or promote products derived from this
- software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- DAMAGE.
-
- CONTRIBUTORS
- Nate Nielsen <nielsen@memberwebs.com>
- -->
-
- <xs:element name="document">
- <xs:annotation>
- <xs:documentation>The entire RTF document.</xs:documentation>
- </xs:annotation>
-
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="meta"/>
- <xs:group ref="section"/>
- <xs:group ref="block"/>
- </xs:choice>
- </xs:complexType>
- </xs:element>
-
-
- <!-- ##################################################################
- DOCUMENT META INFO
- -->
-
- <xs:group name="meta">
- <xs:annotation>
- <xs:documentation>Tags that that contain data about the document and general formatting.</xs:documentation>
- </xs:annotation>
-
- <xs:choice>
- <xs:element ref="info" maxOccurs="1"/>
- <xs:element ref="stylesheet" maxOccurs="1"/>
- <xs:element ref="options" maxOccurs="1"/>
- </xs:choice>
- </xs:group>
-
- <xs:element name="stylesheet">
- <xs:annotation>
- <xs:documentation>Contains a list of all the paragraph styles in the document, and their various formatting attributes.</xs:documentation>
- </xs:annotation>
-
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="style"/>
- </xs:choice>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="style">
- <xs:annotation>
- <xs:documentation>Represents a paragraph style used in the document.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:attribute name="name" type="xs:string">
- <xs:annotation>
- <xs:documentation>The style name.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="bold" type="xs:boolean" default="false">
- <xs:annotation>
- <xs:documentation>Style text bold.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="hide" type="xs:boolean" default="false">
- <xs:annotation>
- <xs:documentation>Style text hidden.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="italic" type="xs:boolean" default="false">
- <xs:annotation>
- <xs:documentation>Style text italicized.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="strike" type="xs:boolean" default="false">
- <xs:annotation>
- <xs:documentation>Style text striken out.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="underline" type="xs:boolean" default="false">
- <xs:annotation>
- <xs:documentation>Style text underlined.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="color" type="xs:integer" default="0">
- <xs:annotation>
- <xs:documentation>Style text color [NOTE: This attribute is only generated in 'presentation' mode].</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="face" type="xs:string">
- <xs:annotation>
- <xs:documentation>Style font face [NOTE: This attribute is only generated in 'presentation' mode].</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="size" type="xs:string">
- <xs:annotation>
- <xs:documentation>Style font size [NOTE: This attribute is only generated in 'presentation' mode].</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="info">
- <xs:annotation>
- <xs:documentation>Document meta information.</xs:documentation>
- </xs:annotation>
-
- <xs:complexType>
- <xs:all>
- <xs:element name="title" type="xs:string" minOccurs="0">
- <xs:annotation>
- <xs:documentation>The document title.</xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element name="author" type="xs:string" minOccurs="0">
- <xs:annotation>
- <xs:documentation>The document author.</xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element name="operator" type="xs:string" minOccurs="0">
- <xs:annotation>
- <xs:documentation>The document operator.</xs:documentation>
- </xs:annotation>
- </xs:element>
- </xs:all>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="options">
- <xs:annotation>
- <xs:documentation>Document options and defaults.</xs:documentation>
- </xs:annotation>
-
- <xs:complexType>
- <xs:all>
- <xs:element ref="font" minOccurs="0"/>
- </xs:all>
- </xs:complexType>
- </xs:element>
-
-
- <!-- ##################################################################
- SECTION CONTENT
- -->
-
- <xs:group name="section">
- <xs:annotation>
- <xs:documentation>Tags that break a document into various sections.</xs:documentation>
- </xs:annotation>
-
- <xs:choice>
- <xs:element ref="sect"/>
- <xs:element ref="page"/>
- <xs:element ref="footnote"/>
- </xs:choice>
- </xs:group>
-
- <xs:element name="sect">
- <xs:annotation>
- <xs:documentation>A section break.</xs:documentation>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="page">
- <xs:annotation>
- <xs:documentation>A 'hard' page break.</xs:documentation>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="footnote">
- <xs:annotation>
- <xs:documentation>A footnote. Footnotes are all usually grouped together at the end of the document.</xs:documentation>
- </xs:annotation>
-
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="block"/>
- </xs:choice>
- <xs:attribute name="id" type="xs:integer">
- <xs:annotation>
- <xs:documentation>The footnote number.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- </xs:complexType>
- </xs:element>
-
-
- <!-- ##################################################################
- BLOCK CONTENT
- -->
-
- <xs:group name="block">
- <xs:annotation>
- <xs:documentation>Block type elements.</xs:documentation>
- </xs:annotation>
-
- <xs:choice>
- <xs:element ref="para"/>
- <xs:element ref="list"/>
- <xs:element ref="table"/>
- </xs:choice>
- </xs:group>
-
- <xs:element name="para">
- <xs:annotation>
- <xs:documentation>A paragraph. One of the main basic building blocks of the document. Basically all text and other 'inline' elements are contained in paragraphs.</xs:documentation>
- </xs:annotation>
-
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="inline"/>
- </xs:choice>
- <xs:attribute name="style" type="xs:string">
- <xs:annotation>
- <xs:documentation>The paragraph style name.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="list">
- <xs:annotation>
- <xs:documentation>A list. Lists contain paragraphs each of which is an item in the list.</xs:documentation>
- </xs:annotation>
-
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="block"/>
- </xs:choice>
-
- <xs:attribute name="ordered" type="xs:boolean">
- <xs:annotation>
- <xs:documentation>Whether a numbered list or not.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
-
- <xs:attribute name="start" type="xs:integer">
- <xs:annotation>
- <xs:documentation>For numbered lists the number to start at.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
-
- <xs:attribute name="type" default="disc">
- <xs:annotation>
- <xs:documentation>The type of bullet or number on a list.</xs:documentation>
- </xs:annotation>
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="arabic"/>
- <xs:enumeration value="upper-roman"/>
- <xs:enumeration value="lower-roman"/>
- <xs:enumeration value="upper-alpha"/>
- <xs:enumeration value="lower-alpha"/>
- <xs:enumeration value="disc"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
-
- </xs:complexType>
- </xs:element>
-
-
- <!-- ##################################################################
- TABLE STRUCTURE
- -->
-
- <xs:element name="table">
- <xs:annotation>
- <xs:documentation>A table.</xs:documentation>
- </xs:annotation>
-
- <xs:complexType>
- <xs:sequence minOccurs="0" maxOccurs="unbounded">
-
- <xs:element name="row">
- <xs:annotation>
- <xs:documentation>A row in a table.</xs:documentation>
- </xs:annotation>
-
- <xs:complexType>
- <xs:sequence minOccurs="0" maxOccurs="unbounded">
-
- <xs:element name="cell">
- <xs:annotation>
- <xs:documentation>A cell in a table. Each cell can contain multiple paragraphs or other block elements.</xs:documentation>
- </xs:annotation>
-
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="block"/>
- </xs:choice>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
-
- <!-- ##################################################################
- INLINE CONTENT
- -->
-
- <xs:complexType name="inline" mixed="true">
- <xs:annotation>
- <xs:documentation>Inline elements flow with the text and/or change attributes in the text.</xs:documentation>
- </xs:annotation>
-
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="inline"/>
- </xs:choice>
- </xs:complexType>
-
- <xs:group name="inline">
- <xs:annotation>
- <xs:documentation>Inline elements flow with the text and/or change attributes in the text.</xs:documentation>
- </xs:annotation>
-
- <xs:choice>
- <xs:element ref="b"/>
- <xs:element ref="tab"/>
- <xs:element ref="line"/>
- <xs:element ref="hide"/>
- <xs:element ref="i"/>
- <xs:element ref="strike"/>
- <xs:element ref="u"/>
- <xs:element ref="super"/>
- <xs:element ref="sub"/>
- <xs:element ref="ref"/>
- <xs:element ref="font"/>
- </xs:choice>
- </xs:group>
-
- <xs:element name="line">
- <xs:annotation>
- <xs:documentation>A 'hard' line break.</xs:documentation>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="tab">
- <xs:annotation>
- <xs:documentation>A tab.</xs:documentation>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="b" type="inline">
- <xs:annotation>
- <xs:documentation>Contained text is bold.</xs:documentation>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="i" type="inline">
- <xs:annotation>
- <xs:documentation>Contained text is italic.</xs:documentation>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="u" type="inline">
- <xs:annotation>
- <xs:documentation>Contained text is underlined.</xs:documentation>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="strike" type="inline">
- <xs:annotation>
- <xs:documentation>Contained text is striken out.</xs:documentation>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="super" type="inline">
- <xs:annotation>
- <xs:documentation>Contained text is superscript.</xs:documentation>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="sub" type="inline">
- <xs:annotation>
- <xs:documentation>Contained text is subscript.</xs:documentation>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="hide" type="inline">
- <xs:annotation>
- <xs:documentation>Contained text is hidden.</xs:documentation>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="ref">
- <xs:annotation>
- <xs:documentation>A reference to another part of the document such as a footnote.</xs:documentation>
- </xs:annotation>
-
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="inline"/>
- </xs:choice>
-
- <xs:attribute name="type" fixed="footnote">
- <xs:annotation>
- <xs:documentation>The type of object this reference is pointing to. Currently only footnotes are supported.</xs:documentation>
- </xs:annotation>
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="footnote"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
-
- <xs:attribute name="to" type="xs:string">
- <xs:annotation>
- <xs:documentation>The identifier of the object this reference is pointing to.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
-
- </xs:complexType>
- </xs:element>
-
- <xs:element name="font">
- <xs:annotation>
- <xs:documentation>Font information for contained text [NOTE: This tag is only generated in 'presentation' mode].</xs:documentation>
- </xs:annotation>
-
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="inline"/>
- </xs:choice>
- <xs:attribute name="name" type="xs:string">
- <xs:annotation>
- <xs:documentation>The name of the font.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
-
- <xs:attribute name="size" type="xs:integer">
- <xs:annotation>
- <xs:documentation>The size of the font.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
-
- <xs:attribute name="color" type="xs:integer">
- <xs:annotation>
- <xs:documentation>The color of the text.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
-
- </xs:complexType>
- </xs:element>
-
-
-</xs:schema>
diff --git a/doc/sample.rtf b/doc/sample.rtf
deleted file mode 100644
index c8072a6..0000000
--- a/doc/sample.rtf
+++ /dev/null
@@ -1,68 +0,0 @@
-{\rtf1\ansi\ansicpg1252\uc1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}
-{\f2\fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}{\f3\froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}{\f10\fnil\fcharset2\fprq2{\*\panose 05000000000000000000}Wingdings;}
-{\f121\froman\fcharset238\fprq2 Times New Roman CE;}{\f122\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f124\froman\fcharset161\fprq2 Times New Roman Greek;}{\f125\froman\fcharset162\fprq2 Times New Roman Tur;}
-{\f126\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f127\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f128\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f129\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}
-{\f131\fswiss\fcharset238\fprq2 Arial CE;}{\f132\fswiss\fcharset204\fprq2 Arial Cyr;}{\f134\fswiss\fcharset161\fprq2 Arial Greek;}{\f135\fswiss\fcharset162\fprq2 Arial Tur;}{\f136\fswiss\fcharset177\fprq2 Arial (Hebrew);}
-{\f137\fswiss\fcharset178\fprq2 Arial (Arabic);}{\f138\fswiss\fcharset186\fprq2 Arial Baltic;}{\f139\fswiss\fcharset163\fprq2 Arial (Vietnamese);}{\f141\fmodern\fcharset238\fprq1 Courier New CE;}{\f142\fmodern\fcharset204\fprq1 Courier New Cyr;}
-{\f144\fmodern\fcharset161\fprq1 Courier New Greek;}{\f145\fmodern\fcharset162\fprq1 Courier New Tur;}{\f146\fmodern\fcharset177\fprq1 Courier New (Hebrew);}{\f147\fmodern\fcharset178\fprq1 Courier New (Arabic);}
-{\f148\fmodern\fcharset186\fprq1 Courier New Baltic;}{\f149\fmodern\fcharset163\fprq1 Courier New (Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;
-\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{
-\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 Normal;}{\s1\ql \li0\ri0\sb240\sa60\keepn\widctlpar\aspalpha\aspnum\faauto\outlinelevel0\adjustright\rin0\lin0\itap0
-\b\f1\fs32\lang1033\langfe1033\kerning32\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \styrsid2294299 heading 1;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\*
-\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
-\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}{\*\ts15\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10
-\trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
-\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \sbasedon11 \snext15 \styrsid2294299 Table Grid;}{
-\s16\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext16 \ssemihidden \styrsid1792631 footnote text;}{\*\cs17 \additive \super
-\sbasedon10 \ssemihidden \styrsid1792631 footnote reference;}}{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\listtable{\list\listtemplateid-767292450\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360
-\levelindent0{\leveltext\leveltemplateid67698689\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li720\jclisttab\tx720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext
-\leveltemplateid67698691\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li1440\jclisttab\tx1440\lin1440 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid67698693
-\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0 \fi-360\li2160\jclisttab\tx2160\lin2160 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid67698689\'01\u-3913 ?;}{\levelnumbers
-;}\f3\fbias0 \fi-360\li2880\jclisttab\tx2880\lin2880 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid67698691\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li3600
-\jclisttab\tx3600\lin3600 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid67698693\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0 \fi-360\li4320\jclisttab\tx4320\lin4320 }
-{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid67698689\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li5040\jclisttab\tx5040\lin5040 }{\listlevel\levelnfc23
-\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid67698691\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li5760\jclisttab\tx5760\lin5760 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0
-\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid67698693\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0 \fi-360\li6480\jclisttab\tx6480\lin6480 }{\listname ;}\listid687222349}}{\*\listoverridetable{\listoverride\listid687222349
-\listoverridecount0\ls1}}{\*\rsidtbl \rsid1792631\rsid2294299}{\*\generator Microsoft Word 11.0.6113;}{\info{\title This is a test RTF}{\author Nate}{\operator Nate}{\version2}}\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1800\dgvorigin1440
-\dghshow1\dgvshow1\jexpand\viewkind1\viewscale80\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct
-\asianbrkrule\rsidroot2294299\newtblstyruls\nogrowautofit \fet0{\*\ftnsep \pard\plain \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\insrsid1792631 \chftnsep
-\par }}{\*\ftnsepc \pard\plain \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\insrsid1792631 \chftnsepc
-\par }}{\*\aftnsep \pard\plain \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\insrsid1792631 \chftnsep
-\par }}{\*\aftnsepc \pard\plain \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\insrsid1792631 \chftnsepc
-\par }}\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}
-{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang
-{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain
-\s1\ql \li0\ri0\sb240\sa60\keepn\widctlpar\aspalpha\aspnum\faauto\outlinelevel0\adjustright\rin0\lin0\itap0\pararsid2294299 \b\f1\fs32\lang1033\langfe1033\kerning32\cgrid\langnp1033\langfenp1033 {\insrsid2294299 This is a test RTF
-\par }\pard\plain \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid2294299 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\insrsid2294299 Hi! I\rquote m a test file. This is some }{\b\insrsid2294299 bold}{
-\insrsid2294299 text, and some }{\i\insrsid2294299 italic}{\insrsid2294299 text, as well as some }{\ul\insrsid2294299 underline}{\insrsid2294299 text. And a bit of }{\v\insrsid2294299\charrsid2294299 hidden}{\insrsid2294299 text. So we\rquote
-re going to end this paragraph here and go on to a nice little list:
-\par
-\par {\listtext\pard\plain\f3\insrsid2294299 \loch\af3\dbch\af0\hich\f3 \'b7\tab}}\pard \ql \fi-360\li720\ri0\widctlpar\jclisttab\tx720\aspalpha\aspnum\faauto\ls1\adjustright\rin0\lin720\itap0\pararsid2294299 {\insrsid2294299 Item 1
-\par {\listtext\pard\plain\f3\insrsid2294299 \loch\af3\dbch\af0\hich\f3 \'b7\tab}Item 2
-\par {\listtext\pard\plain\f3\insrsid2294299 \loch\af3\dbch\af0\hich\f3 \'b7\tab}Item 3
-\par {\listtext\pard\plain\f3\insrsid2294299 \loch\af3\dbch\af0\hich\f3 \'b7\tab}Item 4
-\par }\pard \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid2294299 {\insrsid2294299
-\par And now comes a fun table:
-\par
-\par }\trowd \irow0\irowband0\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
-\trftsWidth1\trftsWidthB3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
-\cltxlrtb\clftsWidth3\clwWidth2952\clshdrawnil \cellx2844\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2952\clshdrawnil \cellx5796\clvertalt\clbrdrt\brdrs\brdrw10
-\clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2952\clshdrawnil \cellx8748\pard\plain \ql \li0\ri0\widctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid2294299\yts15
-\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\insrsid2294299 Cell 1\cell Cell 2
-\par More in cell 2\cell Cell 3\cell }\pard\plain \ql \li0\ri0\widctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\insrsid2294299 \trowd \irow0\irowband0\ts15\trgaph108\trleft-108\trbrdrt
-\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
-\trftsWidth1\trftsWidthB3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
-\cltxlrtb\clftsWidth3\clwWidth2952\clshdrawnil \cellx2844\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2952\clshdrawnil \cellx5796\clvertalt\clbrdrt\brdrs\brdrw10
-\clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2952\clshdrawnil \cellx8748\row }\pard\plain \ql \li0\ri0\widctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid2294299\yts15
-\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\insrsid2294299 Next row\cell Next row \cell Next row\cell }\pard\plain \ql \li0\ri0\widctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0
-\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\insrsid2294299 \trowd \irow1\irowband1\lastrow \ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv
-\brdrs\brdrw10 \trftsWidth1\trftsWidthB3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr
-\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2952\clshdrawnil \cellx2844\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2952\clshdrawnil \cellx5796\clvertalt\clbrdrt
-\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2952\clshdrawnil \cellx8748\row }\pard \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid2294299 {
-\insrsid2294299
-\par A page break:
-\par \page And here we\rquote re on the next page.}{\insrsid1792631 }{\insrsid2294299
-\par }{\insrsid1792631 This para has a }{\cs17\super\insrsid1792631 \chftn {\footnote \pard\plain \s16\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\cs17\super\insrsid1792631
-\chftn }{\insrsid1792631 This is the actual content of the footnote.}}}{\insrsid1792631 footnote.
-\par And here\rquote s yet another paragraph. }{\insrsid1792631\charrsid2294299
-\par }} \ No newline at end of file
diff --git a/doc/sample.xml b/doc/sample.xml
deleted file mode 100644
index 85b8bfa..0000000
--- a/doc/sample.xml
+++ /dev/null
@@ -1 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><document xmlns="http://memberwebs.com/ns/rtfx/"><info><title>This is a test RTF</title><author>Nate</author><operator>Nate</operator></info><stylesheet><style name="Normal"/><style name="heading 1"/><style name="footnote text"/></stylesheet><options><font size="12" color="0" name="Times New Roman"/></options><para style="heading 1"><font name="1" size="16"><b>This is a test RTF</b></font></para><para>Hi! I’m a test file. This is some <b>bold</b> text, and some <i>italic</i> text, as well as some <u>underline</u> text. And a bit of <hide>hidden</hide> text. So we’re going to end this paragraph here and go on to a nice little list:</para><para/><list type="disc" ordered="0" start="1"><para>Item 1</para><para>Item 2</para><para>Item 3</para><para>Item 4</para></list><para/><para>And now comes a fun table:</para><para/><table><row><cell><para>Cell 1</para></cell><cell><para>Cell 2</para><para>More in cell 2</para></cell><cell><para>Cell 3</para></cell></row><row><cell><para>Next row</para></cell><cell><para>Next row </para></cell><cell><para>Next row</para></cell></row></table><para/><para>A page break:</para><page/><para>And here we’re on the next page. </para><para>This para has a <ref type="footnote" to="1"><super>1</super></ref>footnote.</para><para>And here’s yet another paragraph. </para><para/><footnote id="1"><para><font size="10"><super>1</super> This is the actual content of the footnote.</font></para></footnote></document> \ No newline at end of file
diff --git a/src/.cvsignore b/src/.cvsignore
deleted file mode 100644
index 52605a3..0000000
--- a/src/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-.deps
-Makefile
-Makefile.in
-rtfx
diff --git a/src/Makefile.am b/src/Makefile.am
deleted file mode 100644
index 317aa41..0000000
--- a/src/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-
-bin_PROGRAMS = rtfx
-
-rtfx_SOURCES = rtfx.cpp levelhandler.cpp levelhandler.h \
- reference.h xmlcomposer.cpp xmlcomposer.h xmlcomposehelpers.cpp rtfformatting.h \
- xmlcomposehelpers.h rtfparser.cpp rtfparser.h sablo.h sablotr.cpp usuals.h \
- xmlfixups.h xmlfixups.cpp domhelpers.h domhelpers.cpp tags.h
-rtfx_LDADD = -lsablot -lexpat $(LIB_ICONV)
-rtfx_CFLAGS = -O0 -I${top_srcdir} -I/usr/local/include
-rtfx_LDFLAGS = -L/usr/local/lib
-man_MANS = rtfx.1
-
-EXTRA_DIST = $(man_MANS)
-
diff --git a/src/domhelpers.cpp b/src/domhelpers.cpp
deleted file mode 100644
index 9a9cfd2..0000000
--- a/src/domhelpers.cpp
+++ /dev/null
@@ -1,370 +0,0 @@
-/*
- * Copyright (c) 2004, Nate Nielsen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- *
- * CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
- *
- */
-
-#include "usuals.h"
-#include "domhelpers.h"
-#include "tags.h"
-
-using std::make_pair;
-
-bool DOMHelpers::isElement(const DOM::Node& node, const string& name)
-{
- return node != NULL && node.getNodeType() == DOM::Node::ELEMENT_NODE &&
- node.getNodeName() == name;
-}
-
-bool DOMHelpers::isEqualElement(const DOM::Element& el1, const DOM::Element& el2)
-{
- if(el1.getNodeName() != el2.getNodeName())
- return false;
-
- // Compare attributes
- DOM::NamedNodeMap at1 = el1.getAttributes();
- DOM::NamedNodeMap at2 = el2.getAttributes();
-
- if(at1 == NULL && at2 == NULL)
- return true;
-
- if(at1 == NULL || at2 == NULL ||
- at1->getLength() != at2->getLength())
- return false;
-
- for(int i = 0; i < at1->getLength(); i++)
- {
- DOM::Attr attr1 = (const DOM::Attr&)at1->item(0);
- if(attr1 == NULL)
- return false;
-
- DOM::Attr attr2 = (const DOM::Attr&)at2->getNamedItem(attr1.getNodeName());
- if(attr2 == NULL)
- return false;
-
- if(attr1.getNodeValue() != attr2.getNodeValue())
- return false;
- }
-
- return true;
-}
-
-DOM::Element DOMHelpers::getContainingElement(const DOM::Node& node, const string& name)
-{
- DOM::Node n = node;
-
- while(true)
- {
- n = n.getParentNode();
- if(n == NULL)
- break;
-
- // Match parent to given name
- if(isElement(n, name))
- return (DOM::Element&)n;
- }
-
- return DOM::Element();
-}
-
-bool isNsAttr(const string& name)
-{
- // Check if this attribute is a xmlns: attribute
- return strncmp(name.c_str(), kNSPrefix, strlen(kNSPrefix)) ? false : true;
-}
-
-void DOMHelpers::copyAttributes(const DOM::Element& src, DOM::Element& dest,
- const char** hideList)
-{
- // Get both sets of attributes
- DOM::NamedNodeMap srcMap = src.getAttributes();
- DOM::NamedNodeMap destMap = dest.getAttributes();
-
- if(srcMap == NULL || destMap == NULL)
- return;
-
- // And copy them from one to the other
- for(int j = 0; j < srcMap->getLength(); j++)
- {
- DOM::Node attr = srcMap->item(j);
- if(attr != NULL)
- {
- string name = attr.getNodeName();
-
- if(hideList)
- {
- for(const char** t = hideList; *t != NULL; t++)
- {
- if(name == *t)
- name.erase();
- }
- }
-
- // BUG: Sablotron seems to have a bug in it's
- // setAttributeNode implementation. It always
- // adds a blank namespace
- //
- // attr = attr.cloneNode(false);
- // if(attr != NULL)
- // destMap.setNamedItem(attr);
-
- // We never copy xmlns: attributes
- if(name.length() > 0 && !isNsAttr(name))
- dest.setAttribute(attr.getNodeName(), attr.getNodeValue());
- }
- }
-}
-
-DOM::Element DOMHelpers::getPriorElement(const DOM::Node& node, const string& name)
-{
- DOM::Node n = node;
-
- while(n != NULL)
- {
- // Note that we return ourselves if it matches
- if(isElement(n, name))
- return (DOM::Element&)n;
-
- n = n.getPreviousSibling();
- }
-
- DOM::Node parent = node.getParentNode();
-
- if(parent == NULL)
- return DOM::Element();
- else
- return getPriorElement(parent, name);
-}
-
-void DOMHelpers::insertAfter(DOM::Node& parent, const DOM::Node& node,
- const DOM::Node& ref)
-{
- DOM::Node sibling = ref.getNextSibling();
-
- if(sibling == NULL)
- parent.appendChild(node);
- else
- parent.insertBefore(node, sibling);
-}
-
-DOM::Element DOMHelpers::findChildElement(const DOM::Node& parent, const string& name)
-{
- DOM::Node child = parent.getFirstChild();
- while(child != NULL)
- {
- if(isElement(child, name))
- return (DOM::Element&)child;
- }
-
- return DOM::Element();
-}
-
-bool DOMHelpers::hasAncestor(const DOM::Node& ancestor, const DOM::Node& node)
-{
- DOM::Node n = node;
-
- while(n != NULL)
- {
- if(n == ancestor)
- return true;
-
- n = n.getParentNode();
- }
-
- return false;
-}
-
-
-/* ----------------------------------------------------------------------------------
- * ElementTable
- */
-
-void ElementTable::load(const DOM::Node& parent, const string& name)
-{
- clear();
-
- DOM::Node child = parent.getFirstChild();
- while(child != NULL)
- {
- if(DOMHelpers::isElement(child, name))
- {
- DOM::Element& el = (DOM::Element&)child;
- wstring id = el.getAttribute(kAtId);
-
- if(!id.empty())
- insert(make_pair(id, el));
- }
-
- child = child.getNextSibling();
- }
-}
-
-DOM::Element ElementTable::get(const wstring& id) const
-{
- const_iterator it = find(id);
- return it == end() ? DOM::Element() : it->second;
-}
-
-void ElementTable::removeIds()
-{
- iterator it = begin();
- iterator e = end();
-
- for( ; it != e; it++)
- it->second.removeAttribute(kAtId);
-}
-
-/* ----------------------------------------------------------------------------------
- * ElementIterator
- */
-
-void ElementIterator::next()
-{
- if(m_flags == AFTER_LAST)
- return;
-
- if(m_flags == BEFORE_FIRST)
- m_current = m_top;
-
- ASSERT(m_current != NULL);
-
- DOM::Node n;
-
- // Always descend into children first
- if(m_current.hasChildNodes())
- {
- n = nextel(m_current.getFirstChild());
- if(n != NULL)
- {
- m_current = n;
- m_flags = ITERATING;
- return;
- }
- }
-
- // Look for siblings along the current level
- n = nextel(m_current.getNextSibling());
- if(n != NULL)
- {
- m_current = n;
- m_flags = ITERATING;
- return;
- }
-
- for(;;)
- {
- // Go back up to parent, and get it's next sibling
- m_current = m_current.getParentNode();
- if(m_current == NULL || m_current == m_top)
- break;
-
- n = nextel(m_current.getNextSibling());
- if(n != NULL)
- {
- m_current = n;
- m_flags = ITERATING;
- return;
- }
- }
-
- m_flags = AFTER_LAST;
- m_current = NULL;
-}
-
-DOM::Element ElementIterator::nextel(DOM::Node node)
-{
- while(node != NULL)
- {
- if(node.getNodeType() == DOM::Element::ELEMENT_NODE)
- return (DOM::Element&)node;
-
- node = node.getNextSibling();
- }
-
- return DOM::Element();
-}
-
-void ElementIterator::prev()
-{
- if(m_flags == BEFORE_FIRST)
- return;
-
- DOM::Node n;
-
- if(m_flags == AFTER_LAST)
- n = m_top;
- else
- n = prevel(m_current.getPreviousSibling());
-
- while(n != NULL)
- {
- m_current = n;
-
- n = n.hasChildNodes() ?
- prevel(m_current.getLastChild()) : DOM::Node();
-
- if(n == NULL)
- {
- m_flags = ITERATING;
- return;
- }
- }
-
- // Go back up to parent
- m_current = m_current.getParentNode();
-
- if(m_current == NULL || m_current == m_top)
- {
- m_flags = BEFORE_FIRST;
- m_current = NULL;
- return;
- }
-
-
-}
-
-
-DOM::Element ElementIterator::prevel(DOM::Node node)
-{
- while(node != NULL)
- {
- if(node.getNodeType() == DOM::Element::ELEMENT_NODE)
- return (DOM::Element&)node;
-
- node = node.getPreviousSibling();
- }
-
- return DOM::Element();
-}
diff --git a/src/domhelpers.h b/src/domhelpers.h
deleted file mode 100644
index 8b14e2b..0000000
--- a/src/domhelpers.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (c) 2004, Nate Nielsen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- *
- * CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
- *
- */
-
-#ifndef __DOMHELPERS_H__
-#define __DOMHELPERS_H__
-
-#include "sablo.h"
-#include <map>
-#include <stack>
-#include <set>
-
-/*
- * DOMHelpers
- *
- * A collection of functions for doing some things with an XML DOM.
- * Used mainly by XMLComposer.
- */
-class DOMHelpers
-{
-public:
-
- // Check if given node is an element with a certain name
- static bool isElement(const DOM::Node& node, const string& name);
-
- // Check if two elements have the same name and attributes
- static bool isEqualElement(const DOM::Element& el1, const DOM::Element& el2);
-
- // Copy attributes from one element to another optionaly ignoring some
- static void copyAttributes(const DOM::Element& src, DOM::Element& dest, const char** hideList);
-
- // Insert a child node after a given reference node
- static void insertAfter(DOM::Node& parent, const DOM::Node& node, const DOM::Node& ref);
-
- // Get containing element of a given name
- static DOM::Element getContainingElement(const DOM::Node& node, const string& name);
-
- // Get previous element (in XML flow) of a given name
- static DOM::Element getPriorElement(const DOM::Node& node, const string& name);
-
- // Get first child element of a given name
- static DOM::Element findChildElement(const DOM::Node& parent, const string& name);
-
- // Check if a given element is anothers ancestor
- static bool hasAncestor(const DOM::Node& ancestor, const DOM::Node& node);
-};
-
-/*
- * ElementTable
- *
- * A table of elements matched to their ids for quick access while applying
- * things like fonts, styles, lists from their definitions.
- */
-class ElementTable :
- public std::map<wstring, DOM::Element>
-{
-public:
- void load(const DOM::Node& parent, const string& name);
-
- DOM::Element get(const wstring& id) const;
-
- bool has(const wstring& id) const
- { return find(id) != end(); }
-
- void removeIds();
-};
-
-// Some other handy types
-typedef std::set<string> StringSet;
-typedef std::stack<DOM::Node> NodeStack;
-
-/*
- * ElementIterator
- *
- * For iterating through the elements in a document.
- */
-class ElementIterator
- : public std::iterator<std::input_iterator_tag, DOM::Element, ptrdiff_t>
-{
-public:
- ElementIterator()
- { m_flags = AFTER_LAST; }
- ElementIterator(const DOM::Element& top)
- { m_top = top; m_flags = BEFORE_FIRST; next(); }
- ElementIterator(const ElementIterator& x)
- { m_top = x.m_top; m_current = x.m_current; m_flags = x.m_flags; }
-
- const DOM::Element& operator*() const
- { return m_current; }
- const DOM::Element* operator->() const
- { return (&**this); }
- const ElementIterator& operator++()
- { next(); return (*this); }
- const ElementIterator& operator--()
- { prev(); return (*this); }
-
- // Friend comparision functions
- friend bool operator==(const ElementIterator& x, const ElementIterator& y);
- friend bool operator!=(const ElementIterator& x, const ElementIterator& y);
-
-// Implementation
-protected:
-
- void next();
- DOM::Element nextel(DOM::Node node);
-
- void prev();
- DOM::Element prevel(DOM::Node node);
-
-// Data
-protected:
-
- enum
- {
- ITERATING,
- BEFORE_FIRST,
- AFTER_LAST
- };
-
- DOM::Element m_top;
- DOM::Element m_current;
- int m_flags;
-};
-
-// friend functions
-inline bool operator==(const ElementIterator& x, const ElementIterator& y)
- { return y.m_current == x.m_current && y.m_flags == x.m_flags; }
-inline bool operator!=(const ElementIterator& x, const ElementIterator& y)
- { return (!(x == y)); }
-
-#endif // __DOMHELPERS_H__
diff --git a/src/levelhandler.cpp b/src/levelhandler.cpp
deleted file mode 100644
index 20751b2..0000000
--- a/src/levelhandler.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) 2004, Nate Nielsen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- *
- * CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
- *
- */
-
-#include "usuals.h"
-#include "levelhandler.h"
-
-/* ----------------------------------------------------------------------------------
- * CONSTRUCTION
- */
-LevelHandler::LevelHandler()
-{
- m_parser = NULL;
-}
-
-LevelHandler::~LevelHandler()
-{
- clear();
-}
-
-void LevelHandler::clear()
-{
- m_curLevel.release();
- m_topLevel.release();
-
- m_parser = NULL;
-}
-
-/* ----------------------------------------------------------------------------------
- * OVERRIDES
- */
-
-void LevelHandler::startDocument(RtfParser* parser)
-{
- clear();
-
- m_parser = parser;
-
- m_topLevel = new Level;
- m_curLevel = m_topLevel;
-}
-
-void LevelHandler::endDocument()
-{
-
-}
-
-void LevelHandler::groupStart()
-{
- ASSERT(m_curLevel);
- pushLevel();
-}
-
-void LevelHandler::groupEnd()
-{
- ASSERT(m_curLevel);
- popLevel();
-}
-
-/* ----------------------------------------------------------------------------------
- * OPERATIONS
- */
-
-DOM::Element LevelHandler::getElement()
-{
- ASSERT(m_curLevel);
- return m_curLevel->getElement();
-}
-
-void LevelHandler::pushLevel()
-{
- // Push a level on the stack
- m_curLevel = m_curLevel->pushLevel();
-}
-
-void LevelHandler::popLevel()
-{
- // Pull a level off the stack
- LevelPtr level = m_curLevel->getPrevious();
-
- if(level)
- m_curLevel = level;
-}
-
-void LevelHandler::rewindLevel(LevelPtr ptr)
-{
- ASSERT(ptr != NULL);
-
- LevelPtr prev = ptr->getPrevious();
-
- if(prev != NULL)
- m_curLevel = prev;
- else
- m_curLevel = ptr;
-}
-
-LevelPtr LevelHandler::getLevel()
-{
- return m_curLevel;
-}
diff --git a/src/levelhandler.h b/src/levelhandler.h
deleted file mode 100644
index 8a183f2..0000000
--- a/src/levelhandler.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2004, Nate Nielsen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- *
- * CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
- *
- */
-
-#ifndef __LEVELHANDLER_H__
-#define __LEVELHANDLER_H__
-
-#include "rtfparser.h"
-#include "reference.h"
-#include "xmlcomposehelpers.h"
-
-/*
- * LevelHandler
- *
- * A base class that manages a set of Levels (see xmlcomposehelpers.cpp)
- * based on the RTF groups seen.
- */
-class LevelHandler
- : public RtfHandler
-{
-public:
- LevelHandler();
- virtual ~LevelHandler();
-
- // Overrides
- virtual void startDocument(RtfParser* parser);
- virtual void endDocument();
- virtual void groupStart();
- virtual void groupEnd();
-
- // Convenience function to get XML element from current level
- virtual DOM::Element getElement();
-
- // Create a new level on top of stack
- void pushLevel();
-
- // Pop top level and discard
- void popLevel();
-
- // Back out all the way past a given level
- void rewindLevel(LevelPtr ptr);
-
- // Get the current level
- LevelPtr getLevel();
-
-protected:
- virtual void clear();
-
- LevelPtr m_topLevel; // First level
- LevelPtr m_curLevel; // The current level
- RtfParser* m_parser; // The parser we're listening to
-};
-
-#endif // __LEVELHANDLER_H__
diff --git a/src/reference.h b/src/reference.h
deleted file mode 100644
index 1a78d4c..0000000
--- a/src/reference.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2004, Nate Nielsen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- *
- * CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
- *
- */
-
-#ifndef __REFERENCE_H__
-#define __REFERENCE_H__
-
-/*
- * Reference
- *
- * A basic reference counting pointer
- */
-template<typename C>
-class Reference
-{
-public:
- Reference()
- { m_ptr = NULL; }
-
- Reference(C* ptr)
- {
- m_ptr = ptr;
- addref();
- }
-
- Reference(C* ptr, bool addref)
- {
- m_ptr = ptr;
- if(addref)
- addref();
- }
-
- ~Reference()
- { release(); }
-
- Reference(const Reference& orig)
- {
- m_ptr = orig.m_ptr;
- addref();
- }
-
- Reference& operator=(const C* ptr)
- {
- C* old = m_ptr;
- m_ptr = (C*)ptr;
- addref();
- if(old)
- old->release();
- return *this;
- }
-
- Reference& operator=(const Reference& orig)
- { return operator=(orig.m_ptr); }
-
- void attach(C* ptr)
- {
- release();
- m_ptr = ptr;
- }
-
- C* detach()
- {
- C* ptr = m_ptr;
- m_ptr = NULL;
- return ptr;
- }
-
- operator C*() const
- { return m_ptr; }
-
- C* operator->() const
- { return m_ptr; }
-
-#if 0
- operator bool() const
- {
- return m_ptr != NULL;
- }
-#endif
-
- void release()
- {
- if(m_ptr)
- m_ptr->release();
- m_ptr = NULL;
- }
-
- void addref()
- {
- if(m_ptr)
- m_ptr->addRef();
- }
-
-private:
- C* m_ptr;
-};
-
-/*
- * Instance
- *
- * A basic reference counted object.
- */
-class Instance
-{
-public:
- Instance()
- { m_x = 0; }
- virtual ~Instance()
- { }
- void addRef()
- { m_x++; }
- void release()
- {
- if((--m_x) <= 0)
- delete this;
- }
-
-private:
- // The reference count
- int m_x;
-};
-
-#endif //__REFERENCE_H__
diff --git a/src/rtfformatting.h b/src/rtfformatting.h
deleted file mode 100644
index aa5ac58..0000000
--- a/src/rtfformatting.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright (c) 2004, Nate Nielsen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- *
- * CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
- *
- */
-
-#ifndef __RTFFORMATTING_H__
-#define __RTFFORMATTING_H__
-
-/*
- * RtfFormatting
- *
- * For keeping track of all the various transient formatting options
- * within a given Rtf group. Any supported text options (not block)
- * should be added here.
- */
-class RtfFormatting
-{
-public:
- RtfFormatting()
- {
- resetText();
- resetPara();
- }
-
- RtfFormatting(const RtfFormatting& format)
- {
- copy(format);
- }
-
- bool textEquals(const RtfFormatting& format) const
- {
- return m_bold == format.m_bold &&
- m_italic == format.m_italic &&
- m_strike == format.m_italic &&
- m_hidden == format.m_hidden &&
- m_underline == format.m_underline &&
- m_color == format.m_color &&
- m_suscript == format.m_suscript &&
- m_font == format.m_font &&
- m_fsize == format.m_fsize;
- }
-
- bool paraEquals(RtfFormatting& format) const
- {
- return m_style == format.m_style &&
- m_list == format.m_list &&
- m_inTbl == format.m_inTbl;
- }
-
- void copy(const RtfFormatting& format)
- {
- m_bold = format.m_bold;
- m_italic = format.m_italic;
- m_strike = format.m_italic;
- m_hidden = format.m_hidden;
- m_underline = format.m_underline;
- m_color = format.m_color;
- m_suscript = format.m_suscript;
- m_font = format.m_font;
- m_fsize = format.m_fsize;
-
- m_style = format.m_style;
- m_list = format.m_list;
- m_inTbl = format.m_inTbl;
- }
-
- void resetText()
- {
- m_bold = m_italic = m_strike =
- m_underline = m_hidden = false;
- m_color = -1;
- m_suscript = 0;
- m_fsize = -1;
- m_font = -1;
- }
-
- void resetPara()
- {
- m_style = m_list = -1;
- m_inTbl = false;
- }
-
- bool textIsBold() const
- { return m_bold; }
- bool textIsItalic() const
- { return m_italic; }
- bool textIsStrike() const
- { return m_strike; }
- bool textIsUnderline() const
- { return m_underline; }
- bool textIsHidden() const
- { return m_hidden; }
- int textColor() const
- { return m_color; }
- int textSuScript() const
- { return m_suscript; }
- int textFont() const
- { return m_font; }
- int textFontSize() const
- { return m_fsize; }
- int paraStyle() const
- { return m_style; }
- int paraList() const
- { return m_list; }
- bool paraInTable() const
- { return m_inTbl; }
-
- void textSetBold(bool bold)
- { m_bold = bold; }
- void textSetItalic(bool italic)
- { m_italic = italic; }
- void textSetStrike(bool strike)
- { m_strike = strike; }
- void textSetUnderline(bool underline)
- { m_underline = underline; }
- void textSetHidden(bool hidden)
- { m_hidden = hidden; }
- void textSetColor(int color)
- { m_color = color; }
- void textSetSuScript(int suscript)
- { m_suscript = suscript; }
- void textSetFont(int font)
- { m_font = font; }
- void textSetFontSize(int fsize)
- { m_fsize = fsize == 24 ? -1 : fsize; } // default font size is always 24
- void paraSetStyle(int style)
- { m_style = style; }
- void paraSetList(int list)
- { m_list = list; }
- void paraSetTable(bool inTable)
- { m_inTbl = inTable; }
-
- enum
- {
- SUPERSCRIPT = 1,
- SUBSCRIPT
- };
-
-protected:
- bool m_bold;
- bool m_italic;
- bool m_strike;
- bool m_underline;
- bool m_hidden;
- int m_suscript;
- int m_color;
- int m_font;
- int m_fsize;
-
- int m_style;
- int m_list;
- bool m_inTbl;
-
- // TODO: Character styles
-};
-
-#endif // __RTFFORMATTING_H__
diff --git a/src/rtfparser.cpp b/src/rtfparser.cpp
deleted file mode 100644
index c136e95..0000000
--- a/src/rtfparser.cpp
+++ /dev/null
@@ -1,442 +0,0 @@
-/*
- * Copyright (c) 2004, Nate Nielsen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- *
- * CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
- *
- */
-
-#include "usuals.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "rtfparser.h"
-
-
-/* ----------------------------------------------------------------------------------
- * CONSTRUCTION
- */
-
-RtfParser::RtfParser()
-{
- m_handler = NULL;
- m_depth = 0;
- m_parseHex = true;
- m_parseUnicode = false;
- m_uniEat = 0;
- m_uniEatStack.push(0);
-}
-
-RtfParser::~RtfParser()
-{
-
-}
-
-
-/* ----------------------------------------------------------------------------------
- * PUBLIC METHODS
- */
-
-bool RtfParser::parse(string fileName)
-{
- FILE* file = fopen(fileName.c_str(), "r");
- if(!file)
- return false;
-
- bool ret = parse(file);
-
- fclose(file);
-
- return ret;
-}
-
-bool RtfParser::parse(FILE* file)
-{
- int ch = 0;
- bool isData = false;
-
- m_depth = 0;
- m_parseErrors = "";
- m_file = file;
-
- if(m_handler)
- m_handler->startDocument(this);
-
- while(1)
- {
- ch = fgetc(file);
- if(ch == EOF)
- goto done;
-
- switch(ch)
- {
-
- // Starting a control word
- case '\\':
- if(!parseControlWord())
- goto done;
- break;
-
- // Starting an RTF group
- case '{':
- {
- // Send all previous data
- flushData();
-
- // Handle any unicode destinations properly
- m_uniEatStack.push(m_uniEatStack.top());
-
- if(m_handler)
- m_handler->groupStart();
-
- m_depth++;
- }
- break;
-
- case '}':
- {
- // Send all previous data
- flushData();
-
- if(m_handler)
- m_handler->groupEnd();
-
- // Handle any unicode destinations properly
- if(!m_uniEatStack.empty())
- m_uniEatStack.pop();
-
- m_depth--;
- }
- break;
-
- default:
- isData = true;
- break;
- }
-
- if(isData)
- {
- // We translate tabs into the appropriate control word
- if(ch == '\t')
- sendControlWord("tab", 0, -1);
-
- // line endings aren't used
- else if(!strchr("\r\n", ch))
- sendData(ch);
-
- isData = false;
- }
- }
-
-
-done:
-
- if(m_depth != 0)
- m_parseErrors.append("unmatched braces\n");
-
- if(m_handler)
- m_handler->endDocument();
-
- m_file = NULL;
- m_dataBuffer.resize(0);
-
- // If any parse errors return failure
- return m_parseErrors.empty();
-}
-
-
-/* ----------------------------------------------------------------------------------
- * HANDLER CALLS
- */
-
-void RtfParser::flushData()
-{
- if(!m_dataBuffer.empty())
- {
- if(m_handler)
- m_handler->charData(m_dataBuffer);
-
- m_dataBuffer.resize(0);
- }
-}
-
-void RtfParser::sendData(wchar_t ch)
-{
- // Skip unicode chars we've been asked to
- if(m_uniEat > 0)
- m_uniEat--;
-
- else
- m_dataBuffer.append(1, ch);
-}
-
-void RtfParser::sendData(wstring data)
-{
- // Skip any unicode chars we've been asked to
- if(m_uniEat > 0)
- {
- int len = data.size();
- if(len > m_uniEat)
- len = m_uniEat;
-
- m_dataBuffer.append(data.substr(len));
- m_uniEat -= len;
- }
- else
- {
- m_dataBuffer.append(data);
- }
-}
-
-void RtfParser::sendControlWord(string cw, int flags, int param)
-{
- flushData();
-
- if(m_handler)
- m_handler->controlWord(cw, flags, param);
-}
-
-
-/* ----------------------------------------------------------------------------------
- * PARSE HELPERS
- */
-
-bool RtfParser::parseHexChar(int num)
-{
- string data;
-
- // Get num chars and put them in the string
- for(int i = 0; i < num; i++)
- {
- char ch = fgetc(m_file);
-
- if(ch == -1)
- return false;
-
- if((ch >= 'A' && ch <= 'F') ||
- (ch >= 'a' && ch <= 'f') ||
- (ch >= '0' && ch <= '9'))
- {
- data.append(1, ch);
- }
- else
- {
- m_parseErrors.append((string)"invalid hex char: " + ch + "\n");
- }
- }
-
- // If parsing hex, then convert to appropriate unicode
- if(m_parseHex)
- {
- char* end = NULL;
- int val = strtol(data.c_str(), &end, 16);
- if(end == data.c_str() + data.size() && m_parseHex)
- sendData(val);
- else
- m_parseErrors.append("invalid hex char: " + data + "\n");
- }
-
- // TODO: Why would we ever want to do this?
- // Otherwise just send as a hex control word
- else
- {
- sendControlWord(data, RtfHandler::kIsEncoded, -1);
- }
-
- return true;
-}
-
-bool RtfParser::parseControlWord()
-{
- bool isAsterisk = false;
- string controlword;
- string param;
-
- while(1)
- {
- int ch = fgetc(m_file);
- if(ch == WEOF)
- return false;
-
- bool empty = controlword.empty();
-
- // Part of the name of a control word
- // NOTE: Although the RTF specification prohibits uppercase
- // control words, MS Word uses them :-/
- if(ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z')
- controlword.append(1, (char)ch);
-
- // Part of the parameter of a control word
- else if(ch >= '0' && ch <= '9')
- param.append(1, (char)ch);
-
- // Now handle escapes and other special types of
- // control words. These are all only valid at beginning
- // of the "control word"
-
- // hex spelled out character
- else if(empty && ch == '\'')
- {
- parseHexChar(2);
- break;
- }
-
- // Asterisk type destination
- else if(empty && ch == '*')
- {
- isAsterisk = true;
-
- ch = fgetc(m_file);
- while(strchr("\r\n", ch))
- ch = fgetc(m_file);
-
- if(ch != '\\')
- ungetc(ch, m_file);
- }
-
- // Escaped backslash
- else if(empty && ch == '\\')
- {
- sendData(L'\\');
- break;
- }
-
- // Escaped braces
- else if(empty && ch == '{')
- {
- sendData(L'{');
- }
-
- else if(empty && ch == '}')
- {
- sendData(L'}');
- }
-
- // Non breaking space
- else if(empty && ch == '~')
- {
- sendData(0x00A0);
- break;
- }
-
- // Optional hyphen
- else if(empty && ch == '-')
- {
- sendData(0x00AD);
- break;
- }
-
- // a hyphen right after control word is part of number
- else if(!empty && param.empty() && ch == '-')
- {
- param.append(1, (char)ch);
- }
-
- // Space at end a rtf code (it gets eaten)
- else if(strchr(" ", ch))
- break;
-
- // Anything else (including a backslash ends a control word)
- else
- {
- ungetc(ch, m_file);
- break;
- }
- }
-
- // Empty out the control word buffers
- if(!controlword.empty())
- {
- int flags = isAsterisk ? RtfHandler::kAsterisk : 0;
- int numPar = -1;
-
- if(!param.empty())
- {
- char* end = NULL;
- numPar = strtol(param.c_str(), &end, 10);
- if(end == param.c_str() + param.size())
- flags += RtfHandler::kHasParam;
- }
-
- // Here we check for common characters
- if(controlword == "emdash")
- sendData(0x2014);
- else if(controlword == "endash")
- sendData(0x2013);
- else if(controlword == "emspace")
- sendData(0x2003);
- else if(controlword == "enspace")
- sendData(0x2002);
- else if(controlword == "bullet")
- sendData(0x2022);
- else if(controlword == "lquote")
- sendData(0x2018);
- else if(controlword == "rquote")
- sendData(0x2019);
- else if(controlword == "ldblquote")
- sendData(0x201C);
- else if(controlword == "rdblquote")
- sendData(0x201D);
-
- // Unicode values get sent through
- else if(m_parseUnicode && flags & RtfHandler::kHasParam &&
- controlword == "u" )
- {
- sendData(numPar);
- m_uniEat = m_uniEatStack.top();
- }
-
- // Unicode destination
- else if(m_parseUnicode && controlword == "ud")
- {
-
- }
-
- // Skip value for unicode characters
- else if(m_parseUnicode && controlword == "uc")
- {
- m_uniEatStack.pop();
- m_uniEatStack.push(numPar);
- }
-
- // Otherwise we send the control word
- else
- {
- if(m_handler)
- sendControlWord(controlword, flags, numPar);
- }
- }
-
- return true;
-}
-
diff --git a/src/rtfparser.h b/src/rtfparser.h
deleted file mode 100644
index 9509a35..0000000
--- a/src/rtfparser.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2004, Nate Nielsen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- *
- * CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
- *
- */
-
-#ifndef __RTFPARSER_H__
-#define __RTFPARSER_H__
-
-#include "usuals.h"
-#include <stack>
-#include <stdio.h>
-
-class RtfHandler;
-
-/*
- * RtfParser
- *
- * A class that parses the RTF into it's tags and groups etc... It feeds its
- * parsed data into into a handler interface (see below) for processing.
- *
- * Performs some basic conversion and sanity checking (unicode chars etc...)
- * as well.
- */
-class RtfParser
-{
-public:
- RtfParser();
- virtual ~RtfParser();
-
- bool parse(string fileName);
- bool parse(FILE* file);
-
- void setHandler(RtfHandler* handler)
- { m_handler = handler; }
- string getParseErrors() const
- { return m_parseErrors; }
- int getDepth() const
- { return m_depth; }
- void setHexParse(bool parse)
- { m_parseHex = parse; }
- void setUnicode(bool unicode);
-
-protected:
- RtfHandler* m_handler; // The current handler
- int m_depth; // To keep track of group depth
- bool m_parseHex; // Whether to parse hex chars or not
- string m_parseErrors; // A list of all the RTF parsing errors
-
- // TODO: Look at exactly what this is doing
- // Unicode char handling
- bool m_parseUnicode;
- typedef std::stack<int> StackInt;
- StackInt m_uniEatStack;
- int m_uniEat;
-
- FILE* m_file; // The file we're currently parsing
- wstring m_dataBuffer; // The block of data we're caching to send
-
-private:
-
- // Parse helpers
- bool parseControlWord();
- bool parseHexChar(int num);
-
- // Convenience functions for calling the handler
- void sendControlWord(string cw, int flags, int param);
- void sendData(wchar_t ch);
- void sendData(wstring data);
- void flushData();
-};
-
-/*
- * RtfHandler
- *
- * An interface called by RtfParser with tags and groups etc... parsed from
- * an RTF file.
- */
-class RtfHandler
-{
-public:
-
- // Called at the beginning of the document
- virtual void startDocument(RtfParser* reader) = 0;
-
- // Called at the end of the document
- virtual void endDocument() = 0;
-
- // Called when an RTF control word is hit. Flags below.
- // If control word has no param then param is -1
- virtual void controlWord(const string& cw, int flags, int param) = 0;
-
- // Called when an RTF group opened
- virtual void groupStart() = 0;
-
- // Called when an RTF group is closed
- virtual void groupEnd() = 0;
-
- // A block of character data encountered
- virtual void charData(wstring data) = 0;
-
- // Flags for controlWord
- enum
- {
- kAsterisk = 0x00000001,
- kHasParam = 0x00000002,
- kIsEncoded = 0x00000004
- };
-};
-
-#endif // __RTFPARSER_H__
diff --git a/src/rtfx.1 b/src/rtfx.1
deleted file mode 100644
index 6119ef8..0000000
--- a/src/rtfx.1
+++ /dev/null
@@ -1,73 +0,0 @@
-.\"
-.\" Copyright (c) 2004, Nate Nielsen
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\"
-.\" * Redistributions of source code must retain the above
-.\" copyright notice, this list of conditions and the
-.\" following disclaimer.
-.\" * Redistributions in binary form must reproduce the
-.\" above copyright notice, this list of conditions and
-.\" the following disclaimer in the documentation and/or
-.\" other materials provided with the distribution.
-.\" * The names of contributors to this software may not be
-.\" used to endorse or promote products derived from this
-.\" software without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-.\" COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-.\" OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
-.\" THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-.\" DAMAGE.
-.\"
-.\"
-.\" CONTRIBUTORS
-.\" Nate Nielsen <nielsen@memberwebs.com>
-.\"
-.Dd July, 2004
-.Dt rtfx 1
-.Os rtfx
-.Sh NAME
-.Nm rtfx
-.Nd converts RTF to a generic XML format
-.Sh SYNOPSIS
-.Nm
-.Op Fl p
-.Ar inrtf
-.Ar outxml
-.Sh DESCRIPTION
-.Nm
-converts RTF files into a generic XML format. It majors on keeping meta data like style
-names, etc... rather than every bit of formatting. This makes it handy for converting
-RTF documents into a custom XML format (using XSL or an additional processing step).
-.Pp
-The output format is documented on the rtfx website (below). There are two slight
-variations of output format. The normal mode contains structure type data with
-formatting that has relevance on the context (such as bold or underline). The
-presentation format adds some more formatting tags (such as fonts or colors).
-.Sh OPTIONS
-The options are as follows:
-.Bl -tag -width Fl
-.It Fl p
-Puts
-.Nm
-into 'presentation' output mode.
-.El
-.Sh WEBSITE
-http://memberwebs.com/software/rtfx/
-.Sh BUGS
-Doesn't handle crummy RTF files nicely. Needs some speed improvements.
-.Sh SEE ALSO
-.Xr sablot 3
-.Sh AUTHOR
-.An Nate Nielsen Aq nielsen@memberwebs.com
diff --git a/src/rtfx.cpp b/src/rtfx.cpp
deleted file mode 100644
index 541432e..0000000
--- a/src/rtfx.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 2004, Nate Nielsen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- *
- * CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
- *
- */
-
-#include "usuals.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-
-#include "rtfparser.h"
-#include "xmlcomposer.h"
-
-int usage()
-{
- fprintf(stderr, "usage: rtfx [-p] <inrtf> <outxml>\n");
- exit(2);
-}
-
-int main(int argc, char* argv[])
-{
- XmlComposerOptions options;
-
- while(argc > 1)
- {
- argc--;
- argv++;
-
- char* arg = argv[0];
- if(*arg != '-')
- break;
-
- while(arg && *(++arg))
- {
- switch(*arg)
- {
- case 'p':
- options.extras = true;
- break;
-
- case '-':
- arg = NULL;
- break;
-
- case '?':
- default:
- usage();
- }
- }
-
- if(arg == NULL)
- break;
- }
-
- if(argc < 2)
- usage();
-
- try
- {
- // The input file
- FILE* file = fopen(argv[0], "rb");
-
- if(!file)
- {
- fprintf(stderr, "rtfx: couldn't open rtf file: %s: %s\n", argv[0], strerror(errno));
- return 1;
- }
-
- // Reads RTF tags and blocks
- RtfParser rtf;
-
- // Interprets tags and blocks from RTFParser
- XmlComposer composer(options);
- rtf.setHandler(&composer);
-
- bool ret = rtf.parse(file);
- fclose(file);
-
- if(!ret)
- {
- fprintf(stderr, "rtfx: rtf parse failed: %s\n", rtf.getParseErrors().c_str());
- return 1;
- }
-
- // TODO: This is disgusting. We need to bug the sablotron guys
- // for a better way to serialize a document.
- DOM::Document doc = composer.getDocument();
- string xml = doc.serialize();
-
- FILE* out = fopen(argv[1], "wb");
- if(!out)
- {
- fprintf(stderr, "rtfx: couldn't open file: %s: %s\n", argv[1], strerror(errno));
- return 1;
- }
-
- fwrite(xml.c_str(), 1, xml.length(), out);
- fclose(out);
- return 0;
- }
- catch(DOM::DOMException& e)
- {
- fprintf(stderr, "rtfx: xml dom error: %s\n", e.getMessage());
- }
-
- return 1;
-}
diff --git a/src/sablo.h b/src/sablo.h
deleted file mode 100644
index 196b70b..0000000
--- a/src/sablo.h
+++ /dev/null
@@ -1,2173 +0,0 @@
-/*
- * Copyright (c) 2004, Nate Nielsen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- *
- * CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
- *
- */
-
-// SABLOTRON C++ WRAPPER
-//
-// This wrapper tries to emulate the W3C DOM as much as possible.
-// Objects returned can be copied liberally. When copied they still
-// refer to the original Sablotron classes.
-// Almost all classes are "light" wrappers, and shouldn't be more
-// than 4 to 8 bytes a piece, with no additional memory allocation.
-// Certain objects (NodeList, NamedNodeMap implementations) are
-// heavier, and are reference counted.
-//
-// Salbotron uses UTF8 exclusively internally. This wrapper
-// supports on the fly conversions from UTF16. Define the following
-// constants to enable conversions:
-//
-// USE_UTF16
-// Convert all data values from UTF16 to UTF8.
-//
-// DOM_UTF16
-// Convert all DOM names from UTF16 to UTF8.
-//
-// If either of the above two constants are enabled you must include
-// salbotr.cpp in your build.
-//
-// Everything is in the DOM namespace.
-//
-// Objects of type Document and DOMImplementation must be manually
-// freed with their 'release' member function.
-//
-//
-
-#ifndef __SABLO_H__
-#define __SABLO_H__
-
-#define USE_UTF16
-// #define DOM_UTF16
-
-#include <stdio.h>
-#include <wchar.h>
-#include <exception>
-#include <string>
-
-namespace DOM
-{
- namespace S
- {
- extern "C"
- {
- #include <sablot.h>
- #include <sdom.h>
- }
- };
-
- bool transcode16to8(const std::basic_string<wchar_t>& data,
- std::basic_string<char>& ret);
- bool transcode8to16(const std::basic_string<char>& data,
- std::basic_string<wchar_t>& ret);
-
- namespace INT
- {
- typedef std::basic_string<char> _8str;
- typedef std::basic_string<wchar_t> _16str;
- }
-
-#ifdef ASSERT
- #define DOM_ASSERT ASSERT
-#else
- #include <assert.h>
- #define ASSERT assert
-#endif
-
-#ifdef USE_UTF16
- #ifdef DOM_UTF16
- typedef INT::_16str data_str;
- typedef INT::_16str dom_str;
- #define FROM_V(v) _16to8(v)
- #define FROM_D(v) _16to8(v)
- #define TO_V(v) _8to16(v)
- #define TO_D(v) _8to16(v)
- #else
- typedef INT::_16str data_str;
- typedef INT::_8str dom_str;
- #define FROM_V(v) _16to8(v)
- #define FROM_D(v) v
- #define TO_V(v) _8to16(v)
- #define TO_D(v) v
- #endif
-#else
- typedef INT::_8str data_str;
- typedef INT::_8str dom_str;
- #define FROM_V(v) v
- #define FROM_D(v) v
- #define TO_V(v) v
- #define TO_D(v) v
-#endif
-
- namespace INT
- {
- template<typename C>
- class Ref
- {
- public:
- Ref()
- { m_ptr = NULL; }
-
- Ref(C* ptr)
- {
- m_ptr = ptr;
- addref();
- }
-
- Ref(C* ptr, bool addref)
- {
- m_ptr = ptr;
- if(addref)
- addref();
- }
-
- ~Ref()
- {
- release();
- }
-
- Ref(const Ref& orig)
- {
- m_ptr = orig.m_ptr;
- addref();
- }
-
- Ref& operator=(const C* ptr)
- {
- C* old = m_ptr;
- m_ptr = (C*)ptr;
- addref();
- if(old)
- old->release();
- return *this;
- }
-
- Ref& operator=(const Ref& orig)
- { return operator=(orig.m_ptr); }
-
-#ifdef COMPARE_REF
- bool operator==(const C* ptr)
- {
- if(m_ptr == NULL && ptr == NULL)
- return true;
- else if(m_ptr == NULL || ptr == NULL)
- return false;
-
- return *ptr == *m_ptr;
- }
-
- bool operator==(const Ref& orig)
- { return operator==(orig.m_ptr); }
-#else
- bool operator==(const C* ptr)
- {
- ASSERT(ptr == NULL);
- return m_ptr == NULL;
- }
-#endif
- operator C*() const
- { return m_ptr; }
-
- operator C&() const
- { return &m_ptr; }
-
- C* operator->() const
- { return m_ptr; }
-
- protected:
- void release()
- {
- if(m_ptr)
- m_ptr->release();
- m_ptr = NULL;
- }
-
- void addref()
- {
- if(m_ptr)
- m_ptr->addref();
- }
-
- private:
- C* m_ptr;
- };
-
- class Inst
- {
- public:
- Inst()
- { m_x = 0; }
- virtual ~Inst()
- { }
- void addref()
- { m_x++; }
- void release()
- {
- if((--m_x) <= 0)
- delete this;
- }
-
- private:
- int m_x;
- };
-
- class Base;
- };
-
- #define ASSERT_VALID() \
- ASSERT(isValid());
- #define ASSERT_VALID_NODE(node) \
- ASSERT(node.isValid());
- #define ASSERT_TYPE(t) \
- ASSERT(getNodeType() == t)
- #define ASSERT_NODE_TYPE(n, t) \
- ASSERT(n.getNodeType() == t)
-
- class DOMException
- {
- public:
- typedef enum
- {
- INDEX_SIZE_ERR = S::SDOM_INDEX_SIZE_ERR,
- DOMSTRING_SIZE_ERR = S::SDOM_DOMSTRING_SIZE_ERR,
- HIERARCHY_REQUEST_ERR = S::SDOM_HIERARCHY_REQUEST_ERR,
- WRONG_DOCUMENT_ERR = S::SDOM_WRONG_DOCUMENT_ERR,
- INVALID_CHARACTER_ERR = S::SDOM_INVALID_CHARACTER_ERR,
- NO_DATA_ALLOWED_ERR = S::SDOM_NO_DATA_ALLOWED_ERR,
- NO_MODIFICATION_ALLOWED_ERR = S::SDOM_NO_MODIFICATION_ALLOWED_ERR,
- NOT_FOUND_ERR = S::SDOM_NOT_FOUND_ERR,
- NOT_SUPPORTED_ERR = S::SDOM_NOT_SUPPORTED_ERR,
- INUSE_ATTRIBUTE_ERR = S::SDOM_INUSE_ATTRIBUTE_ERR,
- INVALID_STATE_ERR = S::SDOM_INVALID_STATE_ERR,
- SYNTAX_ERR = S::SDOM_SYNTAX_ERR,
- INVALID_MODIFICATION_ERR = S::SDOM_INVALID_MODIFICATION_ERR,
- NAMESPACE_ERR = S::SDOM_NAMESPACE_ERR,
- INVALID_ACCESS_ERR = S::SDOM_INVALID_ACCESS_ERR,
- /* not in spec below this point: */
- INVALID_NODE_TYPE = S::SDOM_INVALID_NODE_TYPE,
- QUERY_PARSE_ERR = S::SDOM_QUERY_PARSE_ERR,
- QUERY_EXECUTION_ERR = S::SDOM_QUERY_EXECUTION_ERR,
- NOT_OK = S::SDOM_NOT_OK
- } CODES;
-
- int getCode()
- { return code; }
- char* getMessage()
- { return S::SDOM_getExceptionMessage(m_sit); }
- void getDetails(int* code, char** message,
- char** documentUri, int* fileLine)
- { S::SDOM_getExceptionDetails(m_sit, code, message, documentUri, fileLine); }
-
- short code;
-
- protected:
- DOMException(S::SDOM_Exception e, S::SablotSituation s)
- {
- code = e;
- m_sit = s;
- }
-
- S::SablotSituation m_sit;
-
- friend class INT::Base;
- };
-
- namespace INT
- {
- /**
- * The base class that keeps references to sablo
- */
- class Base
- {
- public:
- bool operator==(const Base& other) const
- { return m_sit == other.m_sit; }
- bool operator==(const void* null) const
- { ASSERT(null == NULL); return m_sit == NULL; };
- bool operator!=(const Base& other) const
- { return !operator==(other); }
- bool operator!=(const void* null) const
- { return !operator==(null); }
-
- protected:
- Base(S::SablotSituation sit)
- { m_sit = sit; }
- Base(const Base& base)
- { m_sit = base.m_sit; }
- Base& operator=(const Base& other)
- { m_sit = other.m_sit; return *this; }
- Base& operator=(const void* null)
- { ASSERT(null == NULL); m_sit = NULL; return *this; }
- inline bool isValid() const
- { return m_sit != NULL; }
-
- inline S::SDOM_Exception _try_(S::SDOM_Exception e) const
- throw(DOMException)
- {
- if(e != S::SDOM_OK)
- throw DOMException(e, m_sit);
- return e;
- }
-
-#ifdef USE_UTF16
- inline _16str _8to16(const _8str& d) const
- throw(DOMException)
- {
- _16str s;
- if(!transcode8to16(d, s))
- throw DOMException(S::SDOM_INVALID_CHARACTER_ERR, m_sit);
- return s;
- }
-
- inline _8str _16to8(const _16str& d) const
- throw(DOMException)
- {
- _8str s;
- if(!transcode16to8(d, s))
- throw DOMException(S::SDOM_INVALID_CHARACTER_ERR, m_sit);
- return s;
- }
-#endif
-
- S::SablotSituation m_sit;
- };
-
- class NamedNodeMap;
- class NodeList;
- class ChildNodeList;
- class AttrNodeList;
- class DOMNodeList;
- class AttrNamedNodeMap;
- }
-
- class Element;
- class Document;
- class DOMImplementation;
-
- typedef INT::Ref<INT::NamedNodeMap> NamedNodeMap;
- typedef INT::Ref<INT::NodeList> NodeList;
-
- /**
- * Thin wrapper class for a DOM Node
- */
- class Node :
- public INT::Base
- {
- public:
- enum TYPES
- {
- ELEMENT_NODE = S::SDOM_ELEMENT_NODE,
- ATTRIBUTE_NODE = S::SDOM_ATTRIBUTE_NODE,
- TEXT_NODE = S::SDOM_TEXT_NODE,
- CDATA_SECTION_NODE = S::SDOM_CDATA_SECTION_NODE,
- ENTITY_REFERENCE_NODE = S::SDOM_ENTITY_REFERENCE_NODE,
- ENTITY_NODE = S::SDOM_ENTITY_NODE,
- PROCESSING_INSTRUCTION_NODE = S::SDOM_PROCESSING_INSTRUCTION_NODE,
- COMMENT_NODE = S::SDOM_COMMENT_NODE,
- DOCUMENT_NODE = S::SDOM_DOCUMENT_NODE,
- DOCUMENT_TYPE_NODE = S::SDOM_DOCUMENT_TYPE_NODE,
- DOCUMENT_FRAGMENT_NODE = S::SDOM_DOCUMENT_FRAGMENT_NODE,
- NOTATION_NODE = S::SDOM_NOTATION_NODE
- };
-
- Node() : INT::Base(NULL)
- {
- m_node = NULL;
- }
-
- Node(const Node& node)
- : INT::Base(node)
- {
- m_node = node.m_node;
- }
-
- Node& operator=(const Node& other)
- {
- Base::operator=(other);
- m_node = other.m_node;
- return *this;
- }
-
- Node& operator=(const void* null)
- {
- ASSERT(null == NULL);
- Base::operator=(null);
- m_node = NULL;
- return *this;
- }
-
- bool operator==(const Node& other) const
- {
- return Base::operator==(other) &&
- m_node == other.m_node;
- }
-
- bool operator==(const void* null) const
- {
- ASSERT(null == NULL);
- return Base::operator==(null) ||
- m_node == NULL;
- }
-
- bool operator!=(const Node& other) const
- { return !operator==(other); }
-
- bool operator!=(const void* null) const
- { return !operator==(null); }
-
- const Node* operator->() const
- { return (const Node*)this; }
- Node* operator->()
- { return this; }
-
- dom_str getNodeName() const
- throw(DOMException)
- {
- ASSERT_VALID();
- S::SDOM_char* name;
- _try_(S::SDOM_getNodeName(m_sit, m_node, &name));
- return TO_D(INT::_8str(name));
- }
-
- data_str getNodeValue() const
- throw(DOMException)
- {
- ASSERT_VALID();
- S::SDOM_char* value;
- _try_(S::SDOM_getNodeValue(m_sit, m_node, &value));
- return TO_V(INT::_8str(value));
- }
-
- void setNodeValue(const data_str& value)
- throw(DOMException)
- {
- ASSERT_VALID();
- _try_(S::SDOM_setNodeValue(m_sit, m_node, FROM_V(value).c_str()));
- }
-
- short getNodeType() const
- throw(DOMException)
- {
- ASSERT_VALID();
- S::SDOM_NodeType type;
- _try_(S::SDOM_getNodeType(m_sit, m_node, &type));
- return (short)type;
- }
-
- Node getParentNode() const
- throw(DOMException)
- {
- ASSERT_VALID();
- S::SDOM_Node parent;
- _try_(S::SDOM_getParentNode(m_sit, m_node, &parent));
- return Node(m_sit, parent);
- }
-
- NodeList getChildNodes() const
- throw(DOMException);
-
- Node getFirstChild() const
- throw(DOMException)
- {
- ASSERT_VALID();
- S::SDOM_Node child;
- _try_(S::SDOM_getFirstChild(m_sit, m_node, &child));
- return Node(m_sit, child);
- }
-
- Node getLastChild() const
- throw(DOMException)
- {
- ASSERT_VALID();
- S::SDOM_Node child;
- _try_(S::SDOM_getLastChild(m_sit, m_node, &child));
- return Node(m_sit, child);
- }
-
- Node getPreviousSibling() const
- throw(DOMException)
- {
- ASSERT_VALID();
- S::SDOM_Node sib;
- _try_(S::SDOM_getPreviousSibling(m_sit, m_node, &sib));
- return Node(m_sit, sib);
- }
-
- Node getNextSibling() const
- throw(DOMException)
- {
- ASSERT_VALID();
- S::SDOM_Node sib;
- _try_(S::SDOM_getNextSibling(m_sit, m_node, &sib));
- return Node(m_sit, sib);
- }
-
- NamedNodeMap getAttributes() const
- throw(DOMException);
-
- Document getOwnerDocument() const
- throw(DOMException);
-
- Node insertBefore(const Node& newChild, const Node& refChild)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_VALID_NODE(newChild);
- ASSERT_VALID_NODE(refChild);
- _try_(S::SDOM_insertBefore(m_sit, m_node, newChild.m_node, refChild.m_node));
- return newChild;
- }
-
- Node replaceChild(const Node& newChild, const Node& refChild)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_VALID_NODE(newChild);
- ASSERT_VALID_NODE(refChild);
- _try_(S::SDOM_replaceChild(m_sit, m_node, newChild.m_node, refChild.m_node));
- return newChild;
- }
-
- Node removeChild(const Node& oldChild)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_VALID_NODE(oldChild);
- _try_(S::SDOM_removeChild(m_sit, m_node, oldChild.m_node));
- return oldChild;
- }
-
- Node appendChild(const Node& newChild)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_VALID_NODE(newChild);
- _try_(S::SDOM_appendChild(m_sit, m_node, newChild.m_node));
- return newChild;
- }
-
- bool hasChildNodes() const
- throw(DOMException)
- {
- ASSERT_VALID();
- int count = 0;
- _try_(S::SDOM_getChildNodeCount(m_sit, m_node, &count));
- return count != 0;
- }
-
- Node cloneNode(bool deep) const
- throw(DOMException)
- {
- ASSERT_VALID();
- S::SDOM_Node node;
- _try_(S::SDOM_cloneNode(m_sit, m_node, deep ? 1 : 0, &node));
- return Node(m_sit, node);
- }
-
- void normalize()
- throw(DOMException)
- {
- ASSERT_VALID();
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- }
-
- bool isSupported(const dom_str& feature,
- const dom_str& version) const
- {
- ASSERT_VALID();
- return false;
- }
-
- dom_str getNamespaceURI() const
- throw(DOMException)
- {
- ASSERT_VALID();
- S::SDOM_char* uri;
- _try_(S::SDOM_getNodeNSUri(m_sit, m_node, &uri));
- return TO_D(INT::_8str(uri));
- }
-
- dom_str getPrefix() const
- throw(DOMException)
- {
- ASSERT_VALID();
- S::SDOM_char* prefix;
- _try_(S::SDOM_getNodePrefix(m_sit, m_node, &prefix));
- return TO_D(INT::_8str(prefix));
- }
-
- void setPrefix(const dom_str& prefix)
- throw(DOMException)
- {
- ASSERT_VALID();
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- }
-
- dom_str getLocalName() const
- throw(DOMException)
- {
- ASSERT_VALID();
- S::SDOM_char* name;
- _try_(S::SDOM_getNodeLocalName(m_sit, m_node, &name));
- return TO_D(INT::_8str(name));
- }
-
- bool hasAttributes() const
- throw (DOMException)
- {
- ASSERT_VALID();
-
- if(getNodeType() != ELEMENT_NODE)
- return false;
-
- int count = 0;
- _try_(S::SDOM_getAttributeNodeCount(m_sit, m_node, &count));
- return count != 0;
- }
-
- void* setUserData(void* data)
- throw(DOMException)
- {
- ASSERT_VALID();
- void* old = S::SDOM_getNodeInstanceData(m_node);
- S::SDOM_setNodeInstanceData(m_node, data);
- return old;
- }
-
- void* getUserData() const
- throw(DOMException)
- {
- ASSERT_VALID();
- return S::SDOM_getNodeInstanceData(m_node);
- }
-
- std::string serialize() const
- throw(DOMException)
- {
- ASSERT_VALID();
- S::SDOM_Document doc;
- _try_(S::SDOM_getOwnerDocument(m_sit, m_node, &doc));
- S::SDOM_char* serialized;
- _try_(S::SDOM_nodeToString(m_sit, doc, m_node, &serialized));
- std::string ret(serialized);
- S::SablotFree(serialized);
- return ret;
- }
-
- bool isValid() const
- {
- return Base::isValid() &&
- m_node != NULL;
- }
-
- protected:
- Node(S::SablotSituation sit, S::SDOM_Node node) :
- INT::Base(sit) { m_node = node; }
-
- protected:
- S::SDOM_Node m_node;
-
- friend class Document;
- friend class INT::ChildNodeList;
- friend class INT::AttrNodeList;
- friend class INT::DOMNodeList;
- friend class INT::AttrNamedNodeMap;
- };
-
- class Attr :
- public Node
- {
- public:
- Attr() { }
- Attr(const Attr& node) :
- Node(node) { }
-
- Attr& operator=(const Attr& other)
- { Node::operator=(other); return *this; }
- Attr& operator=(const void* null)
- { Node::operator=(null); return *this; }
- const Attr* operator->() const
- { return (const Attr*)this; }
- Attr* operator->()
- { return this; }
-
- dom_str getName() const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(ATTRIBUTE_NODE);
- return getNodeName();
- }
-
- Element getOwnerElement() const
- throw(DOMException);
-
- bool getSpecified() const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(ATTRIBUTE_NODE);
- return true;
- }
-
- data_str getValue() const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(ATTRIBUTE_NODE);
- return getNodeValue();
- }
-
- void setValue(const data_str& value)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(ATTRIBUTE_NODE);
- setNodeValue(value);
- }
-
- protected:
- Attr(S::SablotSituation sit, S::SDOM_Node node) :
- Node(sit, node) { }
-
- friend class Element;
- friend class Document;
- };
-
- /**
- * This wrapper class for an element
- */
- class Element :
- public Node
- {
- public:
- Element() { }
- Element(const Element& node) :
- Node(node) {}
-
- Element& operator=(const Node& other)
- { Node::operator=(other); return *this; }
- Element& operator=(const Element& other)
- { Node::operator=(other); return *this; }
- Element& operator=(const void* null)
- { Node::operator=(null); return *this; }
- const Element* operator->() const
- { return (const Element*)this; }
- Element* operator->()
- { return this; }
-
- dom_str getTagName() const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(ELEMENT_NODE);
- return getNodeName();
- }
-
- data_str getAttribute(const dom_str& name) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(ELEMENT_NODE);
- S::SDOM_char* value;
- _try_(S::SDOM_getAttribute(m_sit, m_node, FROM_D(name).c_str(), &value));
- return TO_V(INT::_8str(value));
- }
-
- void setAttribute(const dom_str& name, const data_str& value)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(ELEMENT_NODE);
- _try_(S::SDOM_setAttribute(m_sit, m_node, FROM_D(name).c_str(),
- FROM_V(value).c_str()));
- }
-
- void removeAttribute(const dom_str& name)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(ELEMENT_NODE);
- _try_(S::SDOM_removeAttribute(m_sit, m_node, FROM_D(name).c_str()));
- }
-
- Attr getAttributeNode(const dom_str& name) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(ELEMENT_NODE);
- S::SDOM_Node attr;
- _try_(S::SDOM_getAttributeNode(m_sit, m_node, FROM_D(name).c_str(), &attr));
- return Attr(m_sit, attr);
- }
-
- Attr setAttributeNode(const Attr& attr)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_VALID_NODE(attr);
- ASSERT_TYPE(ELEMENT_NODE);
- S::SDOM_Node repl;
- _try_(S::SDOM_setAttributeNode(m_sit, m_node, attr.m_node, &repl));
- return Attr(m_sit, repl);
- }
-
- Attr removeAttributeNode(const Attr& attr)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_VALID_NODE(attr);
- ASSERT_TYPE(ELEMENT_NODE);
- S::SDOM_Node rem;
- _try_(S::SDOM_removeAttributeNode(m_sit, m_node, attr.m_node, &rem));
- return Attr(m_sit, rem);
- }
-
- NodeList getElementsByTagName(const dom_str& name) const
- throw(DOMException);
-
- data_str getAttributeNS(const dom_str& uri, const dom_str& name) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(ELEMENT_NODE);
- S::SDOM_char* value;
- _try_(S::SDOM_getAttributeNS(m_sit, m_node, (char*)FROM_D(uri).c_str(),
- (char*)FROM_D(name).c_str(), &value));
- return TO_V(INT::_8str(value));
- }
-
- void setAttributeNS(const dom_str& uri, const dom_str& name,
- const data_str& value)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(ELEMENT_NODE);
- _try_(S::SDOM_setAttributeNS(m_sit, m_node, FROM_D(uri).c_str(),
- FROM_D(name).c_str(), FROM_V(value).c_str()));
- }
-
- void removeAttributeNS(const dom_str& uri, const dom_str& name)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(ELEMENT_NODE);
- DOM::Attr attr = getAttributeNodeNS(uri, name);
- if(attr != NULL)
- removeAttributeNode(attr);
- }
-
- Attr getAttributeNodeNS(const dom_str& uri, const dom_str& name) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(ELEMENT_NODE);
- S::SDOM_Node attr;
- _try_(S::SDOM_getAttributeNodeNS(m_sit, m_node, (char*)FROM_D(uri).c_str(),
- (char*)FROM_D(name).c_str(), &attr));
- return Attr(m_sit, attr);
- }
-
- Attr setAttributeNodeNS(const Attr& attr)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_VALID_NODE(attr);
- ASSERT_TYPE(ELEMENT_NODE);
- S::SDOM_Node repl;
- _try_(S::SDOM_setAttributeNodeNS(m_sit, m_node, attr.m_node, &repl));
- return Attr(m_sit, repl);
- }
-
- NodeList getElementsByTagNameNS(const dom_str& uri,
- const dom_str& name) const
- throw(DOMException);
-
- bool hasAttribute(const dom_str& name) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(ELEMENT_NODE);
- return getAttributeNode(name) != NULL;
- }
-
- bool hasAttributeNS(const dom_str& uri, const dom_str& name) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(ELEMENT_NODE);
- return getAttributeNodeNS(uri, name) != NULL;
- }
-
- protected:
- Element(S::SablotSituation sit, S::SDOM_Node node) :
- Node(sit, node) { }
-
- friend class Attr;
- friend class Document;
- };
-
-
- class CharacterData :
- public Node
- {
- public:
- CharacterData() { }
- CharacterData(const Node& node) :
- Node(node) { }
-
- CharacterData& operator=(const Node& other)
- { Node::operator=(other); return *this; }
- CharacterData& operator=(const CharacterData& other)
- { Node::operator=(other); return *this; }
- CharacterData& operator=(const void* null)
- { Node::operator=(null); return *this; }
- const CharacterData* operator->() const
- { return (const CharacterData*)this; }
- CharacterData* operator->()
- { return this; }
-
- void appendData(const data_str& data)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT(getNodeType() == TEXT_NODE ||
- getNodeType() == CDATA_SECTION_NODE ||
- getNodeType() == COMMENT_NODE);
- data_str val = getNodeValue();
- val.append(data);
- setNodeValue(val);
- }
-
- void deleteData(int offset, int count)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT(getNodeType() == TEXT_NODE ||
- getNodeType() == CDATA_SECTION_NODE ||
- getNodeType() == COMMENT_NODE);
- data_str val = getNodeValue();
- val.erase(offset, count);
- setNodeValue(val);
- }
-
- data_str getData() const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT(getNodeType() == TEXT_NODE ||
- getNodeType() == CDATA_SECTION_NODE ||
- getNodeType() == COMMENT_NODE);
- return getNodeValue();
- }
-
- int getLength() const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT(getNodeType() == TEXT_NODE ||
- getNodeType() == CDATA_SECTION_NODE ||
- getNodeType() == COMMENT_NODE);
- return getNodeValue().size();
- }
-
- void insertData(int offset, const data_str& data)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT(getNodeType() == TEXT_NODE ||
- getNodeType() == CDATA_SECTION_NODE ||
- getNodeType() == COMMENT_NODE);
- data_str val = getNodeValue();
- val.insert(offset, data);
- setNodeValue(val);
- }
-
- void replaceData(int offset, int count, const data_str& arg)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT(getNodeType() == TEXT_NODE ||
- getNodeType() == CDATA_SECTION_NODE ||
- getNodeType() == COMMENT_NODE);
- data_str val = getNodeValue();
- val.erase(offset, count);
- val.insert(offset, arg);
- setNodeValue(val);
- }
-
- void setData(const data_str& data)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT(getNodeType() == TEXT_NODE ||
- getNodeType() == CDATA_SECTION_NODE ||
- getNodeType() == COMMENT_NODE);
- setNodeValue(data);
- }
-
- data_str substringData(int offset, int count) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT(getNodeType() == TEXT_NODE ||
- getNodeType() == CDATA_SECTION_NODE ||
- getNodeType() == COMMENT_NODE);
- data_str val = getNodeValue();
- return val.substr(offset, count);
- }
-
- protected:
- CharacterData(S::SablotSituation sit, S::SDOM_Node node) :
- Node(sit, node) { }
- };
-
- class Text :
- public CharacterData
- {
- public:
- Text() { }
- Text(const Node& node) :
- CharacterData(node) { }
-
- Text& operator=(const Text& other)
- { CharacterData::operator=(other); return *this; }
- Text& operator=(const void* null)
- { CharacterData::operator=(null); return *this; }
- const Text* operator->() const
- { return (const Text*)this; }
- Text* operator->()
- { return this; }
-
- Text splitText(int offset)
- throw(DOMException);
-
- protected:
- Text(S::SablotSituation sit, S::SDOM_Node node) :
- CharacterData(sit, node) { }
-
- friend class Document;
- };
-
- class CDATASection :
- public Text
- {
- public:
- CDATASection() { }
- CDATASection(const CDATASection& node) :
- Text(node) { }
-
- CDATASection& operator=(const CDATASection& other)
- { Text::operator=(other); return *this; }
- CDATASection& operator=(void* null)
- { Text::operator=(null); return *this; }
- const CDATASection* operator->() const
- { return (const CDATASection*)this; }
- CDATASection* operator->()
- { return this; }
-
- protected:
- CDATASection(S::SablotSituation sit, S::SDOM_Node node) :
- Text(sit, node) { }
-
- friend class Document;
- };
-
- class Comment :
- public CharacterData
- {
- public:
- Comment() { }
- Comment(const Comment& node) :
- CharacterData(node) { }
-
- Comment& operator=(const Node& other)
- { Node::operator=(other); return *this; }
- Comment& operator=(const Comment& other)
- { CharacterData::operator=(other); return *this; }
- Comment& operator=(void* null)
- { CharacterData::operator=(null); return *this; }
- const Comment* operator->() const
- { return (const Comment*)this; }
- Comment* operator->()
- { return this; }
-
- protected:
- Comment(S::SablotSituation sit, S::SDOM_Node node) :
- CharacterData(sit, node) { }
-
- friend class Document;
- };
-
- class ProcessingInstruction :
- public Node
- {
- public:
- ProcessingInstruction() { }
- ProcessingInstruction(const ProcessingInstruction& node) :
- Node(node) { }
-
- ProcessingInstruction& operator=(const Node& other)
- { Node::operator=(other); return *this; }
- ProcessingInstruction& operator=(const ProcessingInstruction& other)
- { Node::operator=(other); return *this; }
- ProcessingInstruction& operator=(void* null)
- { Node::operator=(null); return *this; }
- const ProcessingInstruction* operator->() const
- { return (const ProcessingInstruction*)this; }
- ProcessingInstruction* operator->()
- { return this; }
-
- data_str getData() const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(PROCESSING_INSTRUCTION_NODE);
- return getNodeValue();
- }
-
- dom_str getTarget() const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(PROCESSING_INSTRUCTION_NODE);
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return dom_str();
- }
-
- void setData(const data_str& data)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(PROCESSING_INSTRUCTION_NODE);
- setNodeValue(data);
- }
-
- protected:
- ProcessingInstruction(S::SablotSituation sit, S::SDOM_Node node) :
- Node(sit, node) { }
-
- friend class Document;
- };
-
- class DocumentFragment :
- public Node
- {
- public:
- DocumentFragment() { }
- DocumentFragment(const DocumentFragment& node) :
- Node(node) { }
-
- DocumentFragment& operator=(const Node& other)
- { Node::operator=(other); return *this; }
- DocumentFragment& operator=(const DocumentFragment& other)
- { Node::operator=(other); return *this; }
- DocumentFragment& operator=(void* null)
- { Node::operator=(null); return *this; }
- const DocumentFragment* operator->() const
- { return (const DocumentFragment*)this; }
- DocumentFragment* operator->()
- { return this; }
- };
-
- class Entity :
- public Node
- {
- public:
- Entity() { }
- Entity(const Entity& node) :
- Node(node) { }
-
- Entity& operator=(const Node& other)
- { Node::operator=(other); return *this; }
- Entity& operator=(const Entity& other)
- { Node::operator=(other); return *this; }
- Entity& operator=(void* null)
- { Node::operator=(null); return *this; }
- const Entity* operator->() const
- { return (const Entity*)this; }
- Entity* operator->()
- { return this; }
-
- dom_str getNotationName() const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(ENTITY_NODE);
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return dom_str();
- }
-
- dom_str getPublicId() const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(ENTITY_NODE);
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return dom_str();
- }
-
- dom_str getSystemId() const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(ENTITY_NODE);
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return dom_str();
- }
- };
-
- class EntityReference :
- public Node
- {
- public:
- EntityReference() { }
- EntityReference(const EntityReference& node) :
- Node(node) { }
-
- EntityReference& operator=(const Node& other)
- { Node::operator=(other); return *this; }
- EntityReference& operator=(const EntityReference& other)
- { Node::operator=(other); return *this; }
- EntityReference& operator=(void* null)
- { Node::operator=(null); return *this; }
- const EntityReference* operator->() const
- { return (const EntityReference*)this; }
- EntityReference* operator->()
- { return this; }
- };
-
- class Notation :
- public Node
- {
- public:
- Notation() { }
- Notation(const Notation& node) :
- Node(node) { }
-
- Notation& operator=(const Node& other)
- { Node::operator=(other); return *this; }
- Notation& operator=(const Notation& other)
- { Node::operator=(other); return *this; }
- Notation& operator=(void* null)
- { Node::operator=(null); return *this; }
- const Notation* operator->() const
- { return (const Notation*)this; }
- Notation* operator->()
- { return this; }
-
- dom_str getPublicId() const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(NOTATION_NODE);
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return dom_str();
- }
-
- dom_str getSystemId() const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(NOTATION_NODE);
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return dom_str();
- }
- };
-
- class DocumentType :
- public Node
- {
- public:
- DocumentType() { }
- DocumentType(const DocumentType& node) :
- Node(node) { }
-
- DocumentType& operator=(const Node& other)
- { Node::operator=(other); return *this; }
- DocumentType& operator=(const DocumentType& other)
- { Node::operator=(other); return *this; }
- DocumentType& operator=(void* null)
- { Node::operator=(null); return *this; }
- const DocumentType* operator->() const
- { return (const DocumentType*)this; }
- DocumentType* operator->()
- { return this; }
-
- NamedNodeMap getEntities() const
- throw(DOMException);
-
- dom_str getInternalSubset() const
- throw(DOMException)
- {
- ASSERT_VALID();
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return dom_str();
- }
-
- dom_str getName() const
- throw(DOMException)
- {
- ASSERT_VALID();
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return dom_str();
- }
-
- NamedNodeMap getNotations() const
- throw(DOMException);
- };
-
-
- class Document :
- public Node
- {
- public:
- Document() { }
- Document(const Document& doc) :
- Node(doc) { }
- Document(S::SablotSituation sit, S::SDOM_Document doc) :
- Node(sit, NULL) { m_node = doc; }
-
- Document& operator=(const Document& other)
- { Node::operator=(other); return *this; }
- Document& operator=(void* null)
- { Node::operator=(null); return *this; }
- const Document* operator->() const
- { return (const Document*)this; }
- Document* operator->()
- { return this; }
-
- DocumentType getDocType() const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(DOCUMENT_NODE);
- return DocumentType();
- }
-
- DOMImplementation getImplementation() const
- throw(DOMException);
-
- Element getDocumentElement() const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(DOCUMENT_NODE);
- S::SDOM_Node child;
- _try_(S::SDOM_getFirstChild(m_sit, m_node, &child));
- return Element(m_sit, child);
- }
-
- Element createElement(const dom_str& tag) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(DOCUMENT_NODE);
- S::SDOM_Node el;
- _try_(S::SDOM_createElement(m_sit, (S::SDOM_Document)m_node,
- &el, FROM_D(tag).c_str()));
- return Element(m_sit, el);
- }
-
- DocumentFragment createDocumentFragment() const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(DOCUMENT_NODE);
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return DocumentFragment();
- }
-
- Text createTextNode(const data_str& data) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(DOCUMENT_NODE);
- S::SDOM_Node text;
- _try_(S::SDOM_createTextNode(m_sit, (S::SDOM_Document)m_node,
- &text, FROM_V(data).c_str()));
- return Text(m_sit, text);
- }
-
- Comment createComment(const data_str& data) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(DOCUMENT_NODE);
- S::SDOM_Node comment;
- _try_(S::SDOM_createComment(m_sit, (S::SDOM_Document)m_node,
- &comment, FROM_V(data).c_str()));
- return Comment(m_sit, comment);
- }
-
- CDATASection createCDATASection(const data_str& data) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(DOCUMENT_NODE);
- S::SDOM_Node cdata;
- _try_(S::SDOM_createCDATASection(m_sit, (S::SDOM_Document)m_node,
- &cdata, FROM_V(data).c_str()));
- return CDATASection(m_sit, cdata);
- }
-
- ProcessingInstruction createProcessingInstruction(const dom_str& targ,
- const data_str& data) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(DOCUMENT_NODE);
- S::SDOM_Node pi;
- _try_(S::SDOM_createProcessingInstruction(m_sit,
- (S::SDOM_Document)m_node,
- &pi, FROM_D(targ).c_str(),
- FROM_V(data).c_str()));
- return ProcessingInstruction(m_sit, pi);
- }
-
- Attr createAttribute(const dom_str& name) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(DOCUMENT_NODE);
- S::SDOM_Node attr;
- _try_(S::SDOM_createAttribute(m_sit, (S::SDOM_Document)m_node,
- &attr, FROM_D(name).c_str()));
- return Attr(m_sit, attr);
- }
-
- EntityReference createEntityReference()
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(DOCUMENT_NODE);
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return EntityReference();
- }
-
- NodeList getElementsByTagName(const dom_str& name) const
- throw(DOMException);
-
- Node importNode(const Node& import, bool deep) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(DOCUMENT_NODE);
- ASSERT_VALID_NODE(import);
- S::SDOM_Node imported;
- _try_(S::SDOM_cloneForeignNode(m_sit, (S::SDOM_Document)m_node,
- import.m_node, deep ? 1 : 0, &imported));
- return Node(m_sit, imported);
- }
-
- Element createElementNS(const dom_str& uri, const dom_str& tag) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(DOCUMENT_NODE);
- S::SDOM_Node el;
- _try_(S::SDOM_createElementNS(m_sit, (S::SDOM_Document)m_node,
- &el, FROM_D(uri).c_str(), FROM_D(tag).c_str()));
- return Element(m_sit, el);
- }
-
- Attr createAttributeNS(const dom_str& uri, const dom_str& name) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(DOCUMENT_NODE);
- S::SDOM_Node attr;
- _try_(S::SDOM_createAttributeNS(m_sit, (S::SDOM_Document)m_node,
- &attr, FROM_D(uri).c_str(), FROM_D(name).c_str()));
- return Attr(m_sit, attr);
- }
-
- NodeList getElementsByTagNameNS(const dom_str& uri,
- const dom_str& name) const
- throw(DOMException);
-
- Element getElementById(const dom_str& id) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(DOCUMENT_NODE);
- dom_str query = "//*[id('" + id + "')]";
- S::SDOM_NodeList result;
- _try_(S::SDOM_xql(m_sit, FROM_D(query).c_str(), m_node, &result));
-
- int length;
- _try_(S::SDOM_getNodeListLength(m_sit, result, &length));
-
- Element ret;
- if(length != 1)
- {
- ret = Element();
- }
- else
- {
- S::SDOM_Node el;
- _try_(S::SDOM_getNodeListItem(m_sit, result, 0, &el));
- ret = Element(m_sit, el);
- }
-
- S::SDOM_disposeNodeList(m_sit, result);
- return ret;
- }
-
- std::string serialize() const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(DOCUMENT_NODE);
- S::SDOM_char* serialized;
- _try_(S::SDOM_docToString(m_sit, (S::SDOM_Document)m_node, &serialized));
- std::string ret(serialized);
- S::SablotFree(serialized);
- return ret;
- }
-
- void release()
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(DOCUMENT_NODE);
- S::SDOM_tmpListDump((S::SDOM_Document)m_node, 0);
- if(S::SablotDestroyDocument(m_sit, (S::SDOM_Document)m_node))
- _try_(S::SDOM_NOT_OK);
- *this = NULL;
- }
-
- protected:
-
- friend class Node;
- friend class DOMImplementation;
- };
-
-
- class DOMImplementation :
- public INT::Base
- {
- public:
- DOMImplementation()
- throw(DOMException) : INT::Base(NULL)
- {
- if(S::SablotCreateSituation(&m_sit))
- _try_(S::SDOM_NOT_OK);
- }
- DOMImplementation(S::SablotSituation sit)
- throw(DOMException) : INT::Base(sit) { }
- DOMImplementation(const DOMImplementation& impl) :
- INT::Base(impl) { }
-
- DOMImplementation& operator=(const DOMImplementation& other)
- { Base::operator=(other); return *this; }
- DOMImplementation& operator=(void* null)
- { Base::operator=(null); return *this; }
- const DOMImplementation* operator->() const
- { return (const DOMImplementation*)this; }
- DOMImplementation* operator->()
- { return this; }
-
- Document createDocument(const dom_str& uri, const dom_str& qname,
- const DocumentType& type) const
- throw(DOMException)
- {
- ASSERT_VALID();
- S::SDOM_Document doc;
- if(S::SablotCreateDocument(m_sit, &doc))
- _try_(S::SDOM_NOT_OK);
-
- Document document(m_sit, doc);
-
- if(!qname.empty())
- {
- if(!uri.empty())
- document.appendChild(document.createElementNS(uri, qname));
- else
- document.appendChild(document.createElement(qname));
- }
-
- return document;
- }
-
- DocumentType createDocumentType(const dom_str& qname,
- const dom_str& publicId,
- const dom_str& systemId) const
- throw(DOMException)
- {
- ASSERT_VALID();
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return DocumentType();
- }
-
- bool hasFeature(const dom_str& feature, const dom_str& version) const
- throw(DOMException)
- {
- ASSERT_VALID();
- return false;
- }
-
- void release()
- throw(DOMException)
- {
- ASSERT_VALID();
- if(S::SablotDestroySituation(m_sit))
- _try_(S::SDOM_NOT_OK);
- }
- };
-
- namespace INT
- {
- class NodeList :
- public INT::Base,
- public INT::Inst
- {
- public:
-#ifdef COMPARE_REF
- virtual bool operator==(const NodeList& other) const
- { return Base::operator==(other); }
-#endif
- virtual int getLength() const
- throw(DOMException)
- {
- ASSERT_VALID();
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return 0;
- }
-
- virtual Node item(int index) const
- throw(DOMException)
- {
- ASSERT_VALID();
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return Node();
- }
-
- protected:
- NodeList(S::SablotSituation sit) :
- INT::Base(sit) { }
-
- virtual bool isValid() const
- {
- return false;
- }
-
- private:
- NodeList(const NodeList& list) : INT::Base(list) { }
- };
-
- class ChildNodeList :
- public NodeList
- {
- public:
-#ifdef COMPARE_REF
- virtual bool operator==(const NodeList& other) const
- { return m_el == ((ChildNodeList)other).m_el; }
-#endif
- virtual int getLength() const
- throw(DOMException)
- {
- ASSERT_VALID();
- int length;
- _try_(S::SDOM_getChildNodeCount(m_sit, m_el, &length));
- return length;
- }
-
- virtual Node item(int index) const
- throw(DOMException)
- {
- ASSERT_VALID();
- S::SDOM_Node attr;
- _try_(S::SDOM_getChildNodeIndex(m_sit, m_el, index, &attr));
- return Node(m_sit, attr);
- }
-
- protected:
- ChildNodeList(S::SablotSituation sit, S::SDOM_Node node) :
- NodeList(sit) { m_el = node; }
-
- virtual bool isValid() const
- {
- return m_el != NULL;
- }
-
- protected:
- S::SDOM_Node m_el;
-
- friend class Node;
- };
-
- class AttrNodeList :
- public NodeList
- {
- public:
-#ifdef COMPARE_REF
- virtual bool operator==(const NodeList& other) const
- { return m_el == ((AttrNodeList)other).m_el; }
-#endif
- virtual int getLength() const
- throw(DOMException)
- {
- ASSERT_VALID();
- int length;
- _try_(S::SDOM_getAttributeNodeCount(m_sit, m_el, &length));
- return length;
- }
-
- virtual Node item(int index) const
- throw(DOMException)
- {
- ASSERT_VALID();
- S::SDOM_Node attr;
- _try_(S::SDOM_getAttributeNodeIndex(m_sit, m_el, index, &attr));
- return Node(m_sit, attr);
- }
-
- protected:
- AttrNodeList(S::SablotSituation sit, S::SDOM_Node el) :
- NodeList(sit) { m_el = el; }
-
- virtual bool isValid() const
- {
- return m_el != NULL;
- }
-
- protected:
- S::SDOM_Node m_el;
- };
-
-
- class DOMNodeList :
- public NodeList
- {
- public:
-#ifdef COMPARE_REF
- virtual bool operator==(const NodeList& other) const
- { return m_list == ((DOMNodeList&)other).m_list; }
-#endif
- virtual int getLength() const
- throw(DOMException)
- {
- ASSERT_VALID();
- int length;
- _try_(S::SDOM_getNodeListLength(m_sit, m_list, &length));
- return length;
- }
-
- virtual Node item(int index) const
- throw(DOMException)
- {
- ASSERT_VALID();
- S::SDOM_Node it;
- _try_(S::SDOM_getNodeListItem(m_sit, m_list, index, &it));
- return Node(m_sit, it);
- }
-
- protected:
- DOMNodeList(S::SablotSituation sit, S::SDOM_NodeList list) :
- NodeList(sit)
- {
- m_list = list;
- }
-
- ~DOMNodeList()
- {
- if(m_list != NULL)
- S::SDOM_disposeNodeList(m_sit, m_list);
- m_list = NULL;
- }
-
- virtual bool isValid() const
- {
- return m_list != NULL;
- }
-
- protected:
- S::SDOM_NodeList m_list;
-
- friend class Element;
- friend class Document;
- };
-
-
- class NamedNodeMap :
- public INT::Base,
- public INT::Inst
- {
- public:
-#ifdef COMPARE_REF
- virtual bool operator==(const NamedNodeMap& other) const
- { Base::operator==(other); }
-#endif
- virtual int getLength() const
- throw(DOMException)
- {
- ASSERT_VALID();
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return 0;
- }
-
- virtual Node getNamedItem(const dom_str& name) const
- throw(DOMException)
- {
- ASSERT_VALID();
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return Node();
- }
-
- virtual Node getNamedItemNS(const dom_str& uri, const dom_str& name) const
- throw(DOMException)
- {
- ASSERT_VALID();
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return Node();
- }
-
- virtual Node item(int index) const
- throw(DOMException)
- {
- ASSERT_VALID();
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return Node();
- }
-
- virtual Node removeNamedItem(const dom_str& name)
- throw(DOMException)
- {
- ASSERT_VALID();
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return Node();
- }
-
- virtual Node removeNamedItemNS(const dom_str& uri, const dom_str& name)
- throw(DOMException)
- {
- ASSERT_VALID();
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return Node();
- }
-
- virtual Node setNamedItem(const Node& arg)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_VALID_NODE(arg);
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return Node();
- }
-
- virtual Node setNamedItemNS(const Node& arg)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_VALID_NODE(arg);
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return Node();
- }
-
- protected:
- NamedNodeMap(S::SablotSituation sit) :
- INT::Base(sit) { }
-
- virtual bool isValid() const
- {
- return false;
- }
-
- private:
- NamedNodeMap(const NamedNodeMap& map) : INT::Base(map) { }
- };
-
- class AttrNamedNodeMap :
- public NamedNodeMap
- {
- public:
-#ifdef COMPARE_REF
- virtual bool operator==(const NamedNodeMap& other) const
- { return m_el == ((AttrNamedNodeMap)other).m_el; }
-#endif
- virtual int getLength() const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_VALID_NODE(m_el);
- int length;
- _try_(S::SDOM_getAttributeNodeCount(m_sit, m_el.m_node, &length));
- return length;
- }
-
- virtual Node getNamedItem(const dom_str& name) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_VALID_NODE(m_el);
- return m_el.getAttributeNode(name);
- }
-
- virtual Node getNamedItemNS(const dom_str& uri, const dom_str& name) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_VALID_NODE(m_el);
- return m_el.getAttributeNodeNS(uri, name);
- }
-
- virtual Node item(int index) const
- throw(DOMException)
- {
- ASSERT_VALID();
- S::SDOM_Node attr;
- _try_(S::SDOM_getAttributeNodeIndex(m_sit, m_el.m_node, index, &attr));
- return Node(m_sit, attr);
- }
-
- virtual Node removeNamedItem(const dom_str& name)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_VALID_NODE(m_el);
- Node node = getNamedItem(name);
- if(node != NULL)
- m_el.removeAttributeNode((Attr&)node);
- return node;
- }
-
- virtual Node removeNamedItemNS(const dom_str& uri, const dom_str& name)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_VALID_NODE(m_el);
- Node node = getNamedItemNS(uri, name);
- if(node != NULL)
- m_el.removeAttributeNode((Attr&)node);
- return node;
- }
-
- virtual Node setNamedItem(const Node& arg)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_VALID_NODE(m_el);
- return m_el.setAttributeNode((Attr&)arg);
- }
-
- virtual Node setNamedItemNS(const Node& arg)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_VALID_NODE(m_el);
- return m_el.setAttributeNodeNS((Attr&)arg);
- }
-
- protected:
- AttrNamedNodeMap(S::SablotSituation sit, const Node& el) :
- NamedNodeMap(sit)
- {
- ASSERT_VALID_NODE(el);
- ASSERT_NODE_TYPE(el, Node::ELEMENT_NODE);
- m_el = (Element&)el;
- }
-
- virtual bool isValid() const
- {
- return m_el.isValid();
- }
-
-
- protected:
- Element m_el;
-
- friend class Node;
- };
- };
-
-
- inline NodeList Node::getChildNodes() const
- throw(DOMException)
- {
- ASSERT_VALID();
- return NodeList(new INT::ChildNodeList(m_sit, m_node));
- }
-
- inline NamedNodeMap Node::getAttributes() const
- throw(DOMException)
- {
- ASSERT_VALID();
- if(getNodeType() != ELEMENT_NODE)
- return NamedNodeMap(NULL);
-
- return NamedNodeMap(new INT::AttrNamedNodeMap(m_sit, *this));
- }
-
- inline Document Node::getOwnerDocument() const
- throw(DOMException)
- {
- ASSERT_VALID();
- S::SDOM_Document doc;
- _try_(S::SDOM_getOwnerDocument(m_sit, m_node, &doc));
- return Document(m_sit, doc);
- }
-
- inline Element Attr::getOwnerElement() const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(ATTRIBUTE_NODE);
- S::SDOM_Node el;
- _try_(S::SDOM_getAttributeElement(m_sit, m_node, &el));
- return Element(m_sit, el);
- }
-
- inline NodeList Element::getElementsByTagName(const dom_str& name) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(ELEMENT_NODE);
- dom_str query = "descendant::" + name;
- S::SDOM_NodeList result;
- _try_(S::SDOM_xql(m_sit, FROM_D(query).c_str(), m_node, &result));
- return NodeList(new INT::DOMNodeList(m_sit, result));
- }
-
- inline NodeList Element::getElementsByTagNameNS(const dom_str& uri,
- const dom_str& name) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(ELEMENT_NODE);
- dom_str query = "descendant::*[namespace-uri()='" + uri + "'";
- if(name != "*")
- query += " and local-name()='" + name + "']";
- S::SDOM_NodeList result;
- _try_(S::SDOM_xql(m_sit, FROM_D(query).c_str(), m_node, &result));
- return NodeList(new INT::DOMNodeList(m_sit, result));
- }
-
- inline NodeList Document::getElementsByTagName(const dom_str& name) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(DOCUMENT_NODE);
- dom_str query = "descendant::" + name;
- S::SDOM_NodeList result;
- _try_(S::SDOM_xql(m_sit, FROM_D(query).c_str(), m_node, &result));
- return NodeList(new INT::DOMNodeList(m_sit, result));
- }
-
- inline NodeList Document::getElementsByTagNameNS(const dom_str& uri,
- const dom_str& name) const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(DOCUMENT_NODE);
- dom_str query = "descendant::*[namespace-uri()='" + uri + "'";
- if(name != "*")
- query += " and local-name()='" + name + "']";
- S::SDOM_NodeList result;
- _try_(S::SDOM_xql(m_sit, FROM_D(query).c_str(), m_node, &result));
- return NodeList(new INT::DOMNodeList(m_sit, result));
- }
-
- inline DOMImplementation Document::getImplementation() const
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT_TYPE(DOCUMENT_NODE);
- return DOMImplementation(m_sit);
- }
-
- inline Text Text::splitText(int offset)
- throw(DOMException)
- {
- ASSERT_VALID();
- ASSERT(getNodeType() == TEXT_NODE ||
- getNodeType() == CDATA_SECTION_NODE);
-
- data_str val = getNodeValue();
- setNodeValue(val.substr(0, offset));
-
- Document doc = getOwnerDocument();
- ASSERT(doc != NULL);
-
- Text split(m_sit, NULL);
- val = val.substr(0, offset);
-
- switch(getNodeType())
- {
- case TEXT_NODE:
- split = doc.createTextNode(val);
- break;
-
- case CDATA_SECTION_NODE:
- split = doc.createCDATASection(val);
- break;
-
- default:
- ASSERT(false);
- };
-
- Node parent = getParentNode();
- if(parent != NULL)
- {
- Node next = getNextSibling();
- if(next != NULL)
- parent.insertBefore(split, next);
- else
- parent.appendChild(split);
- }
-
- return split;
- }
-
- inline NamedNodeMap DocumentType::getEntities() const
- throw(DOMException)
- {
- ASSERT_VALID();
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return NamedNodeMap(NULL);
- }
-
- inline NamedNodeMap DocumentType::getNotations() const
- throw(DOMException)
- {
- ASSERT_VALID();
- _try_(S::SDOM_NOT_SUPPORTED_ERR);
- return NamedNodeMap(NULL);
- }
-
-}; // namespace DOM
-
-
-#endif //__SABLO_H__
diff --git a/src/sablotr.cpp b/src/sablotr.cpp
deleted file mode 100644
index 47853cc..0000000
--- a/src/sablotr.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2004, Nate Nielsen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- *
- * CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
- *
- */
-
-// SABLOTRON C++ WRAPPER CONVERSION FUNCTIONS
-//
-
-#include <wchar.h>
-#include "sablo.h"
-
-bool DOM::transcode16to8(const std::basic_string<wchar_t>& data,
- std::basic_string<char>& ret)
-{
- ret.resize(0);
- ret.reserve(data.length() + (data.length() / 2));
-
- // basic_string.c_str doesn't work properly everywhere
- // most notably not in the g++ std library
-
- const wchar_t* c = data.length() ? data.data() : L"";
- const wchar_t* e = c + data.length();
-
- for( ; c < e; c++)
- {
- if(*c <= 0x007F)
- {
- ret.append(1, (char)*c);
- }
- else if(*c <= 0x07FF)
- {
- ret.append(1, (char)(192 | (*c >> 6)));
- ret.append(1, (char)(128 | (*c & 63)));
- }
- else
- {
- ret.append(1, (char)(224 | (*c >> 12)));
- ret.append(1, (char)(128 | ((*c >> 6) & 63)));
- ret.append(1, (char)(128 | (*c & 63)) );
- }
- }
-
- return true;
-}
-
-bool DOM::transcode8to16(const std::basic_string<char>& data,
- std::basic_string<wchar_t>& ret)
-{
- ret.resize(0);
- ret.reserve(data.length());
-
- // basic_string.c_str doesn't work properly everywhere
- // most notably not in the g++ std library
-
- const char* c = data.length() ? data.data() : "";
- const char* e = c + data.length();
-
- for( ; c < e; c++)
- {
- // First 4 bits set
- if((c[0] & 0xF8) == 0xF0 &&
- (c[1] & 0xC0) == 0x80 &&
- (c[2] & 0xC0) == 0x80 &&
- (c[3] & 0xC0) == 0x80)
- {
- ret.append(1, (wchar_t)(((wchar_t)c[0] & 7) << 18 |
- ((wchar_t)c[1] & 63) << 12 |
- ((wchar_t)c[2] & 63) << 6 |
- ((wchar_t)c[3] & 63)));
- c += 3;
- }
-
- // First 3 bits set
- else if((c[0] & 0xF0) == 0xE0 &&
- (c[1] & 0xC0) == 0x80 &&
- (c[2] & 0xC0) == 0x80)
- {
- ret.append(1, (wchar_t)(((wchar_t)c[0] & 15) << 12 |
- ((wchar_t)c[1] & 63) << 6 |
- ((wchar_t)c[2] & 63)));
- c += 2;
- }
-
- // First 2 bits set
- else if((c[0] & 0xE0) == 0xC0 &&
- (c[1] & 0xC0) == 0x80)
- {
- ret.append(1, (wchar_t)(((wchar_t)c[0] & 31) << 6 |
- ((wchar_t)c[1] & 63)));
- c += 1;
- }
-
- // First bit set
- else if(!(c[0] & 0x80))
- {
- ret.append(1, (wchar_t)c[0]);
- }
-
- else
- return false;
- }
-
- return true;
-}
diff --git a/src/tags.h b/src/tags.h
deleted file mode 100644
index 98787d9..0000000
--- a/src/tags.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2004, Nate Nielsen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- *
- * CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
- *
- */
-
-#ifndef __TAGS_H__
-#define __TAGS_H__
-
-/*
- * IMPORTANT: When adding tags, attributes or values here make sure to update
- * the XSL Schema for the output formats.
- */
-
-static const char* kNSPrefix = "xmlns";
-static const wchar_t* kNSRtfx = L"http://memberwebs.com/ns/rtfx/";
-
-// Tags used internally
-static const char* kElDest = "i_dest";
-static const char* kElBlock = "i_block";
-static const char* kElListtable = "i_listtable";
-static const char* kElListdef = "i_listdef";
-static const char* kElFontTable = "i_fonttable";
-static const char* kElFontDef = "i_fontdef";
-static const char* kAtFix = "i_fix";
-static const char* kAtCell = "i_cell";
-static const char* kAtList = "i_list";
-
-// All the main tags
-static const char* kElPara = "para";
-static const char* kElDoc = "document";
-static const char* kElTab = "tab";
-static const char* kElSect = "sect";
-static const char* kElPage = "page";
-static const char* kElStyle = "style";
-static const char* kElLine = "line";
-static const char* kElList = "list";
-static const char* kElStylesheet = "stylesheet";
-static const char* kElInfo = "info";
-static const char* kElTitle = "title";
-static const char* kElAuthor = "author";
-static const char* kElOperator = "operator";
-static const char* kElB = "b";
-static const char* kElHide = "hide";
-static const char* kElI = "i";
-static const char* kElStrike = "strike";
-static const char* kElU = "u";
-static const char* kElSuper = "super";
-static const char* kElSub = "sub";
-static const char* kElCell = "cell";
-static const char* kElRow = "row";
-static const char* kElTable = "table";
-static const char* kElFootNote = "footnote";
-static const char* kElRef = "ref";
-static const char* kElFont = "font";
-static const char* kElOptions = "options";
-
-// Attributes
-static const char* kAtName = "name";
-static const char* kAtBold = "bold";
-static const char* kAtHidden = "hide";
-static const char* kAtItalic = "italic";
-static const char* kAtStrike = "strike";
-static const char* kAtUnderline = "underline";
-static const char* kAtColor = "color";
-static const char* kAtType = "type";
-static const char* kAtOrdered = "ordered";
-static const char* kAtStart = "start";
-static const char* kAtId = "id";
-static const char* kAtTo = "to";
-static const char* kAtSize = "size";
-
-// Values
-static const wchar_t* kValDisc = L"disc";
-static const wchar_t* kValLowerAlpha = L"lower-alpha";
-static const wchar_t* kValUpperAlpha = L"upper-alpha";
-static const wchar_t* kValLowerRoman = L"lower-roman";
-static const wchar_t* kValUpperRoman = L"upper-roman";
-static const wchar_t* kValArabic = L"arabic";
-static const wchar_t* kValNull = L"";
-static const wchar_t* kValFootNote = L"footnote";
-static const wchar_t* kValList = L"list";
-static const wchar_t* kValPara = L"para";
-static const wchar_t* kValTable = L"table";
-static const wchar_t* kValTrue = L"true";
-static const wchar_t* kValZero = L"0";
-
-#endif // __TAGS_H__
diff --git a/src/usuals.h b/src/usuals.h
deleted file mode 100644
index eeb13b1..0000000
--- a/src/usuals.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2004, Nate Nielsen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- *
- * CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
- *
- */
-#ifndef __USUALS_H__
-#define __USUALS_H__
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifdef _WIN32
-/* Suppress stupid errors */
-#pragma warning( disable : 4786 )
-#endif
-
-#ifdef _WIN32
-#include "config.win32.h"
-#else
-#include "config.h"
-#endif
-
-#include <stdlib.h>
-#include <assert.h>
-
-#include <wchar.h>
-#include <string>
-using std::string;
-
-#if HAVE_WSTRING
-using std::wstring;
-#else
-typedef std::basic_string<wchar_t> wstring;
-#endif
-
-#endif // __USUALS_H__
diff --git a/src/xmlcomposehelpers.cpp b/src/xmlcomposehelpers.cpp
deleted file mode 100644
index 74eb9c1..0000000
--- a/src/xmlcomposehelpers.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2004, Nate Nielsen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- *
- * CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
- *
- */
-
-#include "usuals.h"
-#include "xmlcomposehelpers.h"
-
-/* ----------------------------------------------------------------------------------
- * CONSTRUCTION
- */
-
-Level::Level()
-{
- m_previous = NULL;
- m_element = NULL;
- m_destination = NULL;
- m_analyser = NULL;
-}
-
-Level::Level(const Level& level) :
- m_text(level.m_text)
-{
- m_element = NULL;
- m_destination = NULL;
- m_analyser = NULL;
- m_previous = &level;
-}
-
-Level::~Level()
-{
- if(m_analyser)
- m_analyser->done();
- if(m_destination)
- m_destination->done();
-}
-
-/* ----------------------------------------------------------------------------------
- * LEVEL OPERATIONS
- */
-
-LevelPtr Level::pushLevel()
-{
- LevelPtr level = new Level(*this);
- return level;
-}
-
-LevelPtr Level::getPrevious()
-{
- return m_previous;
-}
-
-DOM::Element Level::getElement(bool deep)
-{
- if(m_element != NULL)
- return m_element;
- else if(deep && m_previous)
- return m_previous->getElement();
- else
- return DOM::Element();
-}
-
-void Level::setElement(DOM::Element element, bool deep)
-{
- if(deep && m_previous && m_element == NULL)
- m_previous->setElement(element, deep);
- else
- m_element = element;
-}
-
-AnalyserPtr Level::getAnalyser(bool deep)
-{
- if(m_analyser)
- return m_analyser;
- else if(deep && m_previous)
- return m_previous->getAnalyser();
- else
- return NULL;
-}
-
-void Level::setAnalyser(AnalyserPtr analyser, bool deep)
-{
- if(deep && m_previous && !m_analyser)
- m_previous->setAnalyser(analyser, deep);
-
- else
- {
- if(m_analyser != NULL)
- m_analyser->done();
-
- m_analyser = analyser;
- }
-}
-
-DestinationPtr Level::getDestination(bool deep)
-{
- if(m_destination)
- return m_destination;
- else if(deep && m_previous)
- return m_previous->getDestination();
- else
- return NULL;
-}
-
-void Level::setDestination(DestinationPtr destination, bool deep)
-{
- if(deep && m_previous && !m_destination)
- m_previous->setDestination(destination, deep);
- else
- {
- if(m_destination != NULL)
- m_destination->done();
-
- m_destination = destination;
- }
-}
-
-RtfFormatting& Level::getFormatting()
-{
- return m_text;
-}
-
-void Level::setTextProperties(RtfFormatting& formatting)
-{
- m_text.copy(formatting);
-}
diff --git a/src/xmlcomposehelpers.h b/src/xmlcomposehelpers.h
deleted file mode 100644
index aa8a52d..0000000
--- a/src/xmlcomposehelpers.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 2004, Nate Nielsen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- *
- * CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
- *
- */
-
-#ifndef __XMLCOMPOSEHELPERS_H__
-#define __XMLCOMPOSEHELPERS_H__
-
-#include "usuals.h"
-#include "reference.h"
-#include "sablo.h"
-#include "rtfformatting.h"
-
-class XmlComposer;
-
-/*
- * Destination
- *
- * A destination is a small class that handles the character data found
- * in the RTF document. Depending on the current context in the RTF
- * different destinations are used.
- */
-class Destination :
- public Instance
-{
-public:
- // This is called when the Destination is first used
- virtual void initialize() {};
- // Called when data arrives at destination
- virtual void charData(wstring data) {};
- // Called when the Destination goes out of scope
- virtual void done() {};
-
-protected:
- XmlComposer* m_composer;
- friend class XmlComposer;
-};
-
-/*
- * Analyser
- *
- * An analyser is a small class that handles the RTF control words.
- * Depending on the current context in the RTF different analysers
- * are used.
- */
-class Analyser :
- public Instance
-{
-public:
- // This is called when the Analyser is first used
- virtual void initialize() {};
- // Called when a control word is seen
- virtual void controlWord(const string& cw, int flags, int param) {};
- // Called when a group is seen within this scope
- virtual void groupStart() {};
- // Called when a group ends within this scope
- virtual void groupEnd() {};
- // Called when when this analyser goes out of scope
- virtual void done() {};
-
-protected:
- XmlComposer* m_composer;
- friend class XmlComposer;
-};
-
-class Level;
-
-// Reference counted pointers
-typedef Reference<Destination> DestinationPtr;
-typedef Reference<Analyser> AnalyserPtr;
-typedef Reference<Level> LevelPtr;
-
-/*
- * Level
- *
- * A level is a combination of a Destination, Analyser, XML Element and
- * some other options. They're used in a stack to push and pop these as
- * RTF groups are found.
- *
- * About the stack:
- * Not each level has it's own options. If a certain option isn't found
- * in the current level the previous one is looked up. That's what all
- * the 'deep' stuff is about below:
- *
- * get* methods:
- * When 'deep' is set look to previous levels for the given object if not
- * found at the current level. When not set returns object in current level
- * or null when none exists here.
- *
- * set* methods:
- * When 'deep' is set then replace the object currently being used at it's
- * own level. So if get* would return an object from a previous level, with
- * deep set to true it would replace that object in the given level. When
- * not set, then the object is set in the current level.
- */
-class Level :
- public Instance
-{
-public:
- Level();
- virtual ~Level();
-
- LevelPtr getPrevious();
- LevelPtr pushLevel();
-
- // The current XML Element
- DOM::Element getElement(bool deep = true);
- void setElement(DOM::Element element, bool deep = false);
-
- // The current Analyser
- AnalyserPtr getAnalyser(bool deep = true);
- void setAnalyser(AnalyserPtr analyser, bool deep = false);
-
- // The current Destination
- DestinationPtr getDestination(bool deep = true);
- void setDestination(DestinationPtr destination, bool deep = false);
-
- // The current formatting options
- RtfFormatting& getFormatting();
- void setTextProperties(RtfFormatting& textProperties);
-
-protected:
-
- // Constructor for stacking levels
- Level(const Level& level);
-
- LevelPtr m_previous; // The previous level
- DOM::Element m_element; // XML Element for this level
- RtfFormatting m_text; // Formatting options for this level
- DestinationPtr m_destination; // Destination for this level
- AnalyserPtr m_analyser; // Analyser for this level
-};
-
-#endif //__XMLCOMPOSEHELPERS_H__
diff --git a/src/xmlcomposer.cpp b/src/xmlcomposer.cpp
deleted file mode 100644
index 6f41b29..0000000
--- a/src/xmlcomposer.cpp
+++ /dev/null
@@ -1,1245 +0,0 @@
-/*
- * Copyright (c) 2004, Nate Nielsen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- *
- * CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
- *
- */
-
-#include "usuals.h"
-#include "xmlcomposer.h"
-#include "xmlfixups.h"
-#include "domhelpers.h"
-#include "tags.h"
-
-
-wstring formatInt(int num)
-{
- char buff[16];
-
- // Certain OSs don't support swprintf :(
- sprintf(buff, "%d", num);
-
- wstring n;
- for(char* s = buff; *s; s++)
- n.append(1, *s);
-
- return n;
-}
-
-/* ----------------------------------------------------------------------------------
- * CONSTRUCTION
- */
-
-XmlComposer::XmlComposer(const XmlComposerOptions& options)
-{
- m_document = NULL;
- memcpy(&m_options, &options, sizeof(options));
-
- // All autocounters start at 1
- for(int i = 0; i < AUTOCOUNT_MAX; i++)
- m_autocount[i] = 1;
-}
-
-XmlComposer::~XmlComposer()
-{
- clear();
-
- if(m_impl != NULL)
- m_impl.release();
-}
-
-void XmlComposer::clear()
-{
- if(m_document != NULL)
- {
- try
- {
- m_document.release();
- }
- catch(...) { }
-
- m_document = NULL;
- }
- LevelHandler::clear();
-}
-
-
-/* ----------------------------------------------------------------------------------
- * HANDLER OVERRIDES
- */
-
-void XmlComposer::startDocument(RtfParser* reader)
-{
- LevelHandler::startDocument(reader);
- ASSERT(m_curLevel != NULL);
-
- // Create a new document
- m_document = m_impl.createDocument("", kElDoc, DOM::DocumentType());
-
- // TODO: Throw error if document is null
- ASSERT(m_document != NULL);
-
- // Hook up the top level element
- DOM::Element top = m_document.getDocumentElement();
- m_curLevel->setElement(top, true);
-
- // Set the attributes on the top level
- setAnalyser(AnalyserPtr(new Root));
- setDestination(DestinationPtr(new Content));
- getTextFormatting().resetPara();
- getTextFormatting().resetText();
-
- // Create the options element
- m_docOptions = m_document.createElement(kElOptions);
- top.appendChild(m_docOptions);
-}
-
-void XmlComposer::endDocument()
-{
- LevelHandler::endDocument();
-
- XmlFixups fix;
-
- // Pass 0: Cleanup the tree
- // XmlFixups::combineDuplicates(m_document);
- // XmlFixups::consolidateStartTags(m_document);
- // XmlFixups::consolidateEndTags(m_document);
-
- // Pass 1: Block breakout
- fix.breakTables(m_document);
- fix.breakTags(m_document, kElTable, kElRow);
- fix.breakTags(m_document, kElRow, kElCell);
- fix.wrapTags(m_document, kElCell, kElDest);
- fix.breakBlocks(m_document);
- fix.breakLists(m_document);
-
- // Pass 2: Fixups
- fix.runPassTwo(m_document);
-
- // XmlFixups::fixLists(m_document);
- // XmlFixups::fixStyles(m_document);
- // XmlFixups::fixBlocks(m_document);
- // XmlFixups::removeTags(m_document);
- // XmlFixups::breakBreak(m_document, kElDoc, kElPage);
- // XmlFixups::breakBreak(m_document, kElDoc, kElSect);
-
- // Pass 3: Final cleanup
- // XmlFixups::combineDuplicates(m_document);
-
- DOM::Element top = m_document.getDocumentElement();
- ASSERT(top != NULL);
- top.setAttribute(kNSPrefix, kNSRtfx);
-
- return;
-}
-
-void XmlComposer::charData(wstring data)
-{
- ASSERT(m_curLevel != NULL);
- DestinationPtr destination = m_curLevel->getDestination();
-
- if(!destination)
- {
- destination = DestinationPtr(new Content);
- setDestination(destination);
- }
-
- destination->charData(data);
-}
-
-void XmlComposer::controlWord(const string& cw, int flags, int param)
-{
- ASSERT(m_curLevel != NULL);
- AnalyserPtr analyser = m_curLevel->getAnalyser();
- if(analyser)
- analyser->controlWord(cw, flags, param);
-}
-
-void XmlComposer::groupStart()
-{
- LevelHandler::groupStart();
-
- ASSERT(m_curLevel != NULL);
- AnalyserPtr analyser = m_curLevel->getAnalyser();
- if(analyser)
- analyser->groupStart();
-}
-
-void XmlComposer::groupEnd()
-{
- LevelHandler::groupEnd();
-
- ASSERT(m_curLevel != NULL);
- AnalyserPtr analyser = m_curLevel->getAnalyser();
- if(analyser)
- analyser->groupEnd();
-}
-
-
-/* ----------------------------------------------------------------------------------
- * HELPER FUNCTIONS
- */
-
-DOM::Element XmlComposer::createElement(const string& name)
-{
- ASSERT(name.length() > 0);
- return m_document.createElement(name);
-}
-
-void XmlComposer::replaceElement(const DOM::Element& element)
-{
- ASSERT(m_curLevel != NULL);
- m_curLevel->setElement(element, true);
-}
-
-void XmlComposer::pushElement(const DOM::Element& element)
-{
- ASSERT(m_curLevel != NULL);
- getElement().appendChild(element);
- m_curLevel->setElement(element);
-}
-
-void XmlComposer::pushTopElement(const DOM::Element& element)
-{
- ASSERT(m_curLevel != NULL);
- DOM::Element top = m_document.getDocumentElement();
- if(top.hasChildNodes())
- top.insertBefore(element, top.getFirstChild());
- else
- top.appendChild(element);
-
- m_curLevel->setElement(element);
-}
-
-DOM::Element XmlComposer::popElement()
-{
- DOM::Element element = getElement();
- ASSERT(m_curLevel != NULL);
-
- DOM::Node parent = element.getParentNode();
- ASSERT(parent != NULL && parent.getNodeType() == DOM::Node::ELEMENT_NODE);
-
- // Set it deep so it replaces the current element
- m_curLevel->setElement((DOM::Element&)parent, true);
- return element;
-}
-
-void XmlComposer::setAttribute(const string& name, const wstring& value, DOM::Element el)
-{
- ASSERT(name.length() > 0);
- if(el == NULL)
- el = getElement();
- el.setAttribute(name, value);
-}
-
-void XmlComposer::setAttribute(const string& name, int value, DOM::Element el)
-{
- ASSERT(name.length() > 0);
- if(el == NULL)
- el = getElement();
- el.setAttribute(name, formatInt(value));
-}
-
-void XmlComposer::setDestination(DestinationPtr dest)
-{
- ASSERT(m_curLevel);
-
- m_curLevel->setDestination(dest);
- dest->m_composer = this;
- dest->initialize();
-}
-
-DestinationPtr XmlComposer::replaceDestination(DestinationPtr dest)
-{
- ASSERT(m_curLevel);
-
- DestinationPtr old = m_curLevel->getDestination();
- m_curLevel->setDestination(dest, true);
- dest->m_composer = this;
- dest->initialize();
-
- return old;
-}
-
-
-void XmlComposer::setAnalyser(AnalyserPtr analy)
-{
- ASSERT(m_curLevel);
- ASSERT(analy != NULL);
-
- analy->m_composer = this;
- m_curLevel->setAnalyser(analy);
- analy->initialize();
-}
-
-AnalyserPtr XmlComposer::getAnalyser()
-{
- ASSERT(m_curLevel);
- return m_curLevel->getAnalyser();
-}
-
-DestinationPtr XmlComposer::getDestination()
-{
- ASSERT(m_curLevel);
- return m_curLevel->getDestination();
-}
-
-RtfFormatting& XmlComposer::getTextFormatting()
-{
- ASSERT(m_curLevel);
- return m_curLevel->getFormatting();
-}
-
-int XmlComposer::getAutoCount(int type)
-{
- ASSERT(type < AUTOCOUNT_MAX);
- return m_autocount[type];
-}
-
-void XmlComposer::incrementAutoCount(int type)
-{
- ASSERT(type < AUTOCOUNT_MAX);
- m_autocount[type]++;
-}
-
-void XmlComposer::addDocumentOption(DOM::Element& option)
-{
- ASSERT(m_docOptions != NULL);
- m_docOptions.appendChild(option);
-}
-
-
-/* ----------------------------------------------------------------------------------
- * CONVENIENCE MACROS USED BELOW
- */
-
-#define AN_ELEMENT(name) \
- m_composer->pushElement(m_composer->createElement(name))
-#define AN_TOP_ELEMENT(name) \
- m_composer->pushTopElement(m_composer->createElement(name))
-#define AN_POP_ELEMENT() \
- m_composer->popElement()
-#define AN_ATTRIBUTE(name, value) \
- m_composer->setAttribute(name, value)
-#define AN_DESTINATION_ATTR(name) \
- m_composer->setDestination(new Attribute(name))
-#define AN_DESTINATION(cls) \
- m_composer->setDestination(new cls)
-#define AN_ANALYSER(cls) \
- m_composer->setAnalyser(AnalyserPtr(new cls))
-#define AN_SET_ANALYSER(cls) \
- m_composer->setAnalyser(AnalyserPtr(cls))
-#define HAS_PARAM (flags & kHasParam)
-#define DEFAULT_CONTROLWORD processDefault(cw, flags, param)
-#define DUMMY 1 == 1
-#define NUM_ATTR(x) formatInt(x)
-#define DO_EXTRAS() (m_composer->getOptions().extras)
-
-/* ----------------------------------------------------------------------------------
- * BASE ANALYSER
- */
-
-bool XmlComposer::BaseAnalyser::processDefault(const string& cw, int flags, int param)
-{
- // Unicode blocks go to a special analyser
- if(cw == "upr")
- {
- AnalyserPtr analy = m_composer->getAnalyser();
- ASSERT(analy != NULL);
- AN_SET_ANALYSER(new Upr(analy));
- return true;
- }
-
- return false;
-}
-
-void XmlComposer::BaseAnalyser::applyParaFormatting(RtfFormatting* format,
- DOM::Element& el)
-{
- if(format == NULL)
- format = &(m_composer->getTextFormatting());
-
- wstring fix = kValPara;
-
- // Is it a list?
- int list = format->paraList();
- if(list != -1)
- el.setAttribute(kAtList, NUM_ATTR(list));
- else
- el.removeAttribute(kAtList);
-
- // Is it a cell?
- if(format->paraInTable())
- el.setAttribute(kAtCell, L"1");
- else
- el.removeAttribute(kAtCell);
-
- // Paragraph styles
- int style = format->paraStyle();
- if(style != -1)
- el.setAttribute(kElStyle, NUM_ATTR(style));
- else
- el.removeAttribute(kElStyle);
-
- // These fix elements are later picked up in XmlFixups::fixBlocks
- el.setAttribute(kAtFix, fix);
-}
-
-DOM::Element XmlComposer::BaseAnalyser::getCurrentBlock()
-{
- DOM::Node node = m_composer->getElement();
-
- if(node.hasChildNodes())
- node = node.getLastChild();
-
- return DOMHelpers::getPriorElement(node, kElBlock);
-}
-
-bool XmlComposer::BaseAnalyser::processTextContent(const string& cw, int flags, int param)
-{
- DOM::Element el;
- bool process = false;
-
- RtfFormatting& format = m_composer->getTextFormatting();
-
- // New paragraph
- if(cw == "par")
- {
- el = getCurrentBlock();
- if(el != NULL)
- applyParaFormatting(&format, el);
-
- el = m_composer->createElement(kElBlock);
- applyParaFormatting(&format, el);
- }
-
- // Cells (used later in applyParaFormatting)
- else if(cw == "intbl")
- format.paraSetTable(true);
-
- // Start of a cell
- else if(cw == "cell")
- {
- el = getCurrentBlock();
- if(el != NULL)
- applyParaFormatting(&format, el);
-
- el = m_composer->createElement(kElCell);
- m_composer->pushElement(el);
- m_composer->popElement();
- el = m_composer->createElement(kElBlock);
- applyParaFormatting(&format, el);
- }
-
- // Start of a row
- else if(cw == "trowd")
- el = m_composer->createElement(kElRow);
-
- // A tab
- else if(cw == "tab")
- el = m_composer->createElement(kElTab);
-
- // A section break
- else if(cw == "sect")
- el = m_composer->createElement(kElSect);
-
- // A page break
- else if(cw == "page")
- el = m_composer->createElement(kElPage);
-
- // A paragraph style
- else if(cw == "s" && HAS_PARAM)
- format.paraSetStyle(param);
-
- // A line break
- else if(cw == "line")
- el = m_composer->createElement(kElLine);
-
- // A page header (not implemented)
- else if(cw == "header")
- AN_ANALYSER(Skip);
-
- // A page footer (not implemented)
- else if(cw == "footer")
- AN_ANALYSER(Skip);
-
- // A bookmark (not implemented)
- else if(cw == "bkmkstart")
- AN_ANALYSER(Skip);
-
- // List text (not implemented)
- else if(cw == "listtext")
- AN_ANALYSER(Skip);
-
- // Set list style (used in applyFormatting)
- else if(cw == "ls" && HAS_PARAM)
- format.paraSetList(param);
-
- if(el != NULL)
- {
- // This ensures that our content destination is open and ready
- DestinationPtr dest = m_composer->getDestination();
- ASSERT(dest != NULL);
- dest->charData(kValNull);
-
- m_composer->pushElement(el);
- m_composer->popElement();
- }
-
- return (el != NULL) || process;
-}
-
-bool XmlComposer::BaseAnalyser::processTextFormatting(const string& cw, int flags,
- int param, RtfFormatting& format)
-{
- bool on = true;
- if(flags & HAS_PARAM && param == 0)
- on = false;
-
- // Clears all paragraph formatting
- if(cw == "pard")
- {
- format.resetPara();
- // applyParaFormatting();
- }
-
- // Rest are pretty much self-explanatory
- else if(cw == "plain")
- format.resetText();
- else if(cw == "b")
- format.textSetBold(on);
- else if(cw == "i")
- format.textSetItalic(on);
- else if(cw == "v")
- format.textSetHidden(on);
- else if(cw == "ul")
- format.textSetUnderline(on);
- else if(cw == "super")
- format.textSetSuScript(RtfFormatting::SUPERSCRIPT);
- else if(cw == "sub")
- format.textSetSuScript(RtfFormatting::SUBSCRIPT);
- else if(cw == "cf" && HAS_PARAM)
- format.textSetColor(param);
- else if(cw == "f" && HAS_PARAM)
- format.textSetFont(param);
- else if(cw == "fs" && HAS_PARAM)
- format.textSetFontSize(param);
- else
- return false;
-
- return true;
-}
-
-bool XmlComposer::BaseAnalyser::processTextFormatting(const string& cw, int flags, int param)
-{
- return processTextFormatting(cw, flags, param, m_composer->getTextFormatting());
-}
-
-bool XmlComposer::BaseAnalyser::processTextAutoContent(const string& cw, int flags, int param)
-{
- DestinationPtr dest = m_composer->getDestination();
- ASSERT(dest != NULL);
- dest->charData(kValNull);
-
- // Auto generated content
-
- if(cw == "chftn")
- {
- // Footnote auto numbering
- int ac = m_composer->getAutoCount(AUTOCOUNT_FOOTNOTE);
-
- AN_ELEMENT(kElRef);
- AN_ATTRIBUTE(kAtType, kValFootNote);
- AN_ATTRIBUTE(kAtTo, ac);
-
- // Only output the actual link text in this case
- if(DO_EXTRAS())
- dest->charData(formatInt(ac));
-
- AN_POP_ELEMENT();
- return true;
- }
-
- return false;
-}
-
-/* ----------------------------------------------------------------------------------
- * ANALYSER/DESTINATION DEFINITIONS
- */
-
-#define ON_INITIALIZE(cls) \
- void XmlComposer::cls::initialize()
-#define ON_CONTROLWORD(cls) \
- void XmlComposer::cls::controlWord(const string& cw, int flags, int param)
-#define ON_CHARDATA(cls) \
- void XmlComposer::cls::charData(wstring data)
-#define ON_GROUPSTART(cls) \
- void XmlComposer::cls::groupStart()
-#define ON_GROUPEND(cls) \
- void XmlComposer::cls::groupEnd()
-#define ON_DONE(cls) \
- void XmlComposer::cls::done()
-
-
-// Skip Analyser --------------------------------------------------------------------
-
-ON_INITIALIZE(Skip)
- { AN_DESTINATION(Null); }
-
-ON_GROUPSTART(Skip)
- { AN_ANALYSER(Skip); }
-
-
-// Upr Analyser ---------------------------------------------------------------------
-
-XmlComposer::Upr::Upr(AnalyserPtr prv)
-{
- ASSERT(prv);
- prev = prv;
-}
-
-ON_GROUPSTART(Upr)
-{
- AN_ANALYSER(Skip);
-}
-
-ON_GROUPEND(Upr)
-{
- ASSERT(prev);
- m_composer->setAnalyser(prev);
- prev = NULL;
-}
-
-
-// Stylesheet Analyser --------------------------------------------------------------
-
-ON_INITIALIZE(Stylesheet)
-{
- AN_TOP_ELEMENT(kElStylesheet);
-}
-
-ON_GROUPSTART(Stylesheet)
-{
- // Each group should be a style
- AN_ANALYSER(Style);
-
- // Without any character data
- AN_DESTINATION(Null);
-}
-
-
-// Stylesheet Style Analyser --------------------------------------------------------
-
-ON_INITIALIZE(Style)
-{
- // Were not sure if this element is really something
- // so we can't always create
- haveStyle = false;
-}
-
-ON_CONTROLWORD(Style)
-{
- // Get the style id
- if(flags & kAsterisk)
- {
- AN_ANALYSER(Skip);
- return;
- }
-
- // Create the style tag if necessary
- if(!haveStyle)
- {
- AN_ELEMENT(kElStyle);
- AN_DESTINATION_ATTR(kAtName);
- haveStyle = true;
- }
-
- // The style id
- if(cw == "s" && flags & kHasParam)
- {
- AN_ATTRIBUTE(kAtId, param);
- }
-
- // Otherwise get as much formatting out of the tag as possible
- else if(processTextFormatting(cw, flags, param))
- DUMMY;
-
- else
- DEFAULT_CONTROLWORD;
-}
-
-ON_GROUPSTART(Style)
-{
- AN_ANALYSER(Skip);
-}
-
-ON_GROUPEND(Style)
-{
- RtfFormatting& props = m_composer->getTextFormatting();
-
- // Dig out all the formatting attributes
- if(props.textIsBold())
- AN_ATTRIBUTE(kAtBold, kValTrue);
- if(props.textIsHidden())
- AN_ATTRIBUTE(kAtHidden, kValTrue);
- if(props.textIsItalic())
- AN_ATTRIBUTE(kAtItalic, kValTrue);
- if(props.textIsStrike())
- AN_ATTRIBUTE(kAtStrike, kValTrue);
- if(props.textIsUnderline())
- AN_ATTRIBUTE(kAtUnderline, kValTrue);
-
- // TODO: Do fonts and colors here
-}
-
-
-// Font Table Analyser --------------------------------------------------------------
-
-ON_INITIALIZE(FontTable)
-{
- AN_TOP_ELEMENT(kElFontTable);
- AN_DESTINATION(Null);
-}
-
-ON_GROUPSTART(FontTable)
-{
- // Each group should be a font
- AN_ANALYSER(Font);
-}
-
-ON_DONE(FontTable)
-{
- DOM::Element deffont = m_composer->createElement(kElFont);
-
- // Default font is always the first in the list
- deffont->setAttribute(kAtId, kValZero);
-
- // Default size is always 12 pt
- deffont->setAttribute(kAtSize, L"12");
-
- // TODO: Is this correct?
- deffont->setAttribute(kAtColor, kValZero);
-
- m_composer->addDocumentOption(deffont);
-}
-
-// Font Analyser --------------------------------------------------------------------
-
-ON_INITIALIZE(Font)
-{
- AN_ELEMENT(kElFontDef);
- AN_DESTINATION_ATTR(kAtName);
-}
-
-ON_CONTROLWORD(Font)
-{
- // The font id
- if(cw == "f" && flags & kHasParam)
- AN_ATTRIBUTE(kAtId, param);
-
- else
- DEFAULT_CONTROLWORD;
-}
-
-ON_GROUPSTART(Font)
-{
- AN_ANALYSER(Skip);
-}
-
-
-// List Table Analyser --------------------------------------------------------------
-
-ON_INITIALIZE(ListTable)
-{
- AN_TOP_ELEMENT(kElListtable);
-}
-
-ON_GROUPSTART(ListTable)
-{
- // Everything in here should be a list
- AN_ANALYSER(List);
-
- // Content doesn't matter
- AN_DESTINATION(Null);
-}
-
-
-// List (in List Table) Analyser ----------------------------------------------------
-
-ON_INITIALIZE(List)
-{
- // Create a default element
- AN_ELEMENT(kElListdef);
-
- if(DO_EXTRAS())
- AN_ATTRIBUTE(kAtType, kValDisc);
-
- AN_ATTRIBUTE(kAtOrdered, L"0");
- levelsSeen = 0;
-}
-
-ON_CONTROLWORD(List)
-{
- // The name
- if(cw == "listname")
- AN_DESTINATION_ATTR(kAtName);
-
- // The list id
- else if(cw == "listid" && HAS_PARAM)
- AN_ATTRIBUTE(kAtId, param);
-
- // We let listlevel in here too
- else if(cw == "levelstartat" && HAS_PARAM)
- AN_ATTRIBUTE(kAtStart, param);
-
- // The list type
- else if(cw == "levelnfc" && HAS_PARAM)
- {
- if(DO_EXTRAS())
- {
- switch(param)
- {
- case 0: // 1, 2, 3
- case 5: // 1st, 2nd, 3rd
- case 6: // One, Two, Three
- case 7: // First, Second, Third
- case 22: // 01, 02, 03
- AN_ATTRIBUTE(kAtType, kValArabic);
- break;
- case 1: // I, II, III
- AN_ATTRIBUTE(kAtType, kValUpperRoman);
- break;
- case 2: // i, ii, iii
- AN_ATTRIBUTE(kAtType, kValLowerRoman);
- break;
- case 3: // A, B, C
- AN_ATTRIBUTE(kAtType, kValUpperAlpha);
- break;
- case 4: // a, b, c
- AN_ATTRIBUTE(kAtType, kValLowerAlpha);
- break;
- default:
- AN_ATTRIBUTE(kAtType, kValDisc);
- break;
- }
- }
-
- switch(param)
- {
- case 0: case 5: case 6: case 7: case 22:
- case 1: case 2: case 3: case 4:
- AN_ATTRIBUTE(kAtOrdered, L"1");
- break;
- default:
- AN_ATTRIBUTE(kAtOrdered, L"0");
- }
- }
-
- else
- DEFAULT_CONTROLWORD;
-}
-
-ON_GROUPSTART(List)
-{
- // Skip internal groups and content
-
- if(levelsSeen > 0)
- AN_ANALYSER(Skip);
-
- levelsSeen++;
-}
-
-
-// The List Override Table ----------------------------------------------------------
-
-ON_INITIALIZE(ListOverrideTable)
-{
- // Get all of the current lists
- DOM::Document document = m_composer->getDocument();
- lists = document.getElementsByTagName(kElListdef);
- curList = NULL;
- lsId = -1;
-}
-
-ON_GROUPSTART(ListOverrideTable)
-{
- // Content doesn't matter
- AN_DESTINATION(Null);
-}
-
-ON_CONTROLWORD(ListOverrideTable)
-{
- // New list override clear
- if(cw == "listoverride")
- curList = NULL;
-
- // List id for current listoverride
- else if(cw == "listid" && HAS_PARAM)
- {
- wstring id = formatInt(param);
-
- if(lists != NULL)
- {
- // Find the list in question
- for(int i = 0; i < lists->getLength(); i++)
- {
- DOM::Node node = lists->item(i);
- if(node != NULL && node.getNodeType() == DOM::Node::ELEMENT_NODE)
- {
- DOM::Element element = (DOM::Element&)node;
- if(element.getAttribute(kAtId) == id)
- {
- curList = element;
- break;
- }
- }
- }
- }
- }
-
- // The actual list code
- else if(cw == "ls" && HAS_PARAM)
- lsId = param;
-
- // Override the starting level for the node
- else if(cw == "levelstartat" && HAS_PARAM)
- {
- if(curList != NULL)
- curList.setAttribute(kAtStart, NUM_ATTR(param));
- }
-
- else
- DEFAULT_CONTROLWORD;
-
-
- // Okay before any overrides take effect we need to duplicate
- // the list node for overriding, using the 'listid' and 'ls' we gathered
- if(curList != NULL && lsId != -1)
- {
- DOM::Element parent = (const DOM::Element&)curList.getParentNode();
- if(parent != NULL)
- {
- curList = (const DOM::Element&)curList.cloneNode(true);
- if(curList != NULL)
- {
- parent.appendChild(curList);
- curList.setAttribute(kAtId, NUM_ATTR(lsId));
- }
- }
-
- lsId = -1;
- }
-
-}
-
-
-// Info Block Analyser --------------------------------------------------------------
-
-ON_INITIALIZE(Info)
-{
- // Create a new element
- AN_TOP_ELEMENT(kElInfo);
- AN_DESTINATION(Null);
-}
-
-ON_CONTROLWORD(Info)
-{
- if(cw == "title")
- {
- AN_ELEMENT(kElTitle);
- AN_DESTINATION(Raw);
- }
-
- else if(cw == "author")
- {
- AN_ELEMENT(kElAuthor);
- AN_DESTINATION(Raw);
- }
-
- else if(cw == "operator")
- {
- AN_ELEMENT(kElOperator);
- AN_DESTINATION(Raw);
- }
-
- else if(flags & kAsterisk)
- AN_ANALYSER(Skip);
-
- else
- DEFAULT_CONTROLWORD;
-}
-
-
-// Root Analyser --------------------------------------------------------------------
-
-ON_INITIALIZE(Root)
-{
-
-}
-
-ON_CONTROLWORD(Root)
-{
- // All the main RTF sections
- if(cw == "stylesheet")
- AN_ANALYSER(Stylesheet);
- else if(cw == "listtable")
- AN_ANALYSER(ListTable);
- else if(cw == "listoverridetable")
- AN_ANALYSER(ListOverrideTable);
- else if(cw == "info")
- AN_ANALYSER(Info);
- else if(cw == "fonttbl")
- {
- if(DO_EXTRAS())
- AN_ANALYSER(FontTable);
- else
- AN_ANALYSER(Skip);
- }
- else if(cw == "colortbl")
- AN_ANALYSER(Skip);
- else if(cw == "footnote")
- AN_ANALYSER(FootNote);
- else if(cw == "pict")
- {
- AN_ANALYSER(Skip);
- AN_DESTINATION(Null);
- }
- else if(flags & kAsterisk)
- AN_ANALYSER(Skip);
- else if(processTextContent(cw, flags, param))
- DUMMY;
- else if(processTextAutoContent(cw, flags, param))
- DUMMY;
- else if(processTextFormatting(cw, flags, param))
- DUMMY;
- else
- DEFAULT_CONTROLWORD;
-}
-
-
-// Content Destination --------------------------------------------------------------
-
-ON_INITIALIZE(Content)
-{
- parent = m_composer->getElement();
- created = false;
-}
-
-ON_CHARDATA(Content)
-{
- // Create the first time we get content
- if(!created)
- {
- DOM::Element dest = m_composer->createElement(kElDest);
- parent.appendChild(dest);
- m_composer->replaceElement(dest);
-
- DOM::Element el = m_composer->createElement(kElBlock);
- m_composer->pushElement(el);
- m_composer->popElement();
-
- created = true;
- }
-
- if(data.length() == 0)
- return;
-
- int elements = 0;
- RtfFormatting& format = m_composer->getTextFormatting();
-
- // Extra elements written out here are consolidated in
- // XmlFixups::combineDuplicates
-
- // Handle fonts etc...
- if(DO_EXTRAS())
- {
- int font = format.textFont();
- int fontsize = format.textFontSize();
-
- if(font != -1 || fontsize != -1)
- {
- AN_ELEMENT(kElFont);
-
- if(font != -1)
- AN_ATTRIBUTE(kAtName, font);
-
- if(fontsize != -1)
- {
- // Little hack for half point sizes
- wstring size = NUM_ATTR(fontsize / 2);
- if(fontsize % 2)
- size.append(L".5");
-
- AN_ATTRIBUTE(kAtSize, size);
- }
-
- if(format.textColor() != -1)
- AN_ATTRIBUTE(kAtColor, format.textColor());
-
- elements++;
- }
- }
-
- // Now do text Properties if necessary
-
- if(format.textIsBold())
- {
- AN_ELEMENT(kElB);
- elements++;
- }
-
- if(format.textIsHidden())
- {
- AN_ELEMENT(kElHide);
- elements++;
- }
-
- if(format.textIsItalic())
- {
- AN_ELEMENT(kElI);
- elements++;
- }
-
- if(format.textIsStrike())
- {
- AN_ELEMENT(kElStrike);
- elements++;
- }
-
- if(format.textIsUnderline())
- {
- AN_ELEMENT(kElU);
- elements++;
- }
-
- if(format.textSuScript() == RtfFormatting::SUPERSCRIPT)
- {
- AN_ELEMENT(kElSuper);
- elements++;
- }
-
- if(format.textSuScript() == RtfFormatting::SUBSCRIPT)
- {
- AN_ELEMENT(kElSub);
- elements++;
- }
-
- // Write the data to the element
- m_composer->getElement().appendChild(
- m_composer->getDocument().createTextNode(data));
-
- // Now drop out of all the above formatting
- while(elements-- > 0)
- AN_POP_ELEMENT();
-}
-
-
-// FootNote Analyser ----------------------------------------------------------------
-
-ON_INITIALIZE(FootNote)
-{
- int ac = m_composer->getAutoCount(AUTOCOUNT_FOOTNOTE);
-
- AN_ELEMENT(kElFootNote);
- AN_ATTRIBUTE(kAtId, ac);
- AN_DESTINATION(Content);
-}
-
-ON_CONTROLWORD(FootNote)
-{
- // Inside foot notes there's no link to the foot note
- if(cw == "chftn")
- {
- // Only put actual text when in extras mode
- if(DO_EXTRAS())
- {
- DestinationPtr dest = m_composer->getDestination();
- ASSERT(dest != NULL);
- int ac = m_composer->getAutoCount(AUTOCOUNT_FOOTNOTE);
- dest->charData(formatInt(ac));
- }
-
- return;
- }
-
- // Process text content in the foot note
- else if(processTextContent(cw, flags, param))
- DUMMY;
- else if(processTextAutoContent(cw, flags, param))
- DUMMY;
- else if(processTextFormatting(cw, flags, param))
- DUMMY;
- else
- DEFAULT_CONTROLWORD;
-}
-
-ON_DONE(FootNote)
-{
- m_composer->incrementAutoCount(AUTOCOUNT_FOOTNOTE);
-}
-
-
-// Raw Destination ------------------------------------------------------------------
-
-ON_CHARDATA(Raw)
-{
- // Write the data to the element
- m_composer->getElement().appendChild(
- m_composer->getDocument().createTextNode(data));
-}
-
-
-// Attribute Destination ------------------------------------------------------------
-
-ON_INITIALIZE(Attribute)
-{
- element = m_composer->getElement();
- ASSERT(element != NULL);
-}
-
-ON_CHARDATA(Attribute)
-{
- // Get the current value
- wstring cur = element.getAttribute(name);
-
- if(data.at(data.size() - 1) == L';')
- data.resize(data.size() - 1);
-
- // Append data
- cur.append(data);
-
- // Write it back
- element.setAttribute(name, cur);
-}
-
diff --git a/src/xmlcomposer.h b/src/xmlcomposer.h
deleted file mode 100644
index 41aad0e..0000000
--- a/src/xmlcomposer.h
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * Copyright (c) 2004, Nate Nielsen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- *
- * CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
- *
- */
-
-#ifndef __XMLCOMPOSER_H__
-#define __XMLCOMPOSER_H__
-
-#include "levelhandler.h"
-
-struct XmlComposerOptions
-{
- XmlComposerOptions()
- { memset(this, 0, sizeof(*this)); }
-
- bool extras;
-};
-
-/*
- * XmlComposer
- *
- * This is where the RTF gets initially converted to XML. RtfParser sends
- * notifications to this class's RtfHandler interface. It forwards them to
- * the current analysers and destinations which produce XML content.
- * (see xmlcomposehelpers.h)
- *
- * Not all conversion is completed here. Because RTF is so very wierd we
- * have to run lots of fixups are run in endDocument (see rtffixups.h)
- */
-class XmlComposer :
- public LevelHandler
-{
-public:
- XmlComposer(const XmlComposerOptions& options);
- virtual ~XmlComposer();
-
- // Handler Overrides
- virtual void startDocument(RtfParser* reader);
- virtual void endDocument();
- virtual void controlWord(const string& cw, int flags, int param);
- virtual void groupStart();
- virtual void groupEnd();
- virtual void charData(wstring data);
-
- // Create an XML element with given name
- DOM::Element createElement(const string& name);
-
- // Push an XML element on the current level
- void pushElement(const DOM::Element& element);
-
- // Push an element at the top of the document
- void pushTopElement(const DOM::Element& element);
-
- // Replace current XML element with given element
- void replaceElement(const DOM::Element& element);
-
- // Move up one XML element level without changing RTF level
- DOM::Element popElement();
-
- // Set attributes on the current XML Element
- void setAttribute(const string& name, const wstring& value, DOM::Element el = DOM::Element());
- void setAttribute(const string& name, int value, DOM::Element el = DOM::Element());
-
- // The current analyser in use
- AnalyserPtr getAnalyser();
- void setAnalyser(AnalyserPtr analy);
-
- // The current destination in use
- DestinationPtr getDestination();
- void setDestination(DestinationPtr dest);
-
- // Replace the current destination (sets level deep)
- DestinationPtr replaceDestination(DestinationPtr dest);
-
-
- // The types of auto numbering
- enum
- {
- AUTOCOUNT_FOOTNOTE,
- AUTOCOUNT_MAX
- };
-
- // Functions for RTF auto numbering
- int getAutoCount(int type);
- void incrementAutoCount(int type);
-
- // Add a document option to the option block
- void addDocumentOption(DOM::Element& option);
-
- // Get the current formatting options
- RtfFormatting& getTextFormatting();
-
- DOM::Document getDocument()
- { return m_document; }
-
- const XmlComposerOptions& getOptions()
- { return m_options; }
-
-
-// LevelHandler override
-protected:
- virtual void clear();
-
-
-// Data
-protected:
- DOM::DOMImplementation m_impl; // For creating the document
- DOM::Document m_document; // The current document
- XmlComposerOptions m_options; // Configurable options for parsing
- int m_autocount[AUTOCOUNT_MAX]; // Auto counters for the document
- DOM::Element m_docOptions; // For storing document options
-
-// Sub classes
-protected:
-
- #define DESTINATION(cls) class cls : public Destination { public:
- #define END_DESTINATION };
- #define ANALYSER(cls) class cls : public BaseAnalyser { public:
- #define END_ANALYSER };
- #define DATA_PORTION protected:
- #define INITIALIZE virtual void initialize();
- #define CHARDATA virtual void charData(wstring data);
- #define CONTROLWORD virtual void controlWord(const string& cw, int flags, int param);
- #define GROUPSTART virtual void groupStart();
- #define GROUPEND virtual void groupEnd();
- #define DONE virtual void done();
-
- // Main destination for document character content
- DESTINATION(Content)
- INITIALIZE
- CHARDATA
- DATA_PORTION
- bool created;
- DOM::Element parent;
- END_DESTINATION
-
- // Discards character data
- DESTINATION(Null)
- END_DESTINATION
-
- // Copies raw character data to output
- DESTINATION(Raw)
- CHARDATA
- END_DESTINATION
-
- // Copies character data to an XML attribute
- DESTINATION(Attribute)
- Attribute(const string& nm) : name(nm) {}
- INITIALIZE
- CHARDATA
- DATA_PORTION
- string name;
- DOM::Element element;
- END_DESTINATION
-
-
- // Base class for analysers with some helper functions
- class BaseAnalyser :
- public Analyser
- {
- public:
- virtual void controlWord(const string& cw, int flags, int param)
- { processDefault(cw, flags, param); }
-
- protected:
- // Process a standard set of tags that can be found anywhere
- bool processDefault(const string& cw, int flags, int param);
-
- // Process text formatting tags
- bool processTextFormatting(const string& cw, int flags, int param, RtfFormatting& format);
- bool processTextFormatting(const string& cw, int flags, int param);
-
- // Creates 'fix' tags for paragraph formatting in element
- void applyParaFormatting(RtfFormatting* format, DOM::Element& el);
-
- // Process tags that are either text content, or change context
- bool processTextContent(const string& cw, int flags, int param);
-
- // Process tags that generate text content (like auto-numbering, fields)
- bool processTextAutoContent(const string& cw, int flags, int param);
-
- // Convenience function
- DOM::Element getCurrentBlock();
- };
-
-
- // Skip tags and groups
- ANALYSER(Skip)
- INITIALIZE
- GROUPSTART
- END_ANALYSER
-
- // Unicode block analyser
- ANALYSER(Upr)
- Upr(AnalyserPtr prv);
- GROUPSTART
- GROUPEND
- DATA_PORTION
- AnalyserPtr prev;
- END_ANALYSER
-
- // Handle Stylesheets
- ANALYSER(Stylesheet)
- INITIALIZE
- GROUPSTART
- END_ANALYSER
-
- // Handle a style in a stylesheet
- ANALYSER(Style)
- INITIALIZE
- CONTROLWORD
- GROUPSTART
- GROUPEND
- DATA_PORTION
- bool haveStyle;
- END_ANALYSER
-
- // Handle the Font Table
- ANALYSER(FontTable)
- INITIALIZE
- GROUPSTART
- DONE
- END_ANALYSER
-
- // Handle a Font in the Table
- ANALYSER(Font)
- INITIALIZE
- CONTROLWORD
- GROUPSTART
- END_ANALYSER
-
- // Handle the list definitions
- ANALYSER(ListTable)
- INITIALIZE
- GROUPSTART
- END_ANALYSER
-
- // Handle a list in the list definitions
- ANALYSER(List)
- INITIALIZE
- CONTROLWORD
- GROUPSTART
- DATA_PORTION
- int levelsSeen;
- END_ANALYSER
-
- // Handle list overrides
- ANALYSER(ListOverrideTable)
- INITIALIZE
- CONTROLWORD
- GROUPSTART
- DATA_PORTION
- DOM::NodeList lists;
- int lsId;
- DOM::Element curList;
- END_ANALYSER
-
- // Creates the info block
- ANALYSER(Info)
- INITIALIZE
- CONTROLWORD
- END_ANALYSER
-
- // The main root analyser
- ANALYSER(Root)
- INITIALIZE
- CONTROLWORD
- END_ANALYSER
-
- // Handles footnotes
- ANALYSER(FootNote)
- INITIALIZE
- CONTROLWORD
- DONE
- END_ANALYSER
-};
-
-#endif // __XMLCOMPOSER_H__
diff --git a/src/xmlfixups.cpp b/src/xmlfixups.cpp
deleted file mode 100644
index 3b56f6b..0000000
--- a/src/xmlfixups.cpp
+++ /dev/null
@@ -1,794 +0,0 @@
-/*
- * Copyright (c) 2004, Nate Nielsen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- *
- * CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
- *
- */
-
-#include "usuals.h"
-#include "xmlfixups.h"
-#include "domhelpers.h"
-#include "tags.h"
-
-static const char* kNoDuplicates[] =
- { kElB, kElU, kElI, kElFont, kElHide, kElSuper, kElSub, NULL };
-
-static const char* kRequireAttrs[] =
- { kElFont, NULL };
-
-static const char* kRemoveTags[] =
- { kElDest, kElListdef, kElListtable, kElFontTable, kElFontDef, NULL };
-
-static const char* kRemoveEmpty[] =
- { kElOptions, kElList, NULL };
-
-static const char* kBlockTags[] =
- { kElTable, kElPara, NULL };
-
-static const char* kHideList[] =
- { kAtId, kAtList, NULL };
-
-static const char* kConsolidateEnd[] =
- { kElFootNote, NULL };
-
-static const char* kConsolidateStart[] =
- { kElStylesheet, kElInfo, NULL };
-
-void loadStringSet(StringSet& set, const char** strings)
-{
- while(*strings)
- set.insert(string(*(strings++)));
-}
-
-XmlFixups::XmlFixups()
-{
- loadStringSet(m_duplicates, kNoDuplicates);
- loadStringSet(m_removes, kRemoveTags);
- loadStringSet(m_removeEmpty, kRemoveEmpty);
- loadStringSet(m_requireAttrs, kRequireAttrs);
- loadStringSet(m_consolidateStart, kConsolidateStart);
- loadStringSet(m_consolidateEnd, kConsolidateEnd);
-}
-
-bool XmlFixups::breakElement(const DOM::Element& el, const string& contain)
-{
- ASSERT(el != NULL);
-
- DOM::Element parent = (const DOM::Element&)el.getParentNode();
- DOM::Element grandparent;
-
- string s = el.getNodeName();
- s = parent.getNodeName();
-
- // Get the parent node
- if(parent != NULL)
- grandparent = (const DOM::Element&)parent.getParentNode();
-
- // Make sure we have something to work with before continuing
- if(grandparent == NULL || parent == NULL ||
- DOMHelpers::isElement(parent, contain))
- return true;
-
- DOM::Node e;
-
- // Check to see if this is the first node in the parent.
- // If so then just move out to before
- if(el.getPreviousSibling() == NULL)
- {
- e = grandparent.insertBefore(parent.removeChild(el), parent);
- }
-
-
- // Check to see if this is the last node in the parent.
- // If so then just move out to after the parent
- else if(el.getNextSibling() == NULL)
- {
- DOM::Node next = parent.getNextSibling();
- if(next == NULL)
- e = grandparent.appendChild(parent.removeChild(el));
- else
- e = grandparent.insertBefore(parent.removeChild(el), next);
- }
-
-
- // Otherwise it's in the middle so split the parent
- // element etc...
- else
- {
- // Clone it but not deep
- DOM::Element parent2 = (const DOM::Element&)parent.cloneNode(false);
-
- if(parent2 == NULL)
- return false;
-
- // Flag that tells us whether we moved anything up to parent
- bool moved = false;
-
- // Now move all nodes after this one to the second parent.
- while((e = el.getNextSibling()) != NULL)
- {
- parent2.appendChild(parent.removeChild(e));
- moved = true;
- }
-
- // Remove the element from it's parent
- e = parent.removeChild(el);
-
- // Okay now we move the paragraph up to the parent
- DOMHelpers::insertAfter(grandparent, e, parent);
- if(moved)
- DOMHelpers::insertAfter(grandparent, parent2, e);
- }
-
- // Now call it again with the paragraph in the new position
- // until everything's cut through!
- return breakElement((DOM::Element&)e, contain);
-}
-
-void XmlFixups::breakBlocks(DOM::Document& document)
-{
- // First break out all the paragraphs to the destination level
- DOM::NodeList blocks = document.getElementsByTagName(kElBlock);
- if(blocks != NULL)
- {
- for(int i = 0; i < blocks->getLength(); i++)
- {
- DOM::Element block = (const DOM::Element&)blocks->item(i);
-
- // If it's the single closed style para then break it
- if(block != NULL && !block.hasChildNodes())
- breakElement(block, kElDest);
- }
- }
-
-
- // Now group stuff in destinations into paras or other blocks
- DOM::NodeList destinations = document.getElementsByTagName(kElDest);
- if(destinations != NULL)
- {
- for(int i = 0; i < destinations->getLength(); i++)
- {
- DOM::Element dest = (const DOM::Element&)destinations->item(i);
-
- // Sanity Check
- if(dest == NULL || !dest.hasChildNodes())
- continue;
-
- // Go through the children of this destination
- DOM::Node child = dest.getFirstChild();
-
- DOM::Element block;
-
- while(child != NULL)
- {
- // If it's a block
- if(DOMHelpers::isElement(child, kElBlock))
- {
- block = (DOM::Element&)child;
- child = child.getNextSibling();
- continue;
- }
-
- // If it's already a real block element
- for(const char** t = kBlockTags; *t != NULL; t++)
- {
- if(DOMHelpers::isElement(child, *t))
- {
- block = NULL;
- break;
- }
- }
-
- // If there's a block then add to it
- if(block != NULL)
- {
- block.appendChild(dest.removeChild(child));
- child = block;
- }
-
- child = child.getNextSibling();
- }
- }
- }
-}
-
-void XmlFixups::wrapTags(DOM::Document& doc, const string& tagName,
- const string& wrapName)
-{
- DOM::NodeList tags = doc.getElementsByTagName(tagName);
- if(tags != NULL)
- {
- for(int i = 0; i < tags->getLength(); i++)
- {
- DOM::Element tag = (const DOM::Element&)tags->item(i);
-
- DOM::Element wrap = doc.createElement(wrapName);
- while(tag.hasChildNodes())
- wrap.appendChild(tag.removeChild(tag.getFirstChild()));
-
- tag.appendChild(wrap);
- }
- }
-}
-
-void XmlFixups::breakTags(DOM::Document& doc, const string& parentName,
- const string& tagName)
-{
- DOM::NodeList parents = doc.getElementsByTagName(parentName);
- if(parents != NULL)
- {
- for(int i = 0; i < parents->getLength(); i++)
- {
- DOM::Element parent = (const DOM::Element&)parents->item(i);
-
- if(!parent.hasChildNodes())
- continue;
-
- // First perform the breaks
- DOM::NodeList tags = parent.getElementsByTagName(tagName);
- if(tags != NULL)
- {
- for(int i = 0; i < tags->getLength(); i++)
- breakElement((const DOM::Element&)tags->item(i), parentName);
- }
-
- DOM::Node tag = doc.createElement(tagName);
- parent.insertBefore(tag, parent.getFirstChild());
-
- DOM::Node child = tag;
-
- while(child != NULL && (child = child.getNextSibling()) != NULL)
- {
- if(DOMHelpers::isElement(child, kElBlock))
- {
- DOM::Node next = child.getNextSibling();
- if(next == NULL)
- {
- parent.removeChild(child);
- continue;
- }
-
- if(DOMHelpers::isElement(next, tagName))
- {
- DOM::Node twodown = next.getNextSibling();
- if(!DOMHelpers::isElement(twodown, kElBlock))
- {
- child = parent.insertBefore(parent.removeChild(next), child);
- }
- else
- {
- parent.removeChild(child);
- child = next;
- }
- }
- }
-
- if(DOMHelpers::isElement(child, tagName))
- {
- if(!tag.hasChildNodes())
- parent.removeChild(tag);
- tag = child;
- }
- else
- {
- tag.appendChild(parent.removeChild(child));
- child = tag;
- }
- }
-
- if(!tag.hasChildNodes())
- parent.removeChild(tag);
- }
- }
-
- DOM::NodeList tags = doc.getElementsByTagName(tagName);
- if(tags != NULL)
- {
- for(int i = 0; i < tags->getLength(); i++)
- {
- DOM::Element tag = (const DOM::Element&)tags->item(i);
- DOM::Node parent = tag.getParentNode();
-
- if(parent != NULL && !DOMHelpers::isElement(parent, parentName))
- parent.removeChild(tag);
- }
- }
-}
-
-void XmlFixups::breakLists(DOM::Document& doc)
-{
- DOM::NodeList destinations = doc.getElementsByTagName(kElDest);
- if(destinations != NULL)
- {
- for(int i = 0; i < destinations->getLength(); i++)
- {
- DOM::Element dest = (const DOM::Element&)destinations->item(i);
-
- // Sanity Check
- if(dest == NULL)
- continue;
-
- // Go through the children of this destination
- DOM::Node child = dest.getFirstChild();
-
- DOM::Element list;
- DOM::Element e;
-
- wstring previd;
-
- while(child != NULL)
- {
- // If it's a block ...
- if(DOMHelpers::isElement(child, kElBlock))
- {
- e = (DOM::Element&)child;
-
- // ... and has a list attribute
- wstring listid = e.getAttribute(kAtList);
- if(listid.length() > 0)
- {
- e.removeAttribute(kAtList);
-
- if(list == NULL || previd != listid)
- {
- list = doc.createElement(kElList);
- list.setAttribute(kAtList, listid);
- dest.insertBefore(list, child);
- previd = listid;
- }
- }
- else
- {
- list = NULL;
- previd.erase();
- }
- }
-
- // It's not a block
- if(list != NULL)
- {
- list.appendChild(dest.removeChild(child));
- child = list;
- }
-
- child = child.getNextSibling();
- }
- }
- }
-}
-
-void XmlFixups::runPassTwo(const DOM::Document& doc)
-{
- /*
- * Okay, this function is complicated and long. It was all broken up into
- * shorter functions previously but that sucked for efficiency. Basically
- * we want to iterate over the document as few times as possible and because
- * of that we combine all of that here.
- *
- * In this pass:
- * o Fix:
- * - font names
- * - style names
- * - list attributes
- * - block elements
- * o Consolidate certain tags to end of doc
- * o Consolidate certain tags to start of doc
- * o Combine duplicates of certain tags
- * o Remove certain tags
- * o Break out pages and sections
- */
-
- bool haveStyles = false;
- ElementTable styles;
-
- bool haveFonts = false;
- ElementTable fonts;
-
- bool haveLists = false;
- ElementTable lists;
-
- DOM::Element top = doc.getDocumentElement();
-
- NodeStack toStart; // Nodes that get moved to beginning of document
- NodeStack toEnd; // Nodes that get moved to the end of the document
-
- ElementIterator it(top);
- ElementIterator end;
-
- DOM::Element el;
-
- for( ; it != end; ++it)
- {
- el = *it;
-
- // Mark each node as we've seen it so we don't
- // do a given element twice
- if((int)el.getUserData() == PASS_TWO)
- continue;
-
- el.setUserData((void*)PASS_TWO);
- string name = el.getNodeName();
-
- // Get stylesheet block
- if(name == kElStylesheet)
- {
- // Load the styles into a id mapped table
- styles.load(el, kElStyle);
-
- if(!styles.empty())
- {
- styles.removeIds();
- haveStyles = true;
- }
- }
-
- // The Font Table
- else if(name == kElFontTable)
- {
- // Load the fonts into an id mapped table
- fonts.load(el, kElFontDef);
-
- if(!fonts.empty())
- {
- fonts.removeIds();
- haveFonts = true;
- }
- }
-
- // Get the list definition block
- else if(name == kElListtable)
- {
- // Load the lists into an id mapped table
- lists.load(el, kElListdef);
-
- if(!lists.empty())
- {
- lists.removeIds();
- haveLists = true;
- }
- }
-
- else if(name == kElBlock)
- {
- // Change style attribute on blocks to name
- if(haveStyles && el.hasAttribute(kElStyle))
- {
- DOM::Element style = styles.get(el.getAttribute(kElStyle));
- if(style != NULL)
- el.setAttribute(kElStyle, style.getAttribute(kAtName));
- }
-
- /*
- * The below function call replaces the current element with another
- * new element. The new element still needs to be processed, so we
- * just backup one, and then short circuit the loop below.
- */
- --it;
-
- // Now fix the block itself
- fixBlock(doc, el);
-
- continue; // Current element no longer valid
- }
-
- // Change id attribute on fonts to name
- else if(haveFonts && name == kElFont)
- {
- if(el.hasAttribute(kAtId))
- {
- DOM::Element font = fonts.get(el.getAttribute(kAtId));
- if(font != NULL)
- el.setAttribute(kAtName, font.getAttribute(kAtName));
-
- el.removeAttribute(kAtId);
- }
- }
-
- // Copy list attributes onto the lists
- else if(haveLists && name == kElList)
- {
- if(el.hasAttribute(kAtList))
- {
- DOM::Element list = lists.get(el.getAttribute(kAtList));
- if(list != NULL)
- {
- // And copy all the attributes from the list definition to the list
- DOMHelpers::copyAttributes(list, el, kHideList);
- el.removeAttribute(kAtList);
- }
- }
- }
-
- // Break out pages and sections all the way to document
- if(name == kElPage || name == kElSect)
- {
- breakElement(el, kElDoc);
-
- /*
- * NOTE: The flow of the document is changed here. But the current
- * element is still in a valid place for iterating over the document
- * so we don't have to worry about it.
- */
- }
-
- // Tags that get removed but contents preserved. Also here are
- // tags that get removed if they have no attributes
- if(m_removes.find(name) != m_removes.end() ||
- (m_requireAttrs.find(name) != m_requireAttrs.end() && !el.hasAttributes()))
- {
- DOM::Node parent = el->getParentNode();
-
- if(parent != NULL)
- {
- /*
- * After the element is removed, the current element is no longer
- * valid for iterating over the document. In addition we insert
- * all the child nodes of the current element before it. We need
- * to be sure to iterate over these elements, and to do so we
- * decrement the iterator.
- */
- --it;
-
- while(el.hasChildNodes())
- parent.insertBefore(el.removeChild(el.getFirstChild()), el);
-
- parent.removeChild(el);
- continue; /* Current element doesn't need any more processing */
- }
- }
-
- // Tags that get removed when no child nodes exist
- if(m_removeEmpty.find(name) != m_removeEmpty.end() && !el.hasChildNodes())
- {
- DOM::Node parent = el->getParentNode();
-
- if(parent != NULL)
- {
- /*
- * After the element is removed, the current element is no longer
- * valid for iterating over the document. In addition we insert
- * all the child nodes of the current element before it. We need
- * to be sure to iterate over these elements, and to do so we
- * decrement the iterator.
- */
- --it;
-
- parent.removeChild(el);
- continue; /* Current element doesn't need any more processing */
- }
- }
-
- // Tags that need to get consolidated to start
- if(m_consolidateStart.find(name) != m_consolidateStart.end())
- toStart.push(el);
-
- // Tags that need to get consolidated to end
- else if(m_consolidateEnd.find(name) != m_consolidateEnd.end())
- toEnd.push(el);
-
-
- // Tags for which duplicates need to be combined
- if(m_duplicates.find(name) != m_duplicates.end())
- {
- DOM::Element parent = (const DOM::Element&)el.getParentNode();
- if(parent != NULL)
- {
- // Loop till we find no more of the same
- for(;;)
- {
- DOM::Node next = el.getNextSibling();
-
- if(next == NULL || next.getNodeType() != DOM::Node::ELEMENT_NODE)
- break;
-
- // If it's the same type of element ...
- if(!DOMHelpers::isEqualElement((DOM::Element&)next, el))
- break;
-
- // NOTE: Notice we do nothing with attributes. Currently
- // all elements in the duplicates list don't need that.
-
- while(next.hasChildNodes())
- el.appendChild(next.removeChild(next.getFirstChild()));
-
- // Remove duplicate node
- parent.removeChild(next);
- }
- }
- }
- }
-
- // Complete consolidation to front
- while(!toStart.empty())
- {
- DOM::Node node = toStart.top();
- DOM::Node parent = node.getParentNode();
- if(parent != NULL && DOMHelpers::hasAncestor(top, node))
- {
- // Remove it from it's child
- parent.removeChild(node);
-
- // And put at start of the document of the document
- top.insertBefore(node, top.getFirstChild());
- }
-
- toStart.pop();
- }
-
- // Complete consolidation to end
- while(!toEnd.empty())
- {
- DOM::Node node = toEnd.top();
- DOM::Node parent = node.getParentNode();
- if(parent != NULL && DOMHelpers::hasAncestor(top, node))
- {
- // Remove it from it's child
- parent.removeChild(node);
-
- // And put at end of the document of the document
- top.appendChild(node);
- }
-
- toEnd.pop();
- }
-
-}
-
-void XmlFixups::breakTables(DOM::Document& doc)
-{
- // Break rows out to destinations
- DOM::NodeList rows = doc.getElementsByTagName(kElRow);
- if(rows != NULL)
- {
- for(int i = 0; i < rows->getLength(); i++)
- {
- DOM::Element row = (const DOM::Element&)rows->item(i);
- DOM::Node parent = row.getParentNode();
-
- if(parent == NULL)
- continue;
-
- if(DOMHelpers::isElement(parent, kElBlock))
- {
- DOM::Node grandparent = parent.getParentNode();
-
- if(grandparent != NULL && !row.hasChildNodes())
- {
- if(row.getPreviousSibling() == NULL)
- grandparent.insertBefore(parent.removeChild(row), parent);
- else if(row.getNextSibling() == NULL)
- DOMHelpers::insertAfter(grandparent, parent.removeChild(row), parent);
- }
- }
-
- breakElement(row, kElDest);
- }
- }
-
- // Now group stuff in destinations into tables
- DOM::NodeList destinations = doc.getElementsByTagName(kElDest);
- if(destinations != NULL)
- {
- for(int i = 0; i < destinations->getLength(); i++)
- {
- DOM::Element dest = (const DOM::Element&)destinations->item(i);
-
- // Sanity Check
- if(dest == NULL)
- continue;
-
- // Go through the children of this destination
- DOM::Node child = dest.getFirstChild();
-
- DOM::Element table;
- DOM::Element e;
-
- while(child != NULL)
- {
- // If it's a block and has a cell attribute
- if(DOMHelpers::isElement(child, kElBlock))
- {
- e = (DOM::Element&)child;
-
- // if it has a cell attribute
- if(e.getAttribute(kAtCell).length() > 0)
- {
- e.removeAttribute(kAtCell);
-
- if(table == NULL)
- {
- table = doc.createElement(kElTable);
- dest.insertBefore(table, child);
- }
- }
- else
- {
- table = NULL;
- }
- }
-
- // It's not a block
- if(table != NULL)
- {
- table.appendChild(dest.removeChild(child));
- child = table;
- }
-
- child = child.getNextSibling();
- }
- }
- }
-}
-
-
-void XmlFixups::fixBlock(const DOM::Document& doc, DOM::Element& block)
-{
- // Okay now change blocks to whatever element they're supposed to be
- string fix;
- wstring val;
-
- DOM::Node parent = block.getParentNode();
-
- if(parent != NULL)
- {
- // Figure out what kind of element they want block fixed to
- val = block.getAttribute(kAtFix);
- if(val.length() > 0)
- block.removeAttribute(kAtFix);
-
- // BUG: Sablotron bug work around
- if(val.length() == 0)
- {
- val = block.getAttributeNS("", kAtFix);
- if(val.length() > 0)
- block.removeAttributeNS("", kAtFix);
- }
-
- if(val.length() > 0)
- DOM::transcode16to8(val, fix);
-
- if(fix.length() == 0)
- fix = kElPara;
-
- // Create duplicate of the 'fix' element
- DOM::Element el = doc.createElement(fix);
- DOMHelpers::copyAttributes(block, el, NULL);
-
- // Replace block with the given 'fix' element
- while(block.hasChildNodes())
- el.appendChild(block.removeChild(block.getFirstChild()));
-
- parent.replaceChild(el, block);
- }
-}
diff --git a/src/xmlfixups.h b/src/xmlfixups.h
deleted file mode 100644
index 99fe876..0000000
--- a/src/xmlfixups.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) 2004, Nate Nielsen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- *
- * CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
- *
- */
-
-#ifndef __XMLFIXUPS_H__
-#define __XMLFIXUPS_H__
-
-#include "sablo.h"
-#include "domhelpers.h"
-
-/*
- * XmlFixups
- *
- * Because RTF is so 'different' (read: brain dead) we need to do all sorts
- * of antics to get it into a nice XML format. Some of the XML Composition
- * is done in XmlComposer, but whatever can't be done there as we're parsing
- * gets done here after the fact.
- *
- * These functions are called from XmlComposer::endDocument and massage the
- * resulting XML DOM into shape.
- */
-class XmlFixups
-{
-public:
- XmlFixups();
-
- /*
- * Breaks a paragraph up through a previous level. Calls itself
- * recursively to break paragraphs totally free up to containing
- * destination.
- *
- * For example:
- *
- * <dest>
- * This is <b> a <block fix="para"/>
- * test of </b> your concentration.
- * </dest>
- *
- * Becomes:
- *
- * <dest>
- * This is <b> a </b><block fix="para"/>
- * <b>test of </b> your concentration.
- * </dest>
- */
- bool breakElement(const DOM::Element& el, const string& contain);
-
- // Break all tags of a given type to a previous level (see above)
- void breakBreak(DOM::Document& doc, const string& contain, const string& tag);
-
- // Used to break tables cells and rows into blocks (but more complicated)
- void breakTags(DOM::Document& doc, const string& parentName, const string& tagName);
-
- // Fixes and combines list elements with the same id
- void breakLists(DOM::Document& document);
-
- // Used to find and create tables and perform initial break out
- void breakTables(DOM::Document& document);
-
-
- /*
- * Changes from a marker based paragraph system to a contained
- * paragraph system. Also applies paragraph attributes to the
- * appropriate paragraph.
- *
- * For example:
- *
- * <dest>
- * This <blockattr style="10"> is <b> a <block fix="para"/>
- * test of </b> your concentration.
- * </dest>
- *
- * Becomes:
- *
- * <para style="10"> This is <b> a </b></para>
- * <para><b>test of </b> your concentration.</para>
- */
- void breakBlocks(DOM::Document& document);
-
- // Wrap certain tags in a wrapper tag of given name
- void wrapTags(DOM::Document& document, const string& tagName, const string& wrapName);
-
- // Remove certain tags from document
- void removeTags(const DOM::Document& doc);
-
- // Combines certain adjacent duplicate tags
- void combineDuplicates(const DOM::Document& doc);
-
- // Consolidates a certain tag types at the beginning of the document
- void consolidateStartTags(DOM::Document& doc);
-
- // Consolidates a certain tag types at the end of the document
- void consolidateEndTags(DOM::Document& doc);
-
-
- // The main pass 2 function
- void runPassTwo(const DOM::Document& doc);
-
- // Replace blocks with 'fix' elements like paragraphs
- void fixBlock(const DOM::Document& doc, DOM::Element& block);
-
-
-protected:
-
- enum
- {
- PASS_0,
- PASS_1,
- PASS_TWO
- };
-
- // Our tables cached for efficiency
- StringSet m_duplicates;
- StringSet m_removes;
- StringSet m_removeEmpty;
- StringSet m_consolidateStart;
- StringSet m_consolidateEnd;
- StringSet m_requireAttrs;
-};
-
-#endif // __XMLFIXUPS_H__
diff --git a/win32/.cvsignore b/win32/.cvsignore
deleted file mode 100644
index fdc9a0c..0000000
--- a/win32/.cvsignore
+++ /dev/null
@@ -1,8 +0,0 @@
-rtfx.ncb
-rtfx.plg
-rtfx.opt
-rtfx.ncb
-debug
-release
-Makefile
-Makefile.in
diff --git a/win32/Makefile.am b/win32/Makefile.am
deleted file mode 100644
index 1ab9118..0000000
--- a/win32/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# Copyright (c) 2004, Nate Nielsen
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# * Redistributions of source code must retain the above
-# copyright notice, this list of conditions and the
-# following disclaimer.
-# * Redistributions in binary form must reproduce the
-# above copyright notice, this list of conditions and
-# the following disclaimer in the documentation and/or
-# other materials provided with the distribution.
-# * The names of contributors to this software may not be
-# used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
-# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-# DAMAGE.
-#
-#
-# CONTRIBUTORS
-# Nate Nielsen <nielsen@memberwebs.com>
-#
-#
-
-
-EXTRA_DIST=rtfx.dsp rtfx.dsw sablot
-
diff --git a/win32/rtfx.dsp b/win32/rtfx.dsp
deleted file mode 100644
index f89ca96..0000000
--- a/win32/rtfx.dsp
+++ /dev/null
@@ -1,182 +0,0 @@
-# Microsoft Developer Studio Project File - Name="rtfx" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=rtfx - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "rtfx.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "rtfx.mak" CFG="rtfx - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "rtfx - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "rtfx - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "rtfx - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "release"
-# PROP Intermediate_Dir "release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "sablot/include" /I "../" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 sablot.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"sablot/lib" /opt:nowin98
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "rtfx - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "debug"
-# PROP Intermediate_Dir "debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../" /I "sablot/include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 sablot.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"sablot/lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "rtfx - Win32 Release"
-# Name "rtfx - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\src\domhelpers.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\levelhandler.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\rtfparser.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\rtfx.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\sablotr.cpp
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlcomposehelpers.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlcomposer.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlfixups.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\src\domhelpers.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\levelhandler.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\reference.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\rtfformatting.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\rtfparser.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\sablo.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\tags.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\usuals.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlcomposehelpers.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlcomposer.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlfixups.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=..\src\readme.txt
-# End Source File
-# End Target
-# End Project
diff --git a/win32/rtfx.dsw b/win32/rtfx.dsw
deleted file mode 100644
index 050295c..0000000
--- a/win32/rtfx.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "rtfx"=.\rtfx.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/win32/sablot/INSTALL b/win32/sablot/INSTALL
deleted file mode 100644
index d382aa6..0000000
--- a/win32/sablot/INSTALL
+++ /dev/null
@@ -1,364 +0,0 @@
-This file describes the installation procedure of Sablotron. To know
-
-more on Sablotron, please read the README file in the same directory
-
-as this file.
-
-
-
-To get more info on installing on *Windows*, please read
-
-the INSTALL_WIN file.
-
-
-
-For specific information on how to build Sablotron with JavaScript
-
-engine (to enable extensions) see the README_JS file.
-
-
-
-1. Intro
-
-2. Building
-
-3. Preinstalled Expat
-
-4. Binary distributions
-
-5. Environment
-
-6. Documentation
-
-7. More info
-
-
-
-
-
-1. Intro
-
-========================================
-
-
-
-Sablotron is based on Expat XML parser.
-
-
-
-There is a significant change of how Expat is used since version
-
-0.50. Sablotron _never_ looks for Expat under its own source tree, but
-
-it supposes, that you have installed Expat library (1.95.1 or later)
-
-in your system.
-
-
-
-To get Expat, visit
-
-
-
-http://sourceforge.net/projects/expat/
-
-
-
-and download/install source/binary package.
-
-
-
-Sablotron should be able to find and link older expat libraries
-
-(libxmlparse, libxmltok), but this feature is not tested and is
-
-deprecated.
-
-
-
-
-
-2. Building (sources)
-
-========================================
-
-
-
-If you have downloaded the binary distribution, you can skip reading this
-
-section and go to the Environment section.
-
-
-
-Sablotron compiles e.g. on the following platforms:
-
-
-
-- Linux (RH 5.2 - 7.0, gcc 2.95.2 or later)
-
-- Windows (NT 4.0, 9x, 2000, VC++ 4.2/6.0)
-
-- Solaris (Solaris 2.5.1, 2.6, 7, gcc 2.91.57)
-
-- FreeBSD (FreeBSD 3.4, 4.1)
-
-- OpenBSD (OpenBSD 2.8 beta)
-
-- HP-UX
-
-- Irix
-
-- MacOS X
-
-
-
-If you need any other port, please contact us.
-
-
-
-We use GNU autoconf since the version 0.41. So the following steps
-
-should work on any UNIX platform:
-
-
-
- ./configure
-
- make
-
- make install (may require the root privileges)
-
-
-
-These switches can be passed to ./configure
-
-
-
- --enable-javascript
-
- enables JS extension functions
-
- --enable-perlconnect
-
- required when installed with Charlie application framework
-
- --enable-debugger
-
- enables XSLT debugger
-
- --with-readline
-
- links the debugger with the readline library to make its command-line
-
- interface more comfortable (SABLOT_GPL=1 must be exported)
-
-
-
-These are some other useful switches you may want to pass to the configure
-
-script:
-
-
-
- --help
-
- display all switches available
-
- --prefix='path where to install'
-
- specifies the installation path (/usr/local on most systems)
-
- --enable-warnings
-
- force compilation with the -Wall switch (for curious people)
-
- --disable-adding-meta
-
- disables adding of the META tag (html output method)
-
- --disable-static
-
- static library is not created to make compilation faster
-
-
-
-
-
-3. Preinstalled Expat
-
-========================================
-
-
-
-This chapter is obsolete, but may contain some useful info for people
-
-running older configuration.
-
-
-
-This version of the build process on all Unix platforms respects the
-
-presence of Expat sources. If you have installed Sablotron and Expat in
-
-the past (with `make install'), the configure script writes makefiles, so
-
-they link Expat from your system directories (the sources win, if present).
-
-
-
-If you have installed Expat in some non-system directories in the
-
-past, configure script won't find headers, and build process will
-
-fail, even if you specify include path with --includedir switch. To
-
-fix this problem, set CPLUS_INCLUDE_PATH environment variable to point
-
-to Expat headers.
-
-
-
-
-
-4. Binary distributions
-
-========================================
-
-
-
-Binaries are available for Linux Intel (rpm) and Windows32.
-
-
-
-
-
-5. Environment
-
-========================================
-
-
-
-No environment changes are needed (finally!). That's,
-
-of course, true only if you've used standard 'make install'
-
-procedure.
-
-
-
-The list of environment variables, you may possibly need modify:
-
-
-
-LIBRARY_PATH: set this variable to the directory, where the Expat XML
-
-parser is installed. Do it in the case the configure/linker couldn't
-
-find the expat libraries.
-
-
-
-LD_LIBRARY_PATH: add lib directory to this variable, if sabcmd reports
-
-"Can't load shared library libsablot.0.xx" or such thing.
-
-
-
-CPLUS_INCLUDE_PATH: is needed if you didn't install Sablotron (and
-
-mainly Expat) into system directories and you're going compile new
-
-version against older version of Expat. (see "Preinstalled Expat")
-
-
-
-On some systems (UnixWare, NetBSD...) the compiler is unable to find
-
-headers in /usr/local/include. Consequently the 'configure' script
-
-doesn't find the expat header and compilation fails. To avoid this
-
-problem, set CPPFLAGS environment to
-
-'-I/usr/local/include'. CPLUS_INCLUDE_PATH is not enough.
-
-
-
-If want to link Sablotron with GNU readline library you need set SABLOT_GPL
-
-environment variable to 1 to declare you are going to use this software
-
-under the GPL.
-
-
-
-
-
-6. Documentation
-
-========================================
-
-
-
-The source package contains XML sources of three guides:
-
-
-
-Sablotron Guide and Reference
-
-Sablotron Extensions API Reference
-
-SXP Reference
-
-
-
-These guides are translated to HTML during the building of the package.
-
-By default, you can find the HTML guides in
-
-
-
-$(distdir)/doc/apidoc/[sablot|jsdom-ref|sxp]
-
-and
-
-$(datadir)/doc/html/[sablot|jsdom-ref|sxp]
-
-
-
-directories.
-
-
-
-The building of documentation requires Perl and XML::Parser to be installed;
-
-otherwise the building is skipped.
-
-
-
-
-
-7. More info
-
-========================================
-
-
-
-We suppose you have read the README file. If you haven't, read it now.
-
-If it is not enough, take a look at our website:
-
-
-
-http://www.gingerall.org
-
-
-
-
-
-Enjoy Sablotron!!
-
-
-
-GA
-
diff --git a/win32/sablot/INSTALL_WIN b/win32/sablot/INSTALL_WIN
deleted file mode 100644
index b192bc7..0000000
--- a/win32/sablot/INSTALL_WIN
+++ /dev/null
@@ -1,224 +0,0 @@
-This file describes Sablotron installation procedure on Windows. To
-
-find out more on Sablotron, please read the README file in the same
-
-directory as this file. To get more info on installing on Linux or Unix,
-
-please read the file INSTALL.
-
-
-
-
-
-1. Intro
-
-2. Sablotron binaries
-
- 2.1. Binaries and dependencies
-
-3. Building Sablotron from sources
-
- 3.1. Notes on dependencies
-
-4. More information
-
-
-
-
-
-1. Intro
-
-========================================
-
-
-
-Sablotron is based on Expat XML parser.
-
-
-
-There is a significant change of how Expat is used since version
-
-0.50. Sablotron _never_ looks for Expat under its own source tree, but
-
-it supposes, that you have installed Expat library (1.95.1 or later)
-
-in your system.
-
-
-
-To get Expat, visit
-
-
-
-http://sourceforge.net/projects/expat/
-
-
-
-and download/install source/binary package.
-
-
-
-
-
-2. Sablotron binaries
-
-========================================
-
-
-
-Download and extract the binary package. The only requirement is that
-
-expat.dll must be installed in your system. You can download
-
-the Sablot dll as binary from http://sourceforge.net/projects/expat/.
-
-If you download a Windows binary of expat you have to rename it to expat.dll
-
-(without a version number). Ensure expat.dll is on your PATH.
-
-
-
-Copy sablot.dll and sabcmd.exe somewhere to your PATH.
-
-
-
-2.1. Binaries and dependencies
-
-------------------------------
-
-
-
-To support other than built-in charsets you must use the iconv library.
-
-To support JavaScript extensions you must use JS library by Mozilla.
-
-For your convenience, There is a Sablotron binary package available
-
-supporting both iconv and JavaScript. This package
-
-(Sablot-Win-x.xx-FullPack.zip) actualy contains three independent products:
-
-
-
-- Sablotron binary (linking iconv)
-
-- iconv binary (look at ftp://ftp.ilog.fr/pub/Users/haible/gnu/ for sources)
-
-- JavaScript binary (look at http://www.mozilla.org/js/ for sources)
-
-
-
-Copy iconv.dll, js32.exe, sablot.dll and sabcmd.exe somewhere to your PATH.
-
-
-
-
-
-3. Building Sablotron from sources
-
-========================================
-
-
-
-If you have downloaded the binary distribution, you can skip reading this
-
-section.
-
-
-
-To build Sablotron from sources you have to build expat first. Download
-
-expat sources from http://sourceforge.net/projects/expat/ and build it
-
-(project file for MS DevStudio 6.0 is included).
-
-
-
-Sablotron can be built with many different options. These options are defined
-
-in sablot_config.msvc file. You can either edit this file or preferably create
-
-its local copy named sablot_config.local. The config file itself is rather
-
-self-decriptive.
-
-
-
-The recommended procedure is the following:
-
-
-
-1. copy sablot_config.msvc to sablot_config.local
-
-2. edit sablot_config.local
-
-3. type 'nmake -f makefile.msvc'
-
-
-
-Then install the Sablotron DLL and executable as described in section 2.
-
-Make sure expat.dll (iconv.dll, js32.dll) are on your PATH (if you link them).
-
-
-
-
-
-3.1. Notes on dependencies
-
---------------------------
-
-
-
-Iconv is a library for encoding conversions. You don't need to have it
-
-installed, but in that case, you will only be able to use a few encodings.
-
-Sablot has been tested on NT with Bruno Haible's implementation of iconv,
-
-available from ftp://ftp.ilog.fr/pub/Users/haible/gnu/libiconv-1.3.tar.gz
-
-
-
-If you change the way Sablot or iconv are being built, make sure they both
-
-use the DLL version of the C runtime library (msvcrt.dll), i.e. compile
-
-with /MD. This is because they need to share the global variable errno.
-
-
-
-JavaScript is the popular Netscape-developed object scripting language.
-
-Sablotron has to link the JS engine to enable extension functions.
-
-See http://www.mozilla.org/js/ for more details or to get sources.
-
-
-
-
-
-4. More information
-
-========================================
-
-
-
-If you are in trouble and haven't read the README file, you may find some
-
-useful information there. You can check our website as well:
-
-
-
-http://www.gingerall.com
-
-
-
-
-
-Enjoy Sablotron!!
-
-
-
-GA
-
diff --git a/win32/sablot/README b/win32/sablot/README
deleted file mode 100644
index 15bfa96..0000000
--- a/win32/sablot/README
+++ /dev/null
@@ -1,174 +0,0 @@
-This is the README file for the XSL processor called Sablotron
-
-
-
-1. What is it Sablotron?
-
-2. Licensing
-
-3. Warranty
-
-4. Porting
-
-5. Installation
-
-6. Sablotron and Perl
-
-7. More info
-
-
-
-
-
-1. What is Sablotron?
-
-========================================
-
-
-
-Sablotron is an XML processor fully implemented in C++. It uses Expat by
-
-James Clark as an XML parser. Sablotron implements XSLT 1.0, XPath 1.0
-
-and DOM Level2.
-
-
-
-Original creator of Sablotron is Ginger Alliance (www.gingerall.com).
-
-
-
-
-
-2. Licensing
-
-========================================
-
-
-
-Sablotron is an Open Source project released under the MPL (Mozilla Public
-
-License). Alternatively you may use Sablotron under the GNU's GPL license.
-
-
-
-Please, look at http://www.mozilla.org/MPL or
-
-http://www.gnu.org/copyleft/gpl.html for further info.
-
-
-
-If you want use the debugger, you may optionally ask Sablotron to use
-
-the GNU readline library. Since this library is available under GPL
-
-only, you have to confirm, that you are accepting the GPL for the
-
-whole Sablotron library. You can do it, if you set the SABLOT_GPL=1
-
-environment during the configure process.
-
-
-
-3. Warranty
-
-========================================
-
-
-
-We offer NO WARRANTY for using Sablotron in any conditions.
-
-
-
-
-
-4. Porting
-
-========================================
-
-
-
-So far Sablotron is tested on Linux (RedHat 5.2, 6.0, 6.1, 6.2, 7.0,
-
-8.0 and 9), Windows (NT 4.0, 95, 98, 2000), Solaris (2.5.1, 2.6, 7),
-
-HP-UX (11.00), FreeBSD (3.4, 4.1), OpenBSD (2.8 beta) and OpenServer
-
-(5.0.x). We hope, that it should work on most other Unix systems as well.
-
-
-
-If you build Sablotron on some other system, please, let us
-
-know. All porting activities are welcome.
-
-
-
-
-
-5. Installation
-
-========================================
-
-
-
-To build and run Sablotron read the INSTALL file in the same
-
-directory as this file.
-
-
-
-To install or compile Sablotron on Windows read the INSTALL_WIN
-
-file instead.
-
-
-
-
-
-6. Sablotron and Perl
-
-========================================
-
-
-
-If you'd like to call Sablotron from Perl, download the XML::Sablotron
-
-module from our website (http://www.gingerall.org) or from CPAN.
-
-
-
-Follow the instructions from the README and INSTALL files of the Perl package.
-
-
-
-
-
-7. More info
-
-========================================
-
-
-
-For more info (including Sablotron manual and API reference) look at
-
-the Ginger Alliance web site:
-
-
-
-http://www.gingerall.org
-
-
-
-Maillist subscriptions are also available on this site.
-
-
-
-
-
-Enjoy Sablotron!!
-
-
-
-GA
-
diff --git a/win32/sablot/README_JS b/win32/sablot/README_JS
deleted file mode 100644
index 10611a9..0000000
--- a/win32/sablot/README_JS
+++ /dev/null
@@ -1,214 +0,0 @@
-Sablotron XSLT Extensions Readme File
-
-=====================================
-
-
-
-1. Building
-
-----------------------------------------
-
-
-
-Extension elements and functions as defined by XSLT 1.0 are
-
-implemented in Sablotron since the version 0.80. Sablotron recognizes
-
-the extension element <http://www.exslt.org/functions/script> as
-
-suggested by exslt.org. There are some exceptions described later in
-
-this document. Please note, that this feature is still supposed to be
-
-EXPERIMENTAL.
-
-
-
-If you want to benefit form this feature, you have to install
-
-JavaScript engine from mozilla.org (SpiderMonkey). You have to do it
-
-even when you have Mozilla browser installed, because the binary
-
-browser installation doesn't include essential header files.
-
-
-
-An alternative way to get all neccessary JS files is to download and
-
-install Charlie application framework (see gingerall.org).
-
-
-
-All you need to do on Sablotron side is to run the configure script
-
-with --enable-javascript option. To use JS engine from Charlie
-
-installation, type: ./configure --enable-javascript --enable-perlconnect
-
-
-
-If you have installed JS libraries into non-standard directories, you
-
-need to set (and export) CPLUS_INCLUDE_PATH/LIBRARY_PATH to point to
-
-directories where the header files/lib files (e.g. libjs.so) can be found.
-
-
-
-The default name for the linked library is 'js' (-ljs switch) - if you
-
-need to override this value, you may set SABLOT_JSLIB environment
-
-variable - the configure script uses -l$(SABLOT_JSLIB) in this case.
-
-
-
-
-
-2. What is working
-
-----------------------------------------
-
-
-
-Sablotron supports JavaScript (ECMA) scripting as described in XSTL WD
-
-1.1. with few exceptions:
-
-
-
-- DOM functions handling namespaces (with NS in their name) are not
-
- supported (throw NOT_SUPPORTED exception)
-
-
-
-- DOM model is read only (as supported, may be changed later)
-
-
-
-- XSLTContext.stringValue is not supported
-
-
-
-- Document.getElementsByTagName{NS} are not supported
-
-
-
-- Element.getElementsByTagName{NS} are not supported
-
-
-
-- DTD definition nodes are not supported
-
-
-
-
-
-The following summarizes what IS supported:
-
-
-
-- exslt:script element support
-
-
-
-- XSLTContext object
-
-
-
-- DOM2 acces to a processed document
-
-
-
-- type mapping between XPath and JavaScript including the XSLT
-
- external object support
-
-
-
-- function-available() function
-
-
-
-- element-available() function
-
-
-
-
-
-3. Sample stylesheet
-
-----------------------------------------
-
-
-
-<?xml version='1.0'?>
-
-<xsl:stylesheet version='1.0'
-
- xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
-
- xmlns:exslt='http://www.exslt.org/functions'
-
- xmlns:my='http://gingerall.org/sablot/myfunc'
-
- extension-element-prefixes='exslt'
-
- exclude-result-prefixes='my'>
-
-
-
- <xsl:output method='xml' indent='yes'/>
-
-
-
- <exslt:script language='javascript' implements-prefix='my'>
-
- <![CDATA[
-
-
-
- function getNodeNames(nodeList)
-
- {
-
- ret = '';
-
- for (i = 0; i < nodeList.length; i++)
-
- {
-
- ret += nodeList[i].nodeName + " ";
-
- }
-
- return ret;
-
- }
-
-
-
- ]]>
-
- </exslt:script>
-
-
-
-
-
- <xsl:template match='/'>
-
- <output>
-
- <xsl:value-of select='my:getNodeNames(*)'/>
-
- </output>
-
- </xsl:template>
-
-
-
-</xsl:stylesheet>
-
diff --git a/win32/sablot/RELEASE b/win32/sablot/RELEASE
deleted file mode 100644
index 2d837b6..0000000
--- a/win32/sablot/RELEASE
+++ /dev/null
@@ -1,792 +0,0 @@
-#====================================================================#
-
-# The release file for Sablotron #
-
-#====================================================================#
-
-
-
-Version 1.0.1
-
-November 24, 2003
-
------------------
-
- - minor changes to configure (snprintf tested)
-
- - fixed a bug of wrong error line numbers in imported or
-
- included template
-
- - fixed a bug of count() function argument casting
-
- - misplaced xsl:import no more processed
-
- [reported by Bob Kline]
-
- - fixed a bug of crashing current() [reported by Alex Greg]
-
- - fixed a bug in DOM (inserting child nodes)
-
- - fixed a bug of pointers sized differently from boolean on
-
- 64-bit platforms
-
-
-
-Version 1.0
-
-August 8, 2003
-
----------------
-
- - two flags SAB_DUMP_SHEET_STRUCTURE (0x40) and
-
- SAB_NO_EXTERNAL_ENTITIES (0x80) added
-
- - nested xsl:attribute reported as error
-
- - &gt; is always escaped to prevent problems with CDATA end
-
- - new configurable set of makefiles for Windows MSVC++ has been
-
- created to replace existing Makefile.nt file
-
- [by Rosimildo daSilva, patch by Bob Kline]
-
- - fixed a type comparison failing on arm, powerpc and s390
-
- [reported by Debian maintainers]
-
- - fixed a bug of default NS in imported/included templates
-
- - fixed a segfault in keys defined on empty nodes
-
- [reported by Simon Spanihel]
-
- - minor changes to compile under QNX 6.2
-
- [patch by Adrian Weiler]
-
- - fixed a bug of nested imports [reported by Dave Brooks]
-
- - fixed a bug of UTF-16 encoded files on Win
-
- [reported by Andrey Sokolov]
-
- - fixed a bug of defenition check in shandler.h for Borland
-
- compilers [reported by Vladimir Lukianov]
-
- - fixed a bug of crashing sorting on Windows
-
- - fixed a bug of crashing key() on RTF
-
- [reported by Valeriy Ovechkin]
-
- - solved the issue of too many files open with exsl:document
-
- - fixed a bug of casting of 64-bit pointers to (int)
-
- [patch by Steve Crockett]
-
- - fixed a bug absolute paths starting with a drive letter on
-
- Windows (unsupported scheme is reported)
-
- - fixed a bug of SDOM_DestroyDocument
-
-
-
-Version 0.98
-
-April 7, 2003
-
--------------
-
- - added stylesheet chaining to sabcmd [by Stefan Behnel]
-
- - changes in XML::Sablotron (new layout, added DOMHandler SXP
-
- interface) [by Nicolas Trebst and Anselm Kruis]
-
- - fixed a bug of variables bound for SXP queries
-
- - fixed a bug of the self axis (principal node type)
-
- - fix for Metrowerks C/C++ compiler [suggested by Tim Crook]
-
- - fixed a bug of forbidden XPath (child::xxx@yyy)
-
- - configuration fixes (APIDOC docs are built only when
-
- Perl/XML::Parser found)
-
- - fixed defaults for xsl:number
-
- - fixed a bug of required order of top-level variables
-
- - fixes in the outputting of NS declarations
-
- - fixes in the import precedence [report by Roy Huggins]
-
- - added a new config switch for sabcmd to abort on XSLT error
-
- (--enable-abort-on-error)
-
- - fixed a bug in namespace-alias
-
- - fixed segfault occurring when formating big numbers (>1e127)
-
- - fixed comparison of char to 0 for unsigned-char platforms
-
-
-
-Version 0.97
-
-December 30, 2002
-
------------------
-
- - fixed the problem with Expat 1.95.5
-
- - fixed a bug in xsl:message [report by Bob Kline]
-
- - fixed an infinite loop bug in recursive imports
-
- [report by Michael Vladimirov]
-
- - added SablotGetOptions() function
-
- - added a new option (SAB_FILES_TO_HANDLER) to pass the 'file'
-
- URIs to the scheme handler
-
- - fixed collisions with PHP/Java extension, Arena* renamed to
-
- SabArena [suggested by Christian Stocker]
-
- - mapping of namespaces added to xql() function (DOM)
-
- - chars illegal in output encoding displayed as references
-
- (for xml, html, xhtml output methods)
-
- - fixed resolution of relative URIs in document()
-
- - fixed a bug of not overridden imported parameters
-
- - documentation sources (APIDOC XML) added to distribution
-
-
-
-Version 0.96
-
-September 5, 2002
-
------------------
-
- - XSLT debugger implemented (sabcmd --debugger)
-
- - API fixes for PHP extension
-
- - log() function added to write to Sablot's log from JS scripts
-
- - conflicts of top-level elements (variable, key, script)
-
- initializations resolved
-
- - fixed xslt_process buffer overflow
-
- - fixed a bug of duplicate NS qualified attributes
-
- - minor SXP bug fixes [using patches by Tim Crook]
-
- - fixed a bug of the 'mod' operator [report by Jork Behrends]
-
- - fixed a bug of sorting with multiple keys [report by Jork Behrends]
-
- - fixed a bug of comparison [report by Jork Behrends]
-
- - DOM: fixed a bug of the default XML namespace
-
- [report by Albert Micheev]
-
- - DOM: fixed a bug of PIs [report by Albert Micheev]
-
- - improved configuration [by Melvyn Sopacua]
-
- - fragment identifiers allowed in document() for custom
-
- schemes [report by Bob Kline]
-
-
-
-Version 0.95
-
-June 24, 2002
-
--------------
-
- - DOM support upgraded to DOM Level2
-
- - xsl:strip-space and xsl:preserve-space implemented
-
- - XSLT on external documents (accessed via callbacks)
-
- - esxlt:document instruction implemented
-
- - unparsed-entity-uri() function implemented
-
- - added a manual page for sabcmd
-
- - added a batch mode (multiple sources/stylesheets)
-
- for sabcmd [by Stefan Behnel]
-
- - added a system property to display version
-
- - added a flag for document() to return an empty node-set when
-
- it refers to non-existing document
-
- - fixed a bug in relative paths to ext. entities
-
- - fixed a sorting bug on Solaris
-
- - fixed matching precedence for processing-instruction('lit')
-
- - fixed a bug in xsl:decimal-format/format-number()
-
- - fixed a bug in string() - comments excluded
-
- - fixed a bug of RTFs in xsl:attribute (comment, pi)
-
- - fixed a bug of generate-id for multiple documents
-
- - various minor fixes
-
-
-
-Version 0.90
-
-March 8, 2002
-
--------------
-
- - xsl:import implemented
-
- - fixed a bug in boolean expressions with nodesets
-
- [reported by John Holland]
-
- - current() implementation redesigned
-
- - variables not allowed in 'match' attributes of templates
-
- - fixed a bug in attribute value escaping [Christian Lefebvre]
-
- - fixed a bug in ext. entities base URI [Christian Lefebvre]
-
- - fixed a bug in sabcmd --base option [Christian Lefebvre]
-
- - span not indented with html method
-
- - processing-instruction() node test allows literal arguments
-
- - only top-level variables and params visible in xsl:attribute-set
-
- - fixed a bug in xsl:number
-
- - fixed a bug in master situation cleanup
-
- [patch proposed by Bill Hofmann and Bob Kline]
-
- - fixed a bug in error reports from included files
-
- - correct name of element, attribute and pi is checked
-
-
-
-Version 0.82
-
-January 30, 2002
-
-----------------
-
- - fixed the text output method
-
- (nothing but text nodes are outputted)
-
- - SCRIPT and STYLE escaped for xhtml
-
- - fixed a bug in escaping attributtes (src, href)
-
- - fixed a bug in aliasing doctype declaration
-
- - fixed bugs related to Sun CC compiler [Tim Crook, Greg Cope]
-
- - fixed a memory management bug [Tim Crook]
-
-
-
-Version 0.81
-
-January 16, 2002
-
-----------------
-
- - PUBLIC URLs in doctypes and ext. entities not parsed
-
- by default (SAB_PARSE_PUBLIC_ENTITIES situation option)
-
- - non-xsl elements allowed inside xsl:stylesheet
-
- - xsl attributes not outputted anymore
-
- - xsl:namespace-alias translates attributes as well
-
- - content of SCRIPT and STYLE not escaped for html/xhtml
-
- - Boolean attributes are abbreviated for html output method
-
-
-
-Version 0.80
-
-January 8, 2002
-
----------------
-
- - implemented extensions (JavaScript functions + DOM,
-
- extension-element-prefixes, xsl:fallback, function-available(),
-
- element-available())
-
- - fixed a bux in the 'following' axis
-
- - fixed current() assertion fault
-
- - fixed "META tag placed outside HEAD" bug
-
- - fixed a bug in abbreviated [position] expression in
-
- template 'match' attribute
-
- - implemented lang () function
-
- - added 'namespace' attribute of xsl:element
-
- - implemented 'exclude-result-prefixes'
-
- - implemented xsl:attribute-set and 'use-attribute-sets'
-
- - added 'namespace' attribute of xsl:attribute
-
- - fixed translate() bug
-
- - key() now works with document()
-
- - fixed short stylesheet notation output bugs
-
- - added use-attribute-sets attribute to xsl:copy
-
- - minor bugs fixed
-
-
-
-Version 0.71
-
-November 5, 2001
-
-----------------
-
- - sum() bug fixed
-
- - fixed a Solaris problem with key() [report by Archie Russell]
-
- - SXP minor bugs fixed
-
- - implemented axes 'following' and 'preceding'
-
- - added an SXP callback for id() and a 'user data' pointer for
-
- some callbacks
-
- - fixed a namespace bug in SXP
-
- - improved error messages
-
- - fixed a bug in parsing external files [reported by Tim Crook]
-
- - fixed a bug of current() in inner context()
-
- [reported by Ian Davis]
-
- - fixed a bug of calling XSLT instructions inside xsl:text
-
- - fixed a SablorRunProcessorGen assertion bug
-
- - fixed a scheme handler bug [reported by Tim Crook]
-
-
-
-Version 0.70
-
-September 17, 2001
-
-------------------
-
- - added Sablotron XPath processor
-
- - implemented xsl:key and key()
-
- - implemented format-number() and xsl:decimal-format
-
- - implemented xsl:number
-
- - fixed namespace treatment in the DOM part
-
- - the string functions now work correctly with non-ASCII text
-
- [fix partly by Christian Lefebvre]
-
- - fixed a bug in the DOM interface
-
- - fixes for BeOS [Gabe Bauman]
-
-
-
-Version 0.65
-
-August 15, 2001
-
----------------
-
- - improved HTML indentation
-
- - fixed bug causing output of XML declaration when method='text'
-
- [reported by Jason Dumler]
-
- - parameter entities are always parsed
-
- - xml declaration ends with ?> using HTML method
-
- - > is escaped in HTML
-
- - fixed the RTF serialization [report by Christian Lefebvre]
-
- - fixed the non-ASCII character escaping in URIs
-
- - changed SDOM_xql so it uses namespace declarations on the
-
- document element
-
- - a few more minor bug fixes
-
-
-
-Version 0.60
-
-June 13, 2001
-
--------------
-
- - implemented a subset of DOM level 1 (see sdom.h)
-
- - added sdom.cpp and sdom.h to the project
-
- - new interface methods for Sablotron (preferred use)
-
- SablotRunProcessorGen, SablotAddArgTree, SablotAddArgBuffer
-
- SablotAddParam
-
- - added a simple support of <xsl:output indent>
-
- - fixed a namespace node name bug [report by A. Nuzhdov]
-
- - added support for parametr entities [suggested by Peter Blum]
-
- - fixed a bug related to evaluation of arithmetic
-
- expressions [reported by Sam Brauer]
-
- - fixed a minor bug related to the xhtml output method
-
-
-
-Version 0.52
-
-March 29, 2001
-
---------------
-
-
-
- - added support for encoding conversions using iconv
-
- - all memory leaks occuring on processing errors are fixed
-
- [thanks for project support to Mitel Networks Corporation]
-
- - fixed the "duplicit attribute error" bug [Marc Lehmann]
-
- - fixed a bug in context evaluation [reported by Marco Guazzone]
-
- - fixed several bugs related to the hash table [Tom Moog]
-
-
-
-Version 0.51
-
-------------
-
- - a maintenance release
-
- - fixed the quoting of quotes in HTML output [patch by Mark Bartel].
-
- - fixes by Tim Crook for AIX
-
- - Sablot runs even without wcsxfrm() or wchar.h (although
-
- it doesn't sort)
-
- - the problem with the type of an iconv() call argument is fixed
-
- - added support for the xhtml output method [Marc Lehmann]
-
- - fixed bug causing elements being output as <:x> [Andreas Buschmann]
-
- - xsl:sort works if wcsxfrm() is not present (sorts naively though)
-
-
-
-Version 0.50
-
-------------
-
- - added match predicate optimization
-
- - added proper character class handling [patch by Marc Lehmann]
-
- - fixed a bug in last() [reported by Dirk Siebnich]
-
- - fixed a problem with empty NS decls [reported by S. Tryggvason]
-
- - added SablotSetEncoding().
-
- - fixed an error with xml:lang [reported by Nicolas Sauret]
-
- - fixed the 'divide by zero' MSVC warning [suggestion by Dirk Siebnich]
-
- - added support for xsl:sort
-
- - fixed an expression parsing error [report by Clayton Cottingham]
-
- - fixed a bug in current() [report by Daniel Hammond]
-
- - minor fix for RedHat 7 [David Hedbor]
-
- - fixed another bug in translate()
-
- - fixed a bug related to starts-with() [reported by Myoungki Kim]
-
- - fixed top-level elements check
-
-
-
-Version 0.44
-
-------------
-
- - Fixed an elusive bug in HashTable causing occassional crashes
-
- - Added the namespace-alias() and message() functions
-
- [patch by Major]
-
- - More fixes related to: XML namespace declarations, nested
-
- stylesheet inclusion, Byte Order Mark in UTF-8 doc,
-
- "SYSTEM" in DOCTYPE declaration, the preceding-sibling and
-
- following-sibling axes, iconv.
-
- - Patch for OpenBSD [Anil Madhavapeddy].
-
-
-
-Version 0.43
-
-------------
-
- - Fundamental changes to improve performance.
-
- - Added Latin2 input support [thanks to Matt Sergeant]
-
- - Added Japanese encodings support [patch by Rui Hirokawa]
-
- - Fixed treatment of NaNs etc. [based on patch by Robin Houston]
-
- - Minor bug fixes.
-
- - Added platform.cpp for platform-dependent code.
-
- - Added code to generate the <META> tag when using the
-
- html output method.
-
-
-
-Version 0.42
-
-------------
-
- - Sablotron is now thread-safe [thanks to Leo Yu].
-
- - Output recoding can be done if iconv is present [Sven Neumann].
-
- - Match predicates work.
-
- - Several bug fixes [Robin Houston].
-
- - Added:
-
- MiscHandler with documentInfo()
-
- SablotSetBaseForScheme()
-
- the current() function [Robin]
-
- -The actual error code is returned from SablotProcess etc.
-
-
-
-Version 0.41
-
-------------
-
- - Sablotron now uses autoconf and works with an unmodified
-
- copy of expat. Its layout is a bit different.
-
- - Bug fix (reported by Kay Sievers).
-
-
-
-Version 0.4
-
------------
-
- - The license was changed to MPL+GPL.
-
- - Output conformance improved considerably (proper escaping
-
- etc.).
-
- - A SAX interface to the result document is available so one
-
- can bypass the construction to the result tree.
-
- - Some changes to the Sablotron interface.
-
- - Implemented <xsl:output>, <xsl:comment>,
-
- <xsl:processing-instruction>.
-
- - External general entities work now.
-
- - Bug fixes (thanks for reports and/or patches to Hans Raaf,
-
- Florian Hars, <robin@kitsite.com>, Mark W. Eichin and
-
- Robin Berjon).
-
- - Performance improvements.
-
-
-
-Version 0.36
-
-------------
-
- - optimized string handling, resulting in a significant
-
- performance improvement
-
- - implemented <xsl:copy>
-
-
-
-Version 0.35
-
-------------
-
- - fixed a bug concerning the descendant axis, reported by Les
-
- Woolsey
-
- - included the Solaris port (patch contributed by Steven Rowe)
-
- - added SablotSetLog() for setting the log file. Turned
-
- logging off by default.
-
- - added SablotRegMessageHandler() for setting a message
-
- handler. Using this, you can handle all error/warning/log
-
- messages the way you like.
-
- - if the xsl prefix is bound to an obsolete URI, a warning is
-
- issued
-
- - added SablotProcessStringsWithBase() which makes it possible
-
- to override the stylesheet's physical URI with a 'hard base
-
- URI'
-
- - added some command-line switches to sabcmd, e.g. --log-file
-
- and --measure
-
-
-
-Version 0.34
-
-------------
-
- - bug fixes
-
- - major memory leak fixes
-
-
-
-Version 0.33
-
-------------
-
-CVS: tag SABLOT_0_33 (tom, main trunk)
-
- - this release log started
-
- - first major release following Sablotron 0.3
-
- - added URI processing with relative URI resolution
-
- - added support for the arg: scheme (named buffers)
-
- - added support for passing global parameters
-
- - introduced the SablotProcess() function as a general interface
-
- - sabcmd can pass named buffers as well as the global params
-
- - added a lot of core library functions
-
diff --git a/win32/sablot/bin/sabcmd.exe b/win32/sablot/bin/sabcmd.exe
deleted file mode 100644
index 4b209e7..0000000
--- a/win32/sablot/bin/sabcmd.exe
+++ /dev/null
Binary files differ
diff --git a/win32/sablot/bin/sablot.dll b/win32/sablot/bin/sablot.dll
deleted file mode 100644
index ee093c5..0000000
--- a/win32/sablot/bin/sablot.dll
+++ /dev/null
Binary files differ
diff --git a/win32/sablot/include/sabdbg.h b/win32/sablot/include/sabdbg.h
deleted file mode 100644
index 3c97944..0000000
--- a/win32/sablot/include/sabdbg.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
-
- * The contents of this file are subject to the Mozilla Public
-
- * License Version 1.1 (the "License"); you may not use this file
-
- * except in compliance with the License. You may obtain a copy of
-
- * the License at http://www.mozilla.org/MPL/
-
- *
-
- * Software distributed under the License is distributed on an "AS
-
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-
- * implied. See the License for the specific language governing
-
- * rights and limitations under the License.
-
- *
-
- * The Original Code is the Sablotron XSLT Processor.
-
- *
-
- * The Initial Developer of the Original Code is Ginger Alliance Ltd.
-
- * Portions created by Ginger Alliance are Copyright (C) 2000-2002
-
- * Ginger Alliance Ltd. All Rights Reserved.
-
- *
-
- * Contributor(s):
-
- *
-
- * Alternatively, the contents of this file may be used under the
-
- * terms of the GNU General Public License Version 2 or later (the
-
- * "GPL"), in which case the provisions of the GPL are applicable
-
- * instead of those above. If you wish to allow use of your
-
- * version of this file only under the terms of the GPL and not to
-
- * allow others to use your version of this file under the MPL,
-
- * indicate your decision by deleting the provisions above and
-
- * replace them with the notice and other provisions required by
-
- * the GPL. If you do not delete the provisions above, a recipient
-
- * may use your version of this file under either the MPL or the
-
- * GPL.
-
- */
-
-
-
-#ifndef SabdbgHIncl
-
-#define SabdbgHIncl
-
-
-
-#define SablotAsExport
-
-#include <sablot.h>
-
-
-
-/************************************************************/
-
-/* DEBUGGER stuff */
-
-/************************************************************/
-
-
-
-Declare
-
-(
-
- void debuggerInit();
-
-)
-
-
-
-Declare
-
-(
-
- void debuggerDone();
-
-)
-
-
-
-Declare
-
-(
-
- void debuggerEnterIdle();
-
-)
-
-
-
-#endif
-
diff --git a/win32/sablot/include/sablot.h b/win32/sablot/include/sablot.h
deleted file mode 100644
index 0d63579..0000000
--- a/win32/sablot/include/sablot.h
+++ /dev/null
@@ -1,1134 +0,0 @@
-/*
-
- * The contents of this file are subject to the Mozilla Public
-
- * License Version 1.1 (the "License"); you may not use this file
-
- * except in compliance with the License. You may obtain a copy of
-
- * the License at http://www.mozilla.org/MPL/
-
- *
-
- * Software distributed under the License is distributed on an "AS
-
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-
- * implied. See the License for the specific language governing
-
- * rights and limitations under the License.
-
- *
-
- * The Original Code is the Sablotron XSLT Processor.
-
- *
-
- * The Initial Developer of the Original Code is Ginger Alliance Ltd.
-
- * Portions created by Ginger Alliance are Copyright (C) 2000-2003
-
- * Ginger Alliance Ltd. All Rights Reserved.
-
- *
-
- * Contributor(s):
-
- *
-
- * Alternatively, the contents of this file may be used under the
-
- * terms of the GNU General Public License Version 2 or later (the
-
- * "GPL"), in which case the provisions of the GPL are applicable
-
- * instead of those above. If you wish to allow use of your
-
- * version of this file only under the terms of the GPL and not to
-
- * allow others to use your version of this file under the MPL,
-
- * indicate your decision by deleting the provisions above and
-
- * replace them with the notice and other provisions required by
-
- * the GPL. If you do not delete the provisions above, a recipient
-
- * may use your version of this file under either the MPL or the
-
- * GPL.
-
- */
-
-
-
-/*
-
-sablot.h
-
-TK Dec 14, 99
-
-header file for Sablot.cpp
-
-*/
-
-
-
-#ifndef SablotHIncl
-
-#define SablotHIncl
-
-
-
-
-
-/* version info */
-
-#define SAB_VERSION "1.0.1"
-
-#define SAB_DATE "November 24, 2003"
-
-
-
-/* common types */
-
-typedef void *SablotHandle;
-
-typedef void *SDOM_Document;
-
-typedef void *SablotSituation;
-
-
-
-#if defined(WIN32) && defined(_MSC_VER) && !defined(SABLOT_STATIC)
-
-#if defined(SablotAsExport)
-
-#define DllImpExp __declspec( dllexport )
-
-#else
-
-#define DllImpExp __declspec( dllimport )
-
-#endif /* SablotAsExport */
-
-#else /* WIN32 && _MSC_VER */
-
-#define DllImpExp extern
-
-#endif
-
-
-
-#ifdef __cplusplus
-
-#define DeclBegin extern "C" { DllImpExp
-
-#define DeclEnd }
-
-#else
-
-#define DeclBegin DllImpExp
-
-#define DeclEnd
-
-#endif
-
-
-
-#define Declare(STATEMENT) DeclBegin STATEMENT DeclEnd
-
-
-
-#include "shandler.h"
-
-#include "sxpath.h"
-
-
-
-typedef enum
-
-{
-
- SAB_NO_ERROR_REPORTING = 0x1,
-
- SAB_PARSE_PUBLIC_ENTITIES = 0x2,
-
- SAB_DISABLE_ADDING_META = 0x4,
-
- SAB_DISABLE_STRIPPING = 0x8,
-
- SAB_IGNORE_DOC_NOT_FOUND = 0x10,
-
- SAB_FILES_TO_HANDLER = 0x20,
-
- SAB_DUMP_SHEET_STRUCTURE = 0x40,
-
- SAB_NO_EXTERNAL_ENTITIES = 0x80
-
-} SablotFlag;
-
-
-
-/* create a new document */
-
-
-
-Declare
-
-(
-
- int SablotCreateDocument(
-
- SablotSituation S,
-
- SDOM_Document *D);
-
-)
-
-
-
-/* parse in a document from the given URI */
-
-
-
-Declare
-
-(
-
- int SablotParse(
-
- SablotSituation S,
-
- const char *uri,
-
- SDOM_Document *D);
-
-)
-
-
-
-/* parse a document given in an in-memory buffer */
-
-
-
-Declare
-
-(
-
- int SablotParseBuffer(
-
- SablotSituation S,
-
- const char *buffer,
-
- SDOM_Document *D);
-
-)
-
-
-
-Declare
-
-(
-
- int SablotParseStylesheet(
-
- SablotSituation S,
-
- const char *uri,
-
- SDOM_Document *D);
-
-)
-
-
-
-
-
-Declare
-
-(
-
- int SablotParseStylesheetBuffer(
-
- SablotSituation S,
-
- const char *buffer,
-
- SDOM_Document *D);
-
-)
-
-
-
-
-
-/* lock document before using it */
-
-
-
-Declare
-
-(
-
- int SablotLockDocument(
-
- SablotSituation S,
-
- SDOM_Document D);
-
-)
-
-
-
-Declare
-
-(
-
- int SablotDestroyDocument(
-
- SablotSituation S,
-
- SDOM_Document D);
-
-)
-
-
-
-Declare
-
-(
-
- int SablotAddParam(
-
- SablotSituation S,
-
- void *processor_,
-
- const char *paramName,
-
- const char *paramValue);
-
-)
-
-
-
-Declare
-
-(
-
- int SablotAddArgBuffer(
-
- SablotSituation S,
-
- void *processor_,
-
- const char *argName,
-
- const char *bufferValue);
-
-)
-
-
-
-Declare(
-
- int SablotAddArgTree(
-
- SablotSituation S,
-
- void *processor_,
-
- const char *argName,
-
- SDOM_Document tree);
-
-)
-
-
-
-Declare
-
-(
-
- int SablotRunProcessorGen(
-
- SablotSituation S,
-
- void *processor_,
-
- const char *sheetURI,
-
- const char *inputURI,
-
- const char *resultURI);
-
-)
-
-
-
-Declare
-
-(
-
- int SablotRunProcessorExt(
-
- SablotSituation S,
-
- void *processor_,
-
- const char *sheetURI,
-
- const char *resultURI,
-
- NodeHandle doc);
-
-)
-
-
-
-/*
-
- * Situation functions
-
- */
-
-
-
-/* Creates a new situation. */
-
-
-
-Declare
-
-(
-
- int SablotCreateSituation(SablotSituation *sPtr);
-
-)
-
-
-
-/* Sets situation flags. */
-
-
-
-Declare
-
-(
-
- int SablotSetOptions(SablotSituation S, int flags);
-
-)
-
-
-
-Declare
-
-(
-
- int SablotGetOptions(SablotSituation S);
-
-)
-
-
-
-Declare
-
-(
-
- int SablotClearSituation(SablotSituation S);
-
-)
-
-
-
-Declare
-
-(
-
- const char* SablotGetErrorURI(SablotSituation S);
-
-)
-
-
-
-Declare
-
-(
-
- int SablotGetErrorLine(SablotSituation S);
-
-)
-
-
-
-Declare
-
-(
-
- const char* SablotGetErrorMsg(SablotSituation S);
-
-)
-
-
-
-/* Disposes of the situation. */
-
-
-
-Declare
-
-(
-
- int SablotDestroySituation(SablotSituation S);
-
-)
-
-
-
-
-
-/*****************************************************************
-
-SablotCreateProcessor
-
-creates a new instance of the processor
-
-*****************************************************************/
-
-
-
-Declare
-
-(
-
- int SablotCreateProcessor(SablotHandle *processorPtr);
-
-)
-
-
-
-/*****************************************************************
-
-SablotCreateProcessorForSituation
-
-use this instead of SablotCreateProcessor with any of the
-
-situation-aware functions like SablotRunProcessorGen,
-
-SablotAddArgTree etc.
-
-*****************************************************************/
-
-
-
-Declare
-
-(
-
- int SablotCreateProcessorForSituation(SablotSituation S, void **processorPtr);
-
-)
-
-
-
-
-
-/*****************************************************************
-
-SablotDestroyProcessor
-
-destroys the processor
-
-*****************************************************************/
-
-
-
-Declare
-
-(
-
- int SablotDestroyProcessor(SablotHandle processor_);
-
-)
-
-
-
-/*****************************************************************
-
-SablotRunProcessor
-
-runs the existing instance on the given documents
-
-*****************************************************************/
-
-
-
-Declare
-
-(
-
- int SablotRunProcessor(SablotHandle processor_,
-
- const char *sheetURI,
-
- const char *inputURI,
-
- const char *resultURI,
-
- const char **params,
-
- const char **arguments);
-
-)
-
-
-
-/*****************************************************************
-
-SablotGetResultArg
-
-gets the result arg buffer from the last Sablot run
-
-the buffer is identified by an URI (to enable output to
-
- multiple documents)
-
-*****************************************************************/
-
-
-
-Declare
-
-(
-
- int SablotGetResultArg(SablotHandle processor_,
-
- const char *argURI,
-
- char **argValue);
-
-)
-
-
-
-/*****************************************************************
-
-SablotFreeResultArgs
-
-kill all result arg buffers from the last Sablot run
-
-*****************************************************************/
-
-
-
-Declare
-
-(
-
- int SablotFreeResultArgs(SablotHandle processor_);
-
-)
-
-
-
-/*****************************************************************
-
-SablotRegHandler
-
-General handler registrator.
-
- type the type of the handler (scheme etc.)
-
- handler pointer to the struct of callbacks of the given type
-
- userData the user data this handler wishes to receive
-
-*****************************************************************/
-
-
-
-Declare
-
-(
-
- int SablotRegHandler(
-
- SablotHandle processor_,
-
- HandlerType type, /* HLR_MESSAGE, HLR_SCHEME, HLR_SAX */
-
- void *handler,
-
- void *userData);
-
-)
-
-
-
-/*****************************************************************
-
-SablotUnregHandler
-
-
-
- General handler unregistrator.
-
-*****************************************************************/
-
-
-
-Declare
-
-(
-
- int SablotUnregHandler(
-
- SablotHandle processor_,
-
- HandlerType type, /* HLR_MESSAGE, HLR_SCHEME, HLR_SAX */
-
- void *handler,
-
- void *userData);
-
-)
-
-
-
-/*****************************************************************
-
-SablotSetBase
-
-
-
- overrides the default base URI for relative reference
-
- resolution.
-
-*****************************************************************/
-
-
-
-Declare
-
-(
-
- int SablotSetBase(
-
- SablotHandle processor_,
-
- const char *theBase);
-
-)
-
-
-
-/*****************************************************************
-
-SablotSetBaseForScheme
-
-
-
- a softer form of SablotSetBase: the hard base URI will only
-
- be in effect for relative references whose bases have
-
- the given scheme.
-
-
-
- Example: assume we call
-
- SablotSetBaseForScheme( P, "arg", "http://server" )
-
- and then runs a stylesheet at "arg:/xxx" which contains "document('foo.xml')".
-
- The relative reference is resolved as "http://server/foo.xml"
-
- but if the stylesheet were at "file:/xxx" it would become "file:/foo.xml".
-
-*****************************************************************/
-
-
-
-Declare
-
-(
-
- int SablotSetBaseForScheme(void* processor_,
-
- const char *scheme,
-
- const char *base);
-
-)
-
-
-
-/****************************************************************
-
-SablotSetLog
-
-
-
- sets the logging options. Logging is off by default.
-
-*****************************************************************/
-
-
-
-Declare
-
-(
-
- int SablotSetLog(
-
- SablotHandle processor_,
-
- const char *logFilename,
-
- int logLevel);
-
-)
-
-
-
-
-
-/*****************************************************************
-
-SablotProcess
-
-
-
- the main function published by Sablotron. Feeds given XML
-
- input to a stylesheet. Both of these as well as the location for
-
- output are identified by a URI. One can also pass top-level
-
- stylesheet parameters and named buffers ('args').
-
-ARGS
-
- sheetURI URI of the XSLT stylesheet
-
- inputURI URI of the XML document
-
- resultURI URI of the output document
-
- params a NULL-terminated array of char*'s defining the top-level
-
- parameters to be passed, interpreted as a
-
- sequence of (name, value) pairs.
-
- arguments a NULL-terminated array of char*'s defining the named
-
- buffers to be passed, interpreted as a
-
- sequence of (name, value) pairs. Both params and arguments
-
- may be NULL.
-
-RETURNS
-
- . nonzero iff error
-
- resultArg in case output goes to a named buffer, *resultArg is set to
-
- point to it (otherwise to NULL). Free it using SablotFree().
-
-*****************************************************************/
-
-
-
-Declare
-
-(
-
- int SablotProcess(
-
- const char *sheetURI, const char *inputURI, const char *resultURI,
-
- const char **params, const char **arguments, char **resultArg);
-
-)
-
-
-
-/*****************************************************************
-
-SablotProcessFiles
-
-
-
- calls SablotProcess to process files identified by their
-
- file names. No named buffers or params are passed. Included
-
- for backward compatibility.
-
-ARGUMENTS
-
- styleSheetName, inputName, resultName
-
- file names of the stylesheet, XML input and output,
-
- respectively.
-
-RETURNS
-
- . error flag
-
-*****************************************************************/
-
-
-
-Declare
-
-(
-
- int SablotProcessFiles(
-
- const char *styleSheetName,
-
- const char *inputName,
-
- const char *resultName);
-
-)
-
-
-
-/*****************************************************************
-
-SablotProcessStrings
-
-
-
- calls SablotProcess to process documents in memory, passing
-
- pointers to the documents. No named buffers or params are passed.
-
- Included for backward compatibility.
-
-ARGUMENTS
-
- styleSheetStr, inputStr
-
- text of the stylesheet and the XML input
-
-RETURNS
-
- . error flag
-
- *resultStr pointer to the newly allocated block containing
-
- the result
-
-*****************************************************************/
-
-
-
-Declare
-
-(
-
- int SablotProcessStrings(
-
- const char *styleSheetStr,
-
- const char *inputStr,
-
- char **resultStr);
-
-)
-
-
-
-/*****************************************************************
-
-SablotProcessStringsWithBase
-
-
-
- Like SablotProcessStrings but lets you pass an URI that replaces
-
- the stylesheet's URI in relative address resolution.
-
-
-
-ARGUMENTS
-
- styleSheetStr, inputStr
-
- text of the stylesheet and the XML input
-
- theHardBase the "hard base URI" replacing the stylesheet's URI
-
- in all relevant situations
-
-RETURNS
-
- . error flag
-
- *resultStr pointer to the newly allocated block containing
-
- the result
-
-*****************************************************************/
-
-
-
-Declare
-
-(
-
- int SablotProcessStringsWithBase(
-
- const char *styleSheetStr,
-
- const char *inputStr,
-
- char **resultStr,
-
- const char *theHardBase);
-
-)
-
-
-
-/*****************************************************************
-
-SablotFree
-
-
-
- Frees the Sablotron-allocated buffer. The user cannot free it
-
- directly by free().
-
-*****************************************************************/
-
-
-
-Declare
-
-(
-
- int SablotFree(char *resultStr);
-
-)
-
-
-
-/*****************************************************************
-
-SablotClearError
-
-
-
- Clears the pending error for the given instance of Sablot.
-
-*****************************************************************/
-
-
-
-Declare
-
-(
-
- int SablotClearError(SablotHandle processor_);
-
-)
-
-
-
-/*****************************************************************
-
-SablotGetMsgText
-
-
-
- Returns the text of a message with the given code.
-
-*****************************************************************/
-
-
-
-Declare
-
-(
-
- const char* SablotGetMsgText(int code);
-
-)
-
-
-
-/*****************************************************************
-
-SablotSetInstanceData
-
-*****************************************************************/
-
-
-
-Declare
-
-(
-
- void SablotSetInstanceData(SablotHandle processor_, void *idata);
-
-)
-
-
-
-/*****************************************************************
-
-SablotGetInstanceData
-
-*****************************************************************/
-
-
-
-Declare
-
-(
-
- void* SablotGetInstanceData(SablotHandle processor_);
-
-)
-
-
-
-/*
-
- SablotSetEncoding
-
- sets the output encoding to be used regardless of the encoding
-
- specified by the stylesheet
-
- To unset, call with encoding_ NULL.
-
-*/
-
-
-
-Declare
-
-(
-
- void SablotSetEncoding(SablotHandle processor_, char *encoding_);
-
-)
-
-
-
-#endif
-
diff --git a/win32/sablot/include/sdom.h b/win32/sablot/include/sdom.h
deleted file mode 100644
index 476f32a..0000000
--- a/win32/sablot/include/sdom.h
+++ /dev/null
@@ -1,1878 +0,0 @@
-/*
-
- * The contents of this file are subject to the Mozilla Public
-
- * License Version 1.1 (the "License"); you may not use this file
-
- * except in compliance with the License. You may obtain a copy of
-
- * the License at http://www.mozilla.org/MPL/
-
- *
-
- * Software distributed under the License is distributed on an "AS
-
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-
- * implied. See the License for the specific language governing
-
- * rights and limitations under the License.
-
- *
-
- * The Original Code is the Sablotron XSLT Processor.
-
- *
-
- * The Initial Developer of the Original Code is Ginger Alliance Ltd.
-
- * Portions created by Ginger Alliance are Copyright (C) 2000-2002
-
- * Ginger Alliance Ltd. All Rights Reserved.
-
- *
-
- * Contributor(s):
-
- *
-
- * Alternatively, the contents of this file may be used under the
-
- * terms of the GNU General Public License Version 2 or later (the
-
- * "GPL"), in which case the provisions of the GPL are applicable
-
- * instead of those above. If you wish to allow use of your
-
- * version of this file only under the terms of the GPL and not to
-
- * allow others to use your version of this file under the MPL,
-
- * indicate your decision by deleting the provisions above and
-
- * replace them with the notice and other provisions required by
-
- * the GPL. If you do not delete the provisions above, a recipient
-
- * may use your version of this file under either the MPL or the
-
- * GPL.
-
- */
-
-
-
-/* sdom.h */
-
-
-
-#ifndef SDomHIncl
-
-#define SDomHIncl
-
-
-
-//used for DISABLE_DOM only anything else is DANGEROUS
-
-#ifdef HAVE_CONFIG_H
-
-#include <config.h>
-
-#endif
-
-
-
-#ifndef DISABLE_DOM
-
-
-
-#include "sablot.h"
-
-
-
-/**
-
- **
-
- ** types
-
- **
-
- **/
-
-
-
-typedef void* SDOM_Node;
-
-typedef void* SDOM_NodeList;
-
-/* typedef void* SDOM_Document; */
-
-
-
-typedef enum
-
-{
-
- SDOM_ELEMENT_NODE = 1,
-
- SDOM_ATTRIBUTE_NODE = 2,
-
- SDOM_TEXT_NODE = 3,
-
- SDOM_CDATA_SECTION_NODE = 4,
-
- SDOM_ENTITY_REFERENCE_NODE = 5,
-
- SDOM_ENTITY_NODE = 6,
-
- SDOM_PROCESSING_INSTRUCTION_NODE = 7,
-
- SDOM_COMMENT_NODE = 8,
-
- SDOM_DOCUMENT_NODE = 9,
-
- SDOM_DOCUMENT_TYPE_NODE = 10,
-
- SDOM_DOCUMENT_FRAGMENT_NODE = 11,
-
- SDOM_NOTATION_NODE = 12,
-
- SDOM_OTHER_NODE /* not in spec */
-
-}
-
-SDOM_NodeType;
-
-
-
-/*
-
- * we define DOM_char as char, although the spec says strings should be
-
- * UTF_16. Needs check.
-
- */
-
-typedef char SDOM_char;
-
-
-
-
-
-/*
-
- * DomException
-
- * will be an enum of all the values given in the spec.
-
- */
-
-
-
-/*
-
- INDEX_SIZE_ERR, 1
-
- STRING_SIZE_ERR, 2
-
- HIERARCHY_REQUEST_ERR, 3
-
- WRONG_DOCUMENT_ERR, 4
-
- INVALID_CHARACTER_ERR, 5
-
- NO_DATA_ALLOWED_ERR, 6
-
- NO_MODIFICATION_ALLOWED_ERR, 7
-
- NOT_FOUND_ERR, 8
-
- NOT_SUPPORTED_ERR, 9
-
- INUSE_ATTRIBUTE_ERR, 10
-
- INVALID_STATE_ERR, 11
-
- SYNTAX_ERR, 12
-
- INVALID_MODIFICATION_ERR, 13
-
- NAMESPACE_ERR, 14
-
- INVALID_ACCESS_ERR, 15
-
-*/
-
-
-
-typedef enum
-
-{
-
- SDOM_OK,
-
- SDOM_INDEX_SIZE_ERR = 1,
-
- SDOM_DOMSTRING_SIZE_ERR = 2,
-
- SDOM_HIERARCHY_REQUEST_ERR = 3,
-
- SDOM_WRONG_DOCUMENT_ERR = 4,
-
- SDOM_INVALID_CHARACTER_ERR = 5,
-
- SDOM_NO_DATA_ALLOWED_ERR = 6,
-
- SDOM_NO_MODIFICATION_ALLOWED_ERR = 7,
-
- SDOM_NOT_FOUND_ERR = 8,
-
- SDOM_NOT_SUPPORTED_ERR = 9,
-
- SDOM_INUSE_ATTRIBUTE_ERR = 10,
-
- SDOM_INVALID_STATE_ERR = 11,
-
- SDOM_SYNTAX_ERR = 12,
-
- SDOM_INVALID_MODIFICATION_ERR = 13,
-
- SDOM_NAMESPACE_ERR = 14,
-
- SDOM_INVALID_ACCESS_ERR = 15,
-
- /* not in spec below this point: */
-
- SDOM_INVALID_NODE_TYPE, /* eg passing a non-element for an element */
-
- SDOM_QUERY_PARSE_ERR,
-
- SDOM_QUERY_EXECUTION_ERR,
-
- SDOM_NOT_OK
-
-} SDOM_Exception;
-
-
-
-/**
-
- **
-
- ** Node
-
- ** n is always the node the function is to operate on (kind of 'this')
-
- **
-
- **/
-
-
-
-/*
-
- createElement
-
- Creates a new element Node with NULL parent and specified owner,
-
- and returns it in *pn.
-
- Raises:
-
- */
-
-Declare(
-
-SDOM_Exception SDOM_createElement(
-
- SablotSituation s,
-
- SDOM_Document d,
-
- SDOM_Node *pn,
-
- const SDOM_char *tagName);
-
-)
-
-
-
-//_JP_ v
-
-/*
-
- createElementNS
-
- Creates a new element Node with NULL parent and specified owner,
-
- and returns it in *pn.
-
- Raises:
-
- SDOM_NAMESPACE_ERR or SDOM_INVALID_CHARACTER_ERR when qName or uri malformed
-
- */
-
-Declare(
-
-SDOM_Exception SDOM_createElementNS(
-
- SablotSituation s,
-
- SDOM_Document d,
-
- SDOM_Node *pn,
-
- const SDOM_char *uri,
-
- const SDOM_char *qName);
-
-)
-
-//_JP_ ^
-
-
-
-/*
-
- createAttribute
-
- Creates a new attribute Node and returns it in *pn.
-
- Raises:
-
- */
-
-
-
-Declare
-
-(
-
-SDOM_Exception SDOM_createAttribute(
-
- SablotSituation s,
-
- SDOM_Document d,
-
- SDOM_Node *pn,
-
- const SDOM_char *name);
-
-)
-
-
-
-//_JP_ v
-
-/*
-
- createAttributeNS
-
- Creates a new attribute Node and returns it in *pn.
-
- Raises:
-
- SDOM_NAMESPACE_ERR or SDOM_INVALID_CHARACTER_ERR when qName or uri malformed
-
- */
-
-Declare(
-
-SDOM_Exception SDOM_createAttributeNS(
-
- SablotSituation s,
-
- SDOM_Document d,
-
- SDOM_Node *pn,
-
- const SDOM_char *uri,
-
- const SDOM_char *qName);
-
-)
-
-//_JP_ ^
-
-
-
-
-
-/*
-
- createTextNode
-
- Raises:
-
- */
-
-
-
-Declare
-
-(
-
-SDOM_Exception SDOM_createTextNode(
-
- SablotSituation s,
-
- SDOM_Document d,
-
- SDOM_Node *pn,
-
- const SDOM_char *data);
-
-)
-
-
-
-/*
-
- createAttribute
-
- Creates a new attribute Node and returns it in *pn.
-
- Raises:
-
- */
-
-
-
-Declare
-
-(
-
-SDOM_Exception SDOM_createCDATASection(
-
- SablotSituation s,
-
- SDOM_Document d,
-
- SDOM_Node *pn,
-
- const SDOM_char *data);
-
-)
-
-
-
-/*
-
- createComment
-
- Raises:
-
- */
-
-
-
-Declare
-
-(
-
-SDOM_Exception SDOM_createComment(
-
- SablotSituation s,
-
- SDOM_Document d,
-
- SDOM_Node *pn,
-
- const SDOM_char *data);
-
-)
-
-
-
-/*
-
- createProcessingInstruction
-
- Raises:
-
- */
-
-
-
-Declare
-
-(
-
-SDOM_Exception SDOM_createProcessingInstruction(
-
- SablotSituation s,
-
- SDOM_Document d,
-
- SDOM_Node *pn,
-
- const SDOM_char *target,
-
- const SDOM_char *data);
-
-)
-
-
-
-/*
-
- disposeNode
-
- Frees all memory used by the node.
-
- Raises:
-
- !SPEC: Not in the spec.
-
- */
-
-
-
-Declare
-
-(
-
-SDOM_Exception SDOM_disposeNode(
-
- SablotSituation s,
-
- SDOM_Node n);
-
-)
-
-
-
-
-
-/*
-
- getNodeType
-
- Returns the node type in *pType.
-
- Raises:
-
- */
-
-
-
-Declare
-
-(
-
-SDOM_Exception SDOM_getNodeType(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_NodeType *pType);
-
-)
-
-
-
-
-
-/*
-
- getNodeName
-
- Returns the pointer to the name of the node in *pName.
-
-*/
-
-
-
-Declare
-
-(
-
-SDOM_Exception SDOM_getNodeName(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_char **pName);
-
-)
-
-
-
-Declare
-
-(
-
-SDOM_Exception SDOM_getNodeNSUri(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_char **pName);
-
-)
-
-
-
-Declare
-
-(
-
-SDOM_Exception SDOM_getNodePrefix(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_char **pName);
-
-)
-
-
-
-Declare
-
-(
-
-SDOM_Exception SDOM_getNodeLocalName(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_char **pName);
-
-)
-
-
-
-/*
-
- setNodeName
-
- Sets the node name.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_setNodeName(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- const SDOM_char *name);
-
-)
-
-
-
-/*
-
- getNodeValue
-
- Returns in *pValue the string value of the node.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_getNodeValue(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_char **pValue);
-
-)
-
-
-
-/*
-
- setNodeValue
-
- Sets the node value.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_setNodeValue(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- const SDOM_char *value);
-
-)
-
-
-
-/*
-
- getParentNode
-
- Returns the parent in *pParent.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_getParentNode(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_Node *pParent);
-
-)
-
-
-
-/*
-
- getFirstChild
-
- Returns the first child in *pFirstChild.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_getFirstChild(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_Node *pFirstChild);
-
-)
-
-
-
-/*
-
- getLastChild
-
- Returns the last child in *pLastChild.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_getLastChild(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_Node *pLastChild);
-
-)
-
-
-
-/*
-
- getPreviousSibling
-
- Returns the previous sibling in *pPreviousSibling.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_getPreviousSibling(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_Node *pPreviousSibling);
-
-)
-
-
-
-/*
-
- getNextSibling
-
- Returns the next sibling in *pNextSibling.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_getNextSibling(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_Node *pNextSibling);
-
-)
-
-
-
-/*
-
- getChildNode
-
- Returns the child node in specified index or NULL.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_getChildNodeIndex(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- int index,
-
- SDOM_Node *pChildNode);
-
-)
-
-
-
-/*
-
- getChildNodeCount
-
- Returns the count of child nodes.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_getChildNodeCount(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- int *count);
-
-)
-
-
-
-/*
-
- getOwnerDocument
-
- Returns, in *pOwnerDocument, the Document owning the node.
-
- !SPEC: If the node is standalone, returns NULL.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_getOwnerDocument(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_Document *pOwnerDocument);
-
-)
-
-
-
-/*
-
- insertBefore
-
- Inserts newChild as n's child, just before refChild.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_insertBefore(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_Node newChild,
-
- SDOM_Node refChild);
-
-)
-
-
-
-/*
-
- removeChild
-
- Removes oldChild (a child of n) without deallocating it.
-
-*/
-
-
-
-Declare(
-
-SDOM_Exception SDOM_removeChild(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_Node oldChild);
-
-)
-
-
-
-/*
-
- replaceChild
-
- Replaces oldChild (a child of n) by newChild.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_replaceChild(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_Node newChild,
-
- SDOM_Node oldChild);
-
-)
-
-
-
-/*
-
- appendChild
-
- Appends newChild as the last of n's children.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_appendChild(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_Node newChild);
-
-)
-
-
-
-/*
-
- cloneNode
-
- Duplicates the node, returning the result in *clone.
-
- If deep is nonzero, the cloning process will be recursive.
-
-*/
-
-
-
-Declare(
-
-SDOM_Exception SDOM_cloneNode(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- int deep,
-
- SDOM_Node *clone);
-
-)
-
-
-
-/*
-
- cloneForeignNode
-
- Duplicates a node from a different doc, returning the result in *clone.
-
- If deep is nonzero, the cloning process will be recursive.
-
- As opposed to cloneNode, represents a Document method
-
-*/
-
-
-
-Declare(
-
-SDOM_Exception SDOM_cloneForeignNode(
-
- SablotSituation s,
-
- SDOM_Document d,
-
- SDOM_Node n,
-
- int deep,
-
- SDOM_Node *clone);
-
-)
-
-
-
-/*
-
- getAttribute
-
- Returns, in *pValue, the contents of the attribute (of n) named 'name'.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_getAttribute(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- const SDOM_char *name,
-
- SDOM_char **pValue);
-
-)
-
-
-
-/*
-
- getAttributeNS
-
- Returns, in *pValue, the contents of the attribute (of n) with 'uri' and 'local'.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_getAttributeNS(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_char *uri,
-
- SDOM_char *local,
-
- SDOM_char **pValue);
-
-)
-
-
-
-/*
-
- getAttributeNode
-
- Returns, in *attr, the attribute named 'name'.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_getAttributeNode(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- const SDOM_char *name,
-
- SDOM_Node *attr);
-
-)
-
-
-
-/*
-
- getAttributeNodeNS
-
- Returns, in *attr, the n's attribute with uri and local.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_getAttributeNodeNS(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_char *uri,
-
- SDOM_char *local,
-
- SDOM_Node *attr);
-
-)
-
-
-
-//_JP_ v
-
-/*
-
- getAttributeNodeIndex
-
- Returns, in *attr, the index'th attribute, namespaces precede other atts.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_getAttributeNodeIndex(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- const int index,
-
- SDOM_Node *attr);
-
-)
-
-
-
-/*
-
- getAttributeNodeCount
-
- Returns, in *count, the count of atts, including namespaces in scope.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_getAttributeNodeCount(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- int *count);
-
-)
-
-//_JP_ ^
-
-
-
-/*
-
- setAttribute
-
- Assigns the given value to n's attribute named 'name'.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_setAttribute(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- const SDOM_char *name,
-
- const SDOM_char *value);
-
-)
-
-
-
-/*
-
- setAttributeNS
-
- Assigns the given value to n's attribute with 'uri' and qualified name 'qName'.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_setAttributeNS(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- const SDOM_char *uri,
-
- const SDOM_char *qName,
-
- const SDOM_char *value);
-
-)
-
-
-
-/*
-
- setAttributeNode
-
- Assigns the given attnode as n's attribute.
-
- Returns replaced, if was replaced some node with the same nodeName.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_setAttributeNode(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_Node attnode,
-
- SDOM_Node *replaced);
-
-)
-
-
-
-/*
-
- setAttributeNodeNS
-
- Assigns the given attnode to n's attribute with attnode.uri and attnode.localname.
-
- Returns replaced, if was replaced some node.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_setAttributeNodeNS(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_Node attnode,
-
- SDOM_Node *replaced);
-
-)
-
-
-
-/*
-
- removeAttribute
-
- Removes the given attribute of n.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_removeAttribute(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- const SDOM_char *name);
-
-)
-
-
-
-/*
-
- removeAttribute
-
- Removes the given attribute of n.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_removeAttributeNode(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_Node attnode,
-
- SDOM_Node *removed);
-
-)
-
-/*
-
- attributeElement
-
- returns owner element of attribute specified
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_getAttributeElement(
-
- SablotSituation s,
-
- SDOM_Node attr,
-
- SDOM_Node *owner);
-
-)
-
-
-
-/*
-
- getAttributeList
-
- Returns, in *pAttrList, the list of all attributes of the element n.
-
- !SPEC: Not in spec.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_getAttributeList(
-
- SablotSituation s,
-
- SDOM_Node n,
-
- SDOM_NodeList *pAttrList);
-
-)
-
-
-
-/**
-
- ** END Node
-
- **/
-
-
-
-
-
-/**
-
- ** Functions related to Document
-
- **/
-
-
-
-
-
-/*
-
- docToString
-
- Serializes the document, returning the resulting string in
-
- *pSerialized, which is a Sablotron-allocated buffer.
-
- !SPEC: Not in spec.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_docToString(
-
- SablotSituation s,
-
- SDOM_Document d,
-
- SDOM_char **pSerialized);
-
-)
-
-
-
-Declare(
-
-SDOM_Exception SDOM_nodeToString(
-
- SablotSituation s,
-
- SDOM_Document d,
-
- SDOM_Node n,
-
- SDOM_char **pSerialized);
-
-)
-
-
-
-/**
-
- ** END Document functions
-
- **/
-
-
-
-
-
-/**
-
- ** NodeList
-
- ** An ordered collection of nodes, returned by xql.
-
- **/
-
-
-
-
-
-/*
-
- getNodeListLength
-
- Returns, in *pLength, the number of nodes in the list l.
-
- !SPEC: Not in spec.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_getNodeListLength(
-
- SablotSituation s,
-
- SDOM_NodeList l,
-
- int *pLength);
-
-)
-
-
-
-/*
-
- getNodeListItem
-
- Returns, in *pItem, the index'th member of the node list l.
-
- !SPEC: Not in spec.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_getNodeListItem(
-
- SablotSituation s,
-
- SDOM_NodeList l,
-
- int index,
-
- SDOM_Node *pItem);
-
-)
-
-
-
-/*
-
- disposeNodeList
-
- Destroys the node list l. The nodes themselves are NOT disposed.
-
- !SPEC: Not in spec.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_disposeNodeList(
-
- SablotSituation s,
-
- SDOM_NodeList l);
-
-)
-
-
-
-/**
-
- ** END NodeList
-
- **/
-
-
-
-
-
-/**
-
- ** Miscellaneous
-
- **/
-
-
-
-/*
-
- xql
-
- Returns, in *pResult, the list of all nodes satisfying the XPath
-
- query given as a string in 'query'. For the evaluation of the query, the
-
- current node will be set to currentNode.
-
- Note that the query is necessarily rather restricted.
-
- After the contents of *pResult have been retrieved, the list should
-
- be freed using disposeNodeList.
-
- !SPEC: Not in spec.
-
-*/
-
-Declare(
-
-SDOM_Exception SDOM_xql(
-
- SablotSituation s,
-
- const SDOM_char *query,
-
- SDOM_Node currentNode,
-
- SDOM_NodeList *pResult);
-
-)
-
-
-
-Declare(
-
-SDOM_Exception SDOM_xql_ns(
-
- SablotSituation s,
-
- const SDOM_char *query,
-
- SDOM_Node currentNode,
-
- char** nsmap,
-
- SDOM_NodeList *pResult);
-
-)
-
-
-
-/**
-
- ** END Miscellaneous
-
- **
-
- **
-
- **
-
- ** Exception retrieval
-
- **/
-
-
-
-/*
-
- getExceptionCode
-
- returns the code of the pending exception
-
-*/
-
-
-
-Declare
-
-(
-
- int SDOM_getExceptionCode(SablotSituation s);
-
-)
-
-
-
-/*
-
- getExceptionMessage
-
- returns the message for the pending exception
-
-*/
-
-
-
-Declare
-
-(
-
- char* SDOM_getExceptionMessage(SablotSituation s);
-
-)
-
-
-
-/*
-
- getExceptionDetails
-
- returns extra information for the pending exception
-
- - on the code and message of the primary error
-
- - on the document and file line where the primary error occured
-
-*/
-
-
-
-Declare
-
-(
-
- void SDOM_getExceptionDetails(
-
- SablotSituation s,
-
- int *code,
-
- char **message,
-
- char **documentURI,
-
- int *fileLine);
-
-)
-
-
-
-/**
-
- ** END Exception retrieval
-
- **
-
- **
-
- ** Internal functions
-
- **/
-
-
-
-/*
-
- setNodeInstanceData
-
- saves a pointer in a node instance
-
-*/
-
-
-
-Declare(
-
-void SDOM_setNodeInstanceData(SDOM_Node n, void *data);
-
-)
-
-
-
-/*
-
- getNodeInstanceData
-
- retrieves the saved pointer
-
-*/
-
-Declare(
-
-void* SDOM_getNodeInstanceData(SDOM_Node n);
-
-)
-
-/*
-
- setDisposeNodeCallback
-
- sets callback to be called on every node disposal
-
-*/
-
-
-
-typedef void SDOM_NodeCallback(SDOM_Node n);
-
-
-
-Declare
-
-(
-
- void SDOM_setDisposeCallback(SDOM_NodeCallback *f);
-
-)
-
-
-
-Declare
-
-(
-
- SDOM_NodeCallback* SDOM_getDisposeCallback();
-
-)
-
-
-
-/**
-
- ** FOR IMPLEMENTATION IN PERL
-
- ** None of these fuctions appear in the spec.
-
- **/
-
-
-
-
-
-/*
-
- ArrayRef getChildNodes(Node n)
-
- Returns the array of n's children.
-
- Implement using getFirstChild and getNextSibling.
-
-
-
-
-
- HashRef getAttributes(Node n)
-
- Returns the hash of n's attributes.
-
- Implement using getAttributeList, getNodeListLength,
-
- getNodeListItem, getNodeName and getNodeValue.
-
-
-
-
-
- setAttributes(Node n, HashRef atts)
-
- Sets n's attributes to atts, keeping the old ones alive but making
-
- them standalone.
-
- Implement using getAttributeList, getNodeListLength, removeAttribute
-
- and setAttribute (not too efficient perhaps).
-
-*/
-
-
-
- /* _TH_ v */
-
-Declare
-
-(
-
- void SDOM_tmpListDump(SDOM_Document doc, int p);
-
-)
-
-
-
-Declare
-
-(
-
- SDOM_Exception SDOM_compareNodes(
-
- SablotSituation s,
-
- SDOM_Node n1,
-
- SDOM_Node n2,
-
- int *res);
-
-)
-
-
-
-#endif /* DISABLE_DOM */
-
-
-
-#endif /* SDomHIncl */
-
diff --git a/win32/sablot/include/shandler.h b/win32/sablot/include/shandler.h
deleted file mode 100644
index bf4f3fa..0000000
--- a/win32/sablot/include/shandler.h
+++ /dev/null
@@ -1,738 +0,0 @@
-/*
-
- * The contents of this file are subject to the Mozilla Public
-
- * License Version 1.1 (the "License"); you may not use this file
-
- * except in compliance with the License. You may obtain a copy of
-
- * the License at http://www.mozilla.org/MPL/
-
- *
-
- * Software distributed under the License is distributed on an "AS
-
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-
- * implied. See the License for the specific language governing
-
- * rights and limitations under the License.
-
- *
-
- * The Original Code is the Sablotron XSLT Processor.
-
- *
-
- * The Initial Developer of the Original Code is Ginger Alliance Ltd.
-
- * Portions created by Ginger Alliance are Copyright (C) 2000-2002
-
- * Ginger Alliance Ltd. All Rights Reserved.
-
- *
-
- * Contributor(s):
-
- *
-
- * Alternatively, the contents of this file may be used under the
-
- * terms of the GNU General Public License Version 2 or later (the
-
- * "GPL"), in which case the provisions of the GPL are applicable
-
- * instead of those above. If you wish to allow use of your
-
- * version of this file only under the terms of the GPL and not to
-
- * allow others to use your version of this file under the MPL,
-
- * indicate your decision by deleting the provisions above and
-
- * replace them with the notice and other provisions required by
-
- * the GPL. If you do not delete the provisions above, a recipient
-
- * may use your version of this file under either the MPL or the
-
- * GPL.
-
- */
-
-
-
-#ifndef ShandlerHIncl
-
-#define ShandlerHIncl
-
-
-
-/* we have to deal with the size_t type, sys/types.h;
-
- is needed on some platforms */
-
-#if !defined(_MSC_VER) && !defined(__BORLANDC__)
-
-#include <sabcfg.h>
-
-#endif
-
-
-
-#include <stddef.h>
-
-
-
-/* GP: clean */
-
-
-
-/*****************************************************************
-
-
-
- handler types
-
-
-
-*****************************************************************/
-
-
-
-typedef enum
-
-{
-
- HLR_MESSAGE = 0,
-
- HLR_SCHEME,
-
- HLR_SAX,
-
- HLR_MISC,
-
- HLR_ENC
-
-} HandlerType;
-
-
-
-extern const char* hlrTypeNames[]; /* found in base.cpp */
-
-
-
-typedef enum
-
-{
-
- SH_ERR_OK = 0,
-
- SH_ERR_NOT_OK = 1,
-
- SH_ERR_UNSUPPORTED_SCHEME
-
-} SchemeHandlerErrors;
-
-
-
-/*****************************************************************
-
-SchemeHandler
-
-
-
- is a structure for a scheme handler. It contains pointers to
-
- the following functions of the handler:
-
- open(), get(), put(), close().
-
- All of these function return an error flag (0=OK, 1=not).
-
- open() may also return SH_ERR_UNSUPPORTED_SCHEME.
-
-*****************************************************************/
-
-
-
-/* getAll: open the URI and return the whole string
-
- scheme = URI scheme (e.g. "http")
-
- rest = the rest of the URI (without colon)
-
- the document is returned in a handler-allocated buffer
-
- byteCount holds the byte count on return
-
- return *buffer = NULL if not processed
-
-*/
-
-typedef int SchemeHandlerGetAll(void *userData, SablotHandle processor_,
-
- const char *scheme, const char *rest,
-
- char **buffer, int *byteCount);
-
-
-
-/* freeMemory: free the buffer allocated by getAll
-
-*/
-
-
-
-typedef int SchemeHandlerFreeMemory(void *userData, SablotHandle processor_,
-
- char *buffer);
-
-
-
-/* open: open the URI and return a handle
-
- scheme = URI scheme (e.g. "http")
-
- rest = the rest of the URI (without colon)
-
- the resulting handle is returned in '*handle'
-
-*/
-
-typedef int SchemeHandlerOpen(void *userData, SablotHandle processor_,
-
- const char *scheme, const char *rest, int *handle);
-
-
-
-/* get: retrieve data from the URI
-
- handle = the handle assigned on open
-
- buffer = pointer to the data
-
- *byteCount = number of bytes to read
-
- (the number actually read is returned here)
-
-*/
-
-typedef int SchemeHandlerGet(void *userData, SablotHandle processor_,
-
- int handle, char *buffer, int *byteCount);
-
-
-
-/* put: save data to the URI (if possible)
-
- handle = the handle assigned on open
-
- buffer = pointer to the data
-
- *byteCount = number of bytes to write
-
- (the number actually written is returned here)
-
-*/
-
-typedef int SchemeHandlerPut(void *userData, SablotHandle processor_,
-
- int handle, const char *buffer, int *byteCount);
-
-
-
-/* close: close the URI with the given handle
-
- handle = the handle assigned on open
-
-*/
-
-typedef int SchemeHandlerClose(void *userData, SablotHandle processor_,
-
- int handle);
-
-
-
-typedef struct
-
-{
-
- SchemeHandlerGetAll *getAll;
-
- SchemeHandlerFreeMemory *freeMemory;
-
- SchemeHandlerOpen *open;
-
- SchemeHandlerGet *get;
-
- SchemeHandlerPut *put;
-
- SchemeHandlerClose *close;
-
-} SchemeHandler;
-
-
-
-/*****************************************************************
-
-MessageHandler
-
-
-
- a structure for external message handlers. Such a handler, if set,
-
- receives all error reports, displays them, keeps the log, the
-
- error trace, etc.
-
-*****************************************************************/
-
-
-
-/*
-
- define the "facility number" for Sablotron. This does not mean much
-
- nowadays.
-
-*/
-
-
-
-#define MH_FACILITY_SABLOTRON 2
-
-
-
-/* type for the error codes used by the message handler */
-
-
-
-typedef unsigned long MH_ERROR;
-
-
-
-/* logging levels for the message handler */
-
-
-
-typedef enum
-
-{
-
- MH_LEVEL_DEBUG,
-
- MH_LEVEL_INFO,
-
- MH_LEVEL_WARN,
-
- MH_LEVEL_ERROR,
-
- MH_LEVEL_CRITICAL
-
-} MH_LEVEL;
-
-
-
-/*
-
- makeCode()
-
- makes the "external" error code to report with log() or error()
-
- call with facility = module id; severity = 1 iff critical.
-
- 'code' is the error code internal to Sablotron.
-
-*/
-
-
-
-typedef MH_ERROR
-
-MessageHandlerMakeCode(
-
- void *userData, SablotHandle processor_,
-
- int severity, unsigned short facility, unsigned short code);
-
-
-
-/*
-
- log()
-
- pass code created by makeCode, level as necessary
-
- fields is a NULL-terminated list of strings in form "field:contents"
-
- distinguished fields include: msg, file, line, token
-
-*/
-
-
-
-typedef MH_ERROR
-
-MessageHandlerLog(
-
- void *userData, SablotHandle processor_,
-
- MH_ERROR code, MH_LEVEL level, char **fields);
-
-
-
-/*
-
- error()
-
- for reporting errors, meaning as with log()
-
-*/
-
-
-
-typedef MH_ERROR
-
-MessageHandlerError(void *userData, SablotHandle processor_,
-
- MH_ERROR code, MH_LEVEL level, char **fields);
-
-
-
-/* the message handler structure. Use SablotRegMessageHandler() to register. */
-
-
-
-typedef struct
-
-{
-
- MessageHandlerMakeCode *makeCode;
-
- MessageHandlerLog *log;
-
- MessageHandlerError *error;
-
-} MessageHandler;
-
-
-
-
-
-
-
-
-
-
-
-/*
-
-
-
- SAXHandler
-
- a SAX-like, streaming interface for access to XML docs
-
-
-
-*/
-
-
-
-
-
-#define SAX_RETURN void
-
-
-
-typedef SAX_RETURN
-
-SAXHandlerStartDocument(void* userData, SablotHandle processor_);
-
-
-
-typedef SAX_RETURN
-
-SAXHandlerStartElement(void* userData, SablotHandle processor_,
-
- const char* name, const char** atts);
-
-
-
-typedef SAX_RETURN
-
-SAXHandlerEndElement(void* userData, SablotHandle processor_,
-
- const char* name);
-
-
-
-typedef SAX_RETURN
-
-SAXHandlerStartNamespace(void* userData, SablotHandle processor_,
-
- const char* prefix, const char* uri);
-
-
-
-typedef SAX_RETURN
-
-SAXHandlerEndNamespace(void* userData, SablotHandle processor_,
-
- const char* prefix);
-
-
-
-typedef SAX_RETURN
-
-SAXHandlerComment(void* userData, SablotHandle processor_,
-
- const char* contents);
-
-
-
-typedef SAX_RETURN
-
-SAXHandlerPI(void* userData, SablotHandle processor_,
-
- const char* target, const char* contents);
-
-
-
-typedef SAX_RETURN
-
-SAXHandlerCharacters(void* userData, SablotHandle processor_,
-
- const char* contents, int length);
-
-
-
-typedef SAX_RETURN
-
-SAXHandlerEndDocument(void* userData, SablotHandle processor_);
-
-
-
-
-
-/*
-
- The SAX handler structure. Use SablotRegSAXHandler() to register.
-
-*/
-
-
-
-
-
-typedef struct
-
-{
-
- SAXHandlerStartDocument *startDocument;
-
- SAXHandlerStartElement *startElement;
-
- SAXHandlerEndElement *endElement;
-
- SAXHandlerStartNamespace *startNamespace;
-
- SAXHandlerEndNamespace *endNamespace;
-
- SAXHandlerComment *comment;
-
- SAXHandlerPI *processingInstruction;
-
- SAXHandlerCharacters *characters;
-
- SAXHandlerEndDocument *endDocument;
-
-} SAXHandler;
-
-
-
-
-
-/*****************************************************************
-
-MiscHandler
-
-
-
- Collects miscellaneous callbacks.
-
-*****************************************************************/
-
-
-
-/*
-
- documentInfo()
-
- If set, this callback gets called after the output of a result
-
- document is finished, giving information about its content type
-
- and encoding.
-
-*/
-
-
-
-typedef void
-
-MiscHandlerDocumentInfo(void* userData, SablotHandle processor_,
-
- const char *contentType, const char *encoding);
-
-
-
-/*
-
- The Misc handler structure.
-
- Use SablotRegHandler(HLR_MISC, ...) to register.
-
-*/
-
-
-
-typedef struct
-
-{
-
- MiscHandlerDocumentInfo *documentInfo;
-
-} MiscHandler;
-
-
-
-/*****************************************************************
-
-EncHandler
-
-
-
- Handler for recoding requests in absence of iconv.
-
-*****************************************************************/
-
-
-
-#define EH_FROM_UTF8 1
-
-#define EH_TO_UTF8 0
-
-
-
-/*
-
- the conversion descriptor like iconv_t
-
-*/
-
-
-
-typedef void* EHDescriptor;
-
-
-
-typedef enum
-
-{
-
- EH_OK,
-
- EH_EINVAL,
-
- EH_E2BIG,
-
- EH_EILSEQ
-
-} EHResult;
-
-
-
-/*
-
- open()
-
- direction is either EH_FROM_UTF8 or EH_TO_UTF8
-
- encoding is the other encoding
-
- RETURN the descriptor, or -1 if the encoding is not supported
-
-*/
-
-
-
-typedef EHDescriptor EncHandlerOpen(void* userData, SablotHandle processor_,
-
- int direction, const char *encoding);
-
-
-
-/*
-
- conv()
-
- arguments 3 through 7 are just like for iconv, see the manpage
-
- RETURN -1 on error (set errno), a different value (e.g. 0) if OK
-
-*/
-
-
-
-typedef EHResult EncHandlerConv(void* userData, SablotHandle processor_,
-
- EHDescriptor cd, const char** inbuf, size_t *inbytesleft,
-
- char ** outbuf, size_t *outbytesleft);
-
-
-
-/*
-
- close()
-
- cd is the descriptor to close. Return 0 if OK, -1 on error.
-
-*/
-
-
-
-typedef int EncHandlerClose(void* userData, SablotHandle processor_,
-
- EHDescriptor cd);
-
-
-
-/*
-
- The EncHandler structure.
-
- Use SablotRegHandler(HLR_ENC, ...) to register.
-
-*/
-
-
-
-typedef struct
-
-{
-
- EncHandlerOpen *open;
-
- EncHandlerConv *conv;
-
- EncHandlerClose *close;
-
-} EncHandler;
-
-
-
-#endif
-
diff --git a/win32/sablot/include/sxpath.h b/win32/sablot/include/sxpath.h
deleted file mode 100644
index 56888b4..0000000
--- a/win32/sablot/include/sxpath.h
+++ /dev/null
@@ -1,664 +0,0 @@
-/*
-
- * The contents of this file are subject to the Mozilla Public
-
- * License Version 1.1 (the "License"); you may not use this file
-
- * except in compliance with the License. You may obtain a copy of
-
- * the License at http://www.mozilla.org/MPL/
-
- *
-
- * Software distributed under the License is distributed on an "AS
-
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-
- * implied. See the License for the specific language governing
-
- * rights and limitations under the License.
-
- *
-
- * The Original Code is the Sablotron XSLT Processor.
-
- *
-
- * The Initial Developer of the Original Code is Ginger Alliance Ltd.
-
- * Portions created by Ginger Alliance are Copyright (C) 2000-2002
-
- * Ginger Alliance Ltd. All Rights Reserved.
-
- *
-
- * Contributor(s):
-
- *
-
- * Alternatively, the contents of this file may be used under the
-
- * terms of the GNU General Public License Version 2 or later (the
-
- * "GPL"), in which case the provisions of the GPL are applicable
-
- * instead of those above. If you wish to allow use of your
-
- * version of this file only under the terms of the GPL and not to
-
- * allow others to use your version of this file under the MPL,
-
- * indicate your decision by deleting the provisions above and
-
- * replace them with the notice and other provisions required by
-
- * the GPL. If you do not delete the provisions above, a recipient
-
- * may use your version of this file under either the MPL or the
-
- * GPL.
-
- */
-
-
-
-#ifndef SXPathHIncl
-
-#define SXPathHIncl
-
-
-
-/* basic types needed in sablot.h */
-
-typedef void *SXP_Node;
-
-typedef void *SXP_Document;
-
-typedef void *SXP_NodeList;
-
-typedef SXP_Node NodeHandle;
-
-
-
-#include "sablot.h"
-
-
-
-typedef enum
-
-{
-
- ELEMENT_NODE = 1,
-
- ATTRIBUTE_NODE = 2,
-
- TEXT_NODE = 3,
-
- PROCESSING_INSTRUCTION_NODE = 7,
-
- COMMENT_NODE = 8,
-
- DOCUMENT_NODE = 9,
-
- NAMESPACE_NODE = 13
-
-} SXP_NodeType;
-
-
-
-typedef enum
-
-{
-
- SXP_NONE,
-
- SXP_NUMBER,
-
- SXP_STRING,
-
- SXP_BOOLEAN,
-
- SXP_NODESET
-
-} SXP_ExpressionType;
-
-
-
-typedef char SXP_char;
-
-
-
-typedef void *QueryContext;
-
-
-
-/*option constants */
-
-typedef enum
-
-{
-
- SXPF_DISPOSE_NAMES = 0x1,
-
- SXPF_DISPOSE_VALUES = 0x2,
-
- SXPF_SUPPORTS_UNPARSED_ENTITIES =0x4
-
-} SXPFlags;
-
-
-
-/*
-
- * DOM handler functions
-
- * This handler is registered with the Situation rather than the Processor
-
- */
-
-
-
-/*****************************************************************
-
-DOMHandler
-
-
-
- Handler providing information about a DOM tree to the XPath
-
- processor
-
-*****************************************************************/
-
-
-
-typedef SXP_NodeType DOMH_getNodeType(SXP_Node n);
-
-typedef SXP_NodeType DOMH_getNodeTypeExt(SXP_Node n, void *userData);
-
-
-
-typedef const SXP_char* DOMH_getNodeName(SXP_Node n);
-
-typedef const SXP_char* DOMH_getNodeNameExt(SXP_Node n, void *userData);
-
-
-
-typedef const SXP_char* DOMH_getNodeNameURI(SXP_Node n);
-
-typedef const SXP_char* DOMH_getNodeNameURIExt(SXP_Node n, void *userData);
-
-
-
-typedef const SXP_char* DOMH_getNodeNameLocal(SXP_Node n);
-
-typedef const SXP_char* DOMH_getNodeNameLocalExt(SXP_Node n, void *userData);
-
-
-
-typedef const SXP_char* DOMH_getNodeValue(SXP_Node n);
-
-typedef const SXP_char* DOMH_getNodeValueExt(SXP_Node n, void *userData);
-
-
-
-typedef SXP_Node DOMH_getNextSibling(SXP_Node n);
-
-typedef SXP_Node DOMH_getNextSiblingExt(SXP_Node n, void *userData);
-
-
-
-typedef SXP_Node DOMH_getPreviousSibling(SXP_Node n);
-
-typedef SXP_Node DOMH_getPreviousSiblingExt(SXP_Node n, void *userData);
-
-
-
-typedef SXP_Node DOMH_getNextAttrNS(SXP_Node n);
-
-typedef SXP_Node DOMH_getNextAttrNSExt(SXP_Node n, void *userData);
-
-
-
-typedef SXP_Node DOMH_getPreviousAttrNS(SXP_Node n);
-
-typedef SXP_Node DOMH_getPreviousAttrNSExt(SXP_Node n, void *userData);
-
-
-
-typedef int DOMH_getChildCount(SXP_Node n);
-
-typedef int DOMH_getChildCountExt(SXP_Node n, void *userData);
-
-
-
-typedef int DOMH_getAttributeCount(SXP_Node n);
-
-typedef int DOMH_getAttributeCountExt(SXP_Node n, void *userData);
-
-
-
-typedef int DOMH_getNamespaceCount(SXP_Node n);
-
-typedef int DOMH_getNamespaceCountExt(SXP_Node n, void *userData);
-
-
-
-typedef SXP_Node DOMH_getChildNo(SXP_Node n, int ndx);
-
-typedef SXP_Node DOMH_getChildNoExt(SXP_Node n, int ndx, void *userData);
-
-
-
-typedef SXP_Node DOMH_getAttributeNo(SXP_Node n, int ndx);
-
-typedef SXP_Node DOMH_getAttributeNoExt(SXP_Node n, int ndx, void *userData);
-
-
-
-typedef SXP_Node DOMH_getNamespaceNo(SXP_Node n, int ndx);
-
-typedef SXP_Node DOMH_getNamespaceNoExt(SXP_Node n, int ndx, void *userData);
-
-
-
-typedef SXP_Node DOMH_getParent(SXP_Node n);
-
-typedef SXP_Node DOMH_getParentExt(SXP_Node n, void *userData);
-
-
-
-typedef SXP_Document DOMH_getOwnerDocument(SXP_Node n);
-
-typedef SXP_Document DOMH_getOwnerDocumentExt(SXP_Node n, void *userData);
-
-
-
-typedef int DOMH_compareNodes(SXP_Node n1, SXP_Node n2);
-
-typedef int DOMH_compareNodesExt(SXP_Node n1, SXP_Node n2, void *userData);
-
-
-
-typedef SXP_Document DOMH_retrieveDocument(const SXP_char* uri,
-
- void* udata);
-
-typedef SXP_Document DOMH_retrieveDocumentExt(const SXP_char* uri,
-
- const SXP_char* baseUri,
-
- void* udata);
-
-
-
-typedef SXP_Node DOMH_getNodeWithID(SXP_Document doc, const SXP_char* id);
-
-typedef SXP_Node DOMH_getNodeWithIDExt(SXP_Document doc, const SXP_char* id, void *userData);
-
-
-
-typedef void DOMH_freeBuffer(SXP_char *buff);
-
-typedef void DOMH_freeBufferExt(SXP_Node n, SXP_char *buff, void *userData);
-
-
-
-
-
-typedef struct
-
-{
-
- DOMH_getNodeType *getNodeType;
-
- DOMH_getNodeName *getNodeName;
-
- DOMH_getNodeNameURI *getNodeNameURI;
-
- DOMH_getNodeNameLocal *getNodeNameLocal;
-
- DOMH_getNodeValue *getNodeValue;
-
- DOMH_getNextSibling *getNextSibling;
-
- DOMH_getPreviousSibling *getPreviousSibling;
-
- DOMH_getNextAttrNS *getNextAttrNS;
-
- DOMH_getPreviousAttrNS *getPreviousAttrNS;
-
- DOMH_getChildCount *getChildCount;
-
- DOMH_getAttributeCount *getAttributeCount;
-
- DOMH_getNamespaceCount *getNamespaceCount;
-
- DOMH_getChildNo *getChildNo;
-
- DOMH_getAttributeNo *getAttributeNo;
-
- DOMH_getNamespaceNo *getNamespaceNo;
-
- DOMH_getParent *getParent;
-
- DOMH_getOwnerDocument *getOwnerDocument;
-
- DOMH_compareNodes *compareNodes;
-
- DOMH_retrieveDocument *retrieveDocument;
-
- DOMH_getNodeWithID *getNodeWithID;
-
- /*optional entries - driven by sxpOptions */
-
- DOMH_freeBuffer *freeBuffer;
-
-
-
- DOMH_getNodeTypeExt *getNodeTypeExt;
-
- DOMH_getNodeNameExt *getNodeNameExt;
-
- DOMH_getNodeNameURIExt *getNodeNameURIExt;
-
- DOMH_getNodeNameLocalExt *getNodeNameLocalExt;
-
- DOMH_getNodeValueExt *getNodeValueExt;
-
- DOMH_getNextSiblingExt *getNextSiblingExt;
-
- DOMH_getPreviousSiblingExt *getPreviousSiblingExt;
-
- DOMH_getNextAttrNSExt *getNextAttrNSExt;
-
- DOMH_getPreviousAttrNSExt *getPreviousAttrNSExt;
-
- DOMH_getChildCountExt *getChildCountExt;
-
- DOMH_getAttributeCountExt *getAttributeCountExt;
-
- DOMH_getNamespaceCountExt *getNamespaceCountExt;
-
- DOMH_getChildNoExt *getChildNoExt;
-
- DOMH_getAttributeNoExt *getAttributeNoExt;
-
- DOMH_getNamespaceNoExt *getNamespaceNoExt;
-
- DOMH_getParentExt *getParentExt;
-
- DOMH_getOwnerDocumentExt *getOwnerDocumentExt;
-
- DOMH_compareNodesExt *compareNodesExt;
-
- DOMH_retrieveDocumentExt *retrieveDocumentExt;
-
- DOMH_getNodeWithIDExt *getNodeWithIDExt;
-
- /*optional entries - driven by sxpOptions */
-
- DOMH_freeBufferExt *freeBufferExt;
-
-
-
-} DOMHandler;
-
-
-
-Declare
-
-(
-
- void SXP_registerDOMHandler(SablotSituation S,
-
- DOMHandler *domh, void* udata);
-
-)
-
-
-
-Declare
-
-(
-
- void SXP_unregisterDOMHandler(SablotSituation S);
-
-)
-
-
-
-/*
-
- *
-
- * QueryContext functions
-
- *
-
- */
-
-
-
-/* options setter getter */
-
-Declare
-
-(
-
- void SXP_setOptions(SablotSituation S, unsigned long options);
-
-)
-
-
-
-Declare
-
-(
-
- void SXP_setMaskBit(SablotSituation S, int mask);
-
-)
-
-
-
-Declare
-
-(
-
- unsigned long SXP_getOptions(SablotSituation S);
-
-)
-
-
-
-Declare
-
-(
-
- int SXP_createQueryContext(SablotSituation S, QueryContext *Q);
-
-)
-
-
-
-Declare
-
-(
-
- int SXP_addVariableBinding(QueryContext Q,
-
- const SXP_char* name, QueryContext source);
-
-)
-
-
-
-Declare
-
-(
-
- int SXP_addVariableNumber(QueryContext Q,
-
- const SXP_char* name, double value);
-
-)
-
-
-
-Declare
-
-(
-
- int SXP_addVariableString(QueryContext Q,
-
- const SXP_char* name, const SXP_char* value);
-
-)
-
-
-
-Declare
-
-(
-
- int SXP_addVariableBoolean(QueryContext Q,
-
- const SXP_char* name, int value);
-
-)
-
-
-
-Declare
-
-(
-
- int SXP_addNamespaceDeclaration(QueryContext Q,
-
- const SXP_char* prefix, const SXP_char* uri);
-
-)
-
-
-
-Declare
-
-(
-
- int SXP_query(QueryContext Q, const SXP_char* query,
-
- SXP_Node n, int contextPosition, int contextSize);
-
-)
-
-
-
-Declare
-
-(
-
- int SXP_destroyQueryContext(QueryContext Q);
-
-)
-
-
-
-/*
-
- *
-
- * Functions to retrieve the query result and its type
-
- *
-
- */
-
-
-
-Declare
-
-(
-
- int SXP_getResultType(QueryContext Q, SXP_ExpressionType *type);
-
-)
-
-
-
-Declare
-
-(
-
- int SXP_getResultNumber(QueryContext Q, double *result);
-
-)
-
-
-
-Declare
-
-(
-
- int SXP_getResultBool(QueryContext Q, int *result);
-
-)
-
-
-
-Declare
-
-(
-
- int SXP_getResultString(QueryContext Q, const char **result);
-
-)
-
-
-
-Declare
-
-(
-
- int SXP_getResultNodeset(QueryContext Q, SXP_NodeList *result);
-
-)
-
-
-
-/*
-
- *
-
- * NodeList manipulation
-
- *
-
- */
-
-
-
-Declare
-
-(
-
- int SXP_getNodeListLength(SXP_NodeList l);
-
-)
-
-
-
-Declare
-
-(
-
- SXP_Node SXP_getNodeListItem(QueryContext Q, SXP_NodeList l, int index);
-
-)
-
-
-
-
-
-#endif /* SXPathHIncl */
-
diff --git a/win32/sablot/lib/sablot.lib b/win32/sablot/lib/sablot.lib
deleted file mode 100644
index e334654..0000000
--- a/win32/sablot/lib/sablot.lib
+++ /dev/null
Binary files differ
diff --git a/win32/sablot/lib/sablotd.lib b/win32/sablot/lib/sablotd.lib
deleted file mode 100644
index 4b59629..0000000
--- a/win32/sablot/lib/sablotd.lib
+++ /dev/null
Binary files differ