summaryrefslogtreecommitdiffstats
path: root/kttsd/filters/xhtml2ssml
diff options
context:
space:
mode:
Diffstat (limited to 'kttsd/filters/xhtml2ssml')
-rw-r--r--kttsd/filters/xhtml2ssml/Doxyfile266
-rw-r--r--kttsd/filters/xhtml2ssml/demonstration.html5
-rw-r--r--kttsd/filters/xhtml2ssml/main.cpp22
-rw-r--r--kttsd/filters/xhtml2ssml/tagmappingrc5
-rw-r--r--kttsd/filters/xhtml2ssml/xhtml2ssml.cpp105
-rw-r--r--kttsd/filters/xhtml2ssml/xhtml2ssml.h61
-rw-r--r--kttsd/filters/xhtml2ssml/xhtml2ssml.kdevelop112
-rw-r--r--kttsd/filters/xhtml2ssml/xhtml2ssml.kdevelop.pcsbin0 -> 14766 bytes
-rw-r--r--kttsd/filters/xhtml2ssml/xhtml2ssml.kdevses38
-rw-r--r--kttsd/filters/xhtml2ssml/xhtml2ssml.pro10
-rw-r--r--kttsd/filters/xhtml2ssml/xmlelement.cpp102
-rw-r--r--kttsd/filters/xhtml2ssml/xmlelement.h91
12 files changed, 817 insertions, 0 deletions
diff --git a/kttsd/filters/xhtml2ssml/Doxyfile b/kttsd/filters/xhtml2ssml/Doxyfile
new file mode 100644
index 0000000..0061358
--- /dev/null
+++ b/kttsd/filters/xhtml2ssml/Doxyfile
@@ -0,0 +1,266 @@
+# Doxyfile 1.3.7-KDevelop
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME = xhtml2ssml.kdevelop
+PROJECT_NUMBER = $VERSION$
+OUTPUT_DIRECTORY =
+CREATE_SUBDIRS = NO
+OUTPUT_LANGUAGE = English
+USE_WINDOWS_ENCODING = NO
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = NO
+FULL_PATH_NAMES = YES
+STRIP_FROM_PATH = /home/paul/
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = NO
+INHERIT_DOCS = YES
+DISTRIBUTE_GROUP_DOC = NO
+TAB_SIZE = 8
+ALIASES =
+OPTIMIZE_OUTPUT_FOR_C = NO
+OPTIMIZE_OUTPUT_JAVA = NO
+SUBGROUPING = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL = NO
+EXTRACT_PRIVATE = NO
+EXTRACT_STATIC = NO
+EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_METHODS = NO
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = NO
+CASE_SENSE_NAMES = YES
+HIDE_SCOPE_NAMES = NO
+SHOW_INCLUDE_FILES = YES
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = YES
+SORT_BRIEF_DOCS = NO
+SORT_BY_SCOPE_NAME = NO
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+SHOW_USED_FILES = YES
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_FORMAT = "$file:$line: $text"
+WARN_LOGFILE =
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = /home/paul/Kdecvs/kdeaccessibility/kttsd/filters
+FILE_PATTERNS = *.c \
+ *.cc \
+ *.cxx \
+ *.cpp \
+ *.c++ \
+ *.java \
+ *.ii \
+ *.ixx \
+ *.ipp \
+ *.i++ \
+ *.inl \
+ *.h \
+ *.hh \
+ *.hxx \
+ *.hpp \
+ *.h++ \
+ *.idl \
+ *.odl \
+ *.cs \
+ *.php \
+ *.php3 \
+ *.inc \
+ *.m \
+ *.mm \
+ *.C \
+ *.CC \
+ *.C++ \
+ *.II \
+ *.I++ \
+ *.H \
+ *.HH \
+ *.H++ \
+ *.CS \
+ *.PHP \
+ *.PHP3 \
+ *.M \
+ *.MM \
+ *.C \
+ *.H \
+ *.tlh \
+ *.diff \
+ *.patch \
+ *.moc \
+ *.xpm \
+ *.dox
+RECURSIVE = yes
+EXCLUDE =
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS = *
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_SOURCE_FILES = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = NO
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION = YES
+VERBATIM_HEADERS = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = NO
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX =
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = html
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_ALIGN_MEMBERS = YES
+GENERATE_HTMLHELP = NO
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+BINARY_TOC = NO
+TOC_EXPAND = NO
+DISABLE_INDEX = NO
+ENUM_VALUES_PER_LINE = 4
+GENERATE_TREEVIEW = NO
+TREEVIEW_WIDTH = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = YES
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4wide
+EXTRA_PACKAGES =
+LATEX_HEADER =
+PDF_HYPERLINKS = NO
+USE_PDFLATEX = NO
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = NO
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = yes
+XML_OUTPUT = xml
+XML_SCHEMA =
+XML_DTD =
+XML_PROGRAMLISTING = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = NO
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+TAGFILES =
+GENERATE_TAGFILE = xhtml2ssml.tag
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+PERL_PATH = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = YES
+HIDE_UNDOC_RELATIONS = YES
+HAVE_DOT = NO
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+UML_LOOK = NO
+TEMPLATE_RELATIONS = NO
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DOT_IMAGE_FORMAT = png
+DOT_PATH =
+DOTFILE_DIRS =
+MAX_DOT_GRAPH_WIDTH = 1024
+MAX_DOT_GRAPH_HEIGHT = 1024
+MAX_DOT_GRAPH_DEPTH = 1000
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+SEARCHENGINE = NO
diff --git a/kttsd/filters/xhtml2ssml/demonstration.html b/kttsd/filters/xhtml2ssml/demonstration.html
new file mode 100644
index 0000000..89bf8a3
--- /dev/null
+++ b/kttsd/filters/xhtml2ssml/demonstration.html
@@ -0,0 +1,5 @@
+<html>
+ <body>
+ <p>Isn't it such a nice and <strong>bold</strong> day today?</p>
+ </body>
+</html>
diff --git a/kttsd/filters/xhtml2ssml/main.cpp b/kttsd/filters/xhtml2ssml/main.cpp
new file mode 100644
index 0000000..822d068
--- /dev/null
+++ b/kttsd/filters/xhtml2ssml/main.cpp
@@ -0,0 +1,22 @@
+
+#include <qapplication.h>
+#include <qfile.h>
+#include <qxml.h>
+#include <qmap.h>
+#include <iostream>
+#include "xhtml2ssml.h"
+#include "xmlelement.h"
+
+int main(int argc, char *argv[]) {
+ QApplication a(argc, argv);
+ QFile f("demonstration.html");
+ QXmlInputSource input(&f);
+ QXmlSimpleReader reader;
+ XHTMLToSSMLParser *parser = new XHTMLToSSMLParser();
+ reader.setContentHandler(parser);
+ reader.parse(input);
+ std::cout << parser->convertedText() << "\n";
+ delete parser;
+ return 0;
+}
+
diff --git a/kttsd/filters/xhtml2ssml/tagmappingrc b/kttsd/filters/xhtml2ssml/tagmappingrc
new file mode 100644
index 0000000..425af8e
--- /dev/null
+++ b/kttsd/filters/xhtml2ssml/tagmappingrc
@@ -0,0 +1,5 @@
+# This is a comment
+# and another one
+# a html 'b' or 'strong' tag is mapped to 'emphasis level="strong"'
+b:emphasis level="strong"
+strong:emphasis level="strong"
diff --git a/kttsd/filters/xhtml2ssml/xhtml2ssml.cpp b/kttsd/filters/xhtml2ssml/xhtml2ssml.cpp
new file mode 100644
index 0000000..7c77b9e
--- /dev/null
+++ b/kttsd/filters/xhtml2ssml/xhtml2ssml.cpp
@@ -0,0 +1,105 @@
+
+
+/****************************************************************************
+ XHTMLToSSMLParser class
+
+ Parses a piece of XHTML markup and converts into SSML.
+ -------------------
+ Copyright:
+ (C) 2004 by Paul Giannaros <ceruleanblaze@gmail.com>
+ -------------------
+ Original author: Paul Giannaros <ceruleanblaze@gmail.com>
+******************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; version 2 of the License. *
+ * *
+ ***************************************************************************/
+
+#include <qstring.h>
+#include <qdict.h>
+#include <qxml.h>
+#include <qfile.h>
+#include <iostream>
+
+#include "xmlelement.h"
+#include "xhtml2ssml.h"
+
+
+/// Document parsing begin. Init stuff here.
+bool XHTMLToSSMLParser::startDocument() {
+ /// Read the file which maps xhtml tags -> ssml tags. Look at the file for more information.
+ QFile file("tagmappingrc");
+ if(!file.open(IO_ReadOnly)) {
+ std::cerr << "Could not read config file 'tagmappingrc'. Please check that it exists and is readable.\n";
+ // Kill further parsing
+ return false;
+ }
+ QTextStream stream(&file);
+ // File parsing.
+ bool linestatus = true;
+ while(!stream.atEnd()) {
+ linestatus = readFileConfigEntry(stream.readLine());
+ // If there's some syntactical error in the file then return false.
+ if(!linestatus)
+ return false;
+ /// Maybe call processEvents() to prevent GUI blockages?
+ }
+ return true;
+}
+
+bool XHTMLToSSMLParser::startElement(const QString &, const QString &, const QString &qName, const QXmlAttributes &atts) {
+ QString attributes = "";
+ if(atts.length() > 0) {
+ const int attsLength = atts.lenght();
+ for(int i = 0; i < attsLength; ++i)
+ attributes += " " + atts.qName(i) + "=\"" + atts.value(i) + "\"";
+ }
+ QString fromelement = qName + attributes;
+ // If this element is one of the keys that was specified in the configuration file, get what it should be converted to and
+ // append to the output string.
+ QString toelement = m_xhtml2ssml[fromelement];
+ if(toelement)
+ m_output.append(XMLElement::fromQString(toelement).startTag());
+ return true;
+}
+
+bool XHTMLToSSMLParser::endElement(const QString &, const QString &, const QString &qName) {
+ QString fromelement = qName;
+ QString toelement = m_xhtml2ssml[fromelement];
+ if(toelement)
+ m_output.append(XMLElement::fromQString(toelement).endTag());
+ return true;
+}
+
+bool XHTMLToSSMLParser::characters(const QString &characters) {
+ m_output.append(characters);
+ return true;
+}
+
+
+QString XHTMLToSSMLParser::convertedText() {
+ return m_output.simplifyWhiteSpace();
+}
+
+/// Parse a line from the configuration file which maps xhtml : ssml equivalent.
+/// It makes entries in the m_xhtml2ssml map accordingly.
+/// @param line A line from a file to parse
+/// @returns true if the syntax of the line was okay and the parsing succeeded - false otherwise.
+bool XHTMLToSSMLParser::readFileConfigEntry(const QString &line) {
+ // comments
+ if(line.stripWhiteSpace().startsWith("#")) {
+ return true;
+ }
+ // break into QStringList
+ // the second parameter to split is the string, with all space simplified and all space around the : removed, i.e
+ // "something : somethingelse" -> "something:somethingelse"
+ QStringList keyvalue = QStringList::split(":", line.simplifyWhiteSpace().replace(" :", ":").replace(": ", ":"));
+ if(keyvalue.count() != 2)
+ return false;
+ m_xhtml2ssml[keyvalue[0]] = keyvalue[1];
+ return true;
+}
diff --git a/kttsd/filters/xhtml2ssml/xhtml2ssml.h b/kttsd/filters/xhtml2ssml/xhtml2ssml.h
new file mode 100644
index 0000000..7271dc0
--- /dev/null
+++ b/kttsd/filters/xhtml2ssml/xhtml2ssml.h
@@ -0,0 +1,61 @@
+
+/****************************************************************************
+ XHTMLToSSMLParser class
+
+ Parses a piece of XHTML markup and converts into SSML.
+ -------------------
+ Copyright:
+ (C) 2004 by Paul Giannaros <ceruleanblaze@gmail.com>
+ -------------------
+ Original author: Paul Giannaros <ceruleanblaze@gmail.com>
+******************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; version 2 of the License. *
+ * *
+ ***************************************************************************/
+
+
+#ifndef _XHTML2SSML_H_
+#define _XHTML2SSML_H_
+
+#include <qxml.h>
+#include <qmap.h>
+
+typedef QMap<QString, QString> QStringMap;
+class QString;
+
+class XHTMLToSSMLParser : public QXmlDefaultHandler {
+
+public:
+ /// No need to reimplement constructor..
+ /// The document parsing starts
+ bool startDocument();
+ /// start of an element encountered (<element foo="bar">)
+ bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts);
+ /// end of an element encountered (</element>)
+ bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName);
+ /// text encountered (blah bah blah)
+ bool characters(const QString &);
+
+ /// Get the output text that was generated during the parsing.
+ /// @returns The converted text.
+ QString convertedText();
+
+ /// Parse a line from the configuration file which maps xhtml : ssml equivalent.
+ /// It makes entries in the m_xhtml2ssml map accordingly.
+ /// @param line A line from a file to parse
+ /// @returns true if the syntax of the line was okay and the parsing succeeded - false otherwise.
+ bool readFileConfigEntry(const QString &line);
+
+private:
+ /// Dict of xhtml tags -> ssml tags
+ QStringMap m_xhtml2ssml;
+ /// The output of the conversion
+ QString m_output;
+};
+
+#endif
diff --git a/kttsd/filters/xhtml2ssml/xhtml2ssml.kdevelop b/kttsd/filters/xhtml2ssml/xhtml2ssml.kdevelop
new file mode 100644
index 0000000..691735f
--- /dev/null
+++ b/kttsd/filters/xhtml2ssml/xhtml2ssml.kdevelop
@@ -0,0 +1,112 @@
+<?xml version = '1.0'?>
+<kdevelop>
+ <general>
+ <author>Paul Giannaros</author>
+ <email>ceruleanblaze@gmail.com</email>
+ <version>$VERSION$</version>
+ <projectmanagement>KDevTrollProject</projectmanagement>
+ <primarylanguage>C++</primarylanguage>
+ <keywords>
+ <keyword>Qt</keyword>
+ </keywords>
+ </general>
+ <kdevfileview>
+ <groups>
+ <group pattern="*.cpp;*.cxx;*.h" name="Sources" />
+ <group pattern="*.ui" name="User Interface" />
+ <group pattern="*.png" name="Icons" />
+ <group pattern="*" name="Others" />
+ <hidenonprojectfiles>false</hidenonprojectfiles>
+ <hidenonlocation>false</hidenonlocation>
+ </groups>
+ <tree>
+ <hidepatterns>*.o,*.lo,CVS</hidepatterns>
+ <hidenonprojectfiles>false</hidenonprojectfiles>
+ </tree>
+ </kdevfileview>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>bash</toc>
+ <toc>bash_bugs</toc>
+ <toc>clanlib</toc>
+ <toc>w3c-dom-level2-html</toc>
+ <toc>fortran_bugs_gcc</toc>
+ <toc>gnome1</toc>
+ <toc>gnustep</toc>
+ <toc>gtk</toc>
+ <toc>gtk_bugs</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>java_bugs_gcc</toc>
+ <toc>java_bugs_sun</toc>
+ <toc>kde2book</toc>
+ <toc>opengl</toc>
+ <toc>pascal_bugs_fp</toc>
+ <toc>php</toc>
+ <toc>php_bugs</toc>
+ <toc>perl</toc>
+ <toc>perl_bugs</toc>
+ <toc>python</toc>
+ <toc>python_bugs</toc>
+ <toc>qt-kdev3</toc>
+ <toc>ruby</toc>
+ <toc>ruby_bugs</toc>
+ <toc>sdl</toc>
+ <toc>stl</toc>
+ <toc>w3c-svg</toc>
+ <toc>sw</toc>
+ <toc>w3c-uaag10</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoredoxygen>
+ <toc>KDE Libraries (Doxygen)</toc>
+ </ignoredoxygen>
+ </kdevdoctreeview>
+ <kdevdebugger>
+ <general>
+ <dbgshell/>
+ </general>
+ </kdevdebugger>
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="ui" />
+ <type ext="cpp" />
+ <type ext="h" />
+ </useglobaltypes>
+ </kdevfilecreate>
+ <kdevtrollproject>
+ <general>
+ <activedir></activedir>
+ </general>
+ <run>
+ <directoryradio>executable</directoryradio>
+ </run>
+ </kdevtrollproject>
+ <kdevcppsupport>
+ <references>
+ <pcs>kdeincludedb</pcs>
+ <pcs>qtincludedb</pcs>
+ <pcs>qtincludesdb</pcs>
+ <pcs>kgmailtoincludedb</pcs>
+ </references>
+ <codecompletion>
+ <includeGlobalFunctions>true</includeGlobalFunctions>
+ <includeTypes>true</includeTypes>
+ <includeEnums>true</includeEnums>
+ <includeTypedefs>false</includeTypedefs>
+ <automaticCodeCompletion>true</automaticCodeCompletion>
+ <automaticArgumentsHint>true</automaticArgumentsHint>
+ <automaticHeaderCompletion>true</automaticHeaderCompletion>
+ <codeCompletionDelay>250</codeCompletionDelay>
+ <argumentsHintDelay>400</argumentsHintDelay>
+ <headerCompletionDelay>250</headerCompletionDelay>
+ </codecompletion>
+ </kdevcppsupport>
+ <kdevcvsservice>
+ <recursivewhenupdate>true</recursivewhenupdate>
+ <prunedirswhenupdate>true</prunedirswhenupdate>
+ <createdirswhenupdate>true</createdirswhenupdate>
+ <recursivewhencommitremove>true</recursivewhencommitremove>
+ <revertoptions>-C</revertoptions>
+ </kdevcvsservice>
+</kdevelop>
diff --git a/kttsd/filters/xhtml2ssml/xhtml2ssml.kdevelop.pcs b/kttsd/filters/xhtml2ssml/xhtml2ssml.kdevelop.pcs
new file mode 100644
index 0000000..4cdb884
--- /dev/null
+++ b/kttsd/filters/xhtml2ssml/xhtml2ssml.kdevelop.pcs
Binary files differ
diff --git a/kttsd/filters/xhtml2ssml/xhtml2ssml.kdevses b/kttsd/filters/xhtml2ssml/xhtml2ssml.kdevses
new file mode 100644
index 0000000..7128bc6
--- /dev/null
+++ b/kttsd/filters/xhtml2ssml/xhtml2ssml.kdevses
@@ -0,0 +1,38 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<!DOCTYPE KDevPrjSession>
+<KDevPrjSession>
+ <DocsAndViews NumberOfDocuments="5" >
+ <Doc0 NumberOfViews="1" URL="file:/home/paul/Kdecvs/kdeaccessibility/kttsd/filters/xhtml2ssml.cpp" >
+ <View0 line="63" Type="Source" />
+ </Doc0>
+ <Doc1 NumberOfViews="1" URL="file:/home/paul/Kdecvs/kdeaccessibility/kttsd/filters/xhtml2ssml.h" >
+ <View0 line="21" Type="Source" />
+ </Doc1>
+ <Doc2 NumberOfViews="1" URL="file:/home/paul/Kdecvs/kdeaccessibility/kttsd/filters/main.cpp" >
+ <View0 line="17" Type="Source" />
+ </Doc2>
+ <Doc3 NumberOfViews="1" URL="file:/home/paul/Kdecvs/kdeaccessibility/kttsd/filters/xmlelement.cpp" >
+ <View0 line="72" Type="Source" />
+ </Doc3>
+ <Doc4 NumberOfViews="1" URL="file:/home/paul/Kdecvs/kdeaccessibility/kttsd/filters/xmlelement.h" >
+ <View0 line="75" Type="Source" />
+ </Doc4>
+ </DocsAndViews>
+ <pluginList>
+ <kdevbookmarks>
+ <bookmarks/>
+ </kdevbookmarks>
+ <kdevsubversion>
+ <subversion recurseresolve="1" recurserelocate="1" recursemerge="1" recursecommit="1" base="" recursepropget="1" recurseswitch="1" recurseupdate="1" recursepropset="1" recursediff="1" recurserevert="1" forcemove="1" recursecheckout="1" forceremove="1" recurseadd="1" recurseproplist="1" forcemerge="1" />
+ </kdevsubversion>
+ <kdevvalgrind>
+ <executable path="" params="" />
+ <valgrind path="" params="" />
+ <calltree path="" params="" />
+ <kcachegrind path="" />
+ </kdevvalgrind>
+ <kdevdebugger>
+ <breakpointList/>
+ </kdevdebugger>
+ </pluginList>
+</KDevPrjSession>
diff --git a/kttsd/filters/xhtml2ssml/xhtml2ssml.pro b/kttsd/filters/xhtml2ssml/xhtml2ssml.pro
new file mode 100644
index 0000000..a9b5a4a
--- /dev/null
+++ b/kttsd/filters/xhtml2ssml/xhtml2ssml.pro
@@ -0,0 +1,10 @@
+######################################################################
+# Automatically generated by qmake (1.07a) Tue Dec 21 21:18:47 2004
+######################################################################
+
+TEMPLATE = app
+INCLUDEPATH += .
+
+# Input
+HEADERS += xhtml2ssml.h xmlelement.h
+SOURCES += main.cpp xhtml2ssml.cpp xmlelement.cpp
diff --git a/kttsd/filters/xhtml2ssml/xmlelement.cpp b/kttsd/filters/xhtml2ssml/xmlelement.cpp
new file mode 100644
index 0000000..53fa4f6
--- /dev/null
+++ b/kttsd/filters/xhtml2ssml/xmlelement.cpp
@@ -0,0 +1,102 @@
+/****************************************************************************
+ XMLElement class
+
+ Representation of an XML element with methods for getting/setting
+ attributes and generating "opening" and "closing" tags.
+ -------------------
+ Copyright:
+ (C) 2004 by Paul Giannaros <ceruleanblaze@gmail.com>
+ -------------------
+ Original author: Paul Giannaros <ceruleanblaze@gmail.com>
+******************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; version 2 of the License. *
+ * *
+ ***************************************************************************/
+
+#include "xmlelement.h"
+#include <qstringlist.h>
+#include <iostream>
+
+/// Constructors
+XMLElement::XMLElement() {
+ m_name = "";
+ m_attrmapper = AttributeToValueMap();
+}
+XMLElement::XMLElement(const QString &name) {
+ m_name = name;
+ m_attrmapper = AttributeToValueMap();
+}
+/// Destructor
+XMLElement::~XMLElement() {
+ return;
+}
+
+/// Copy constructor
+XMLElement::XMLElement(const XMLElement &element) {
+ m_attrmapper = element.m_attrmapper;
+ m_name = element.m_name;
+}
+
+/// Assignement operator
+XMLElement XMLElement::operator=(const XMLElement &element) {
+ m_attrmapper = element.m_attrmapper;
+ m_name = element.m_name;
+ return *this;
+}
+
+QString XMLElement::name() {
+ return m_name;
+}
+QString XMLElement::startTag() {
+ QString output = "<" + m_name + " ";
+ for(AttributeToValueMap::Iterator it = m_attrmapper.begin(); it != m_attrmapper.end(); ++it) {
+ output.append(it.key() + "=\"" + it.data() + "\" ");
+ }
+ output = output.left(output.length() - 1);
+ // Get rid of the space at the end and then append a '>'
+ output.append(">");
+ return output;
+}
+
+QString XMLElement::endTag() {
+ return "</" + m_name + ">";
+}
+
+void XMLElement::setAttribute(const QString &attr, const QString &value) {
+ m_attrmapper[attr] = value;
+}
+QString XMLElement::attribute(const QString &attr) {
+ return m_attrmapper[attr];
+}
+
+QString XMLElement::toQString() {
+ QString tag = startTag();
+ return tag.left(tag.length() - 1).right(tag.length() - 2);
+}
+
+XMLElement XMLElement::fromQString(const QString &str) {
+ QStringList sections = QStringList::split(" ", str);
+ QString tagname = sections[0];
+ XMLElement e(tagname.latin1());
+
+ sections.pop_front();
+ // Loop over the remaining strings which are attributes="values"
+ if(sections.count()) {
+ const int sectionsCount = sections.count();
+ for(int i = 0; i < sectionsCount; ++i) {
+ QStringList list = QStringList::split("=", sections[i]);
+ if(list.count() != 2) {
+ std::cerr << "XMLElement::fromQString: Cannot convert list: " << list.join("|") << ". `" << str << "' is not in valid format.\n";
+ return XMLElement(" ");
+ }
+ e.setAttribute(list[0], list[1].left(list[1].length() - 1).right(list[1].length() -2));
+ }
+ }
+ return e;
+}
+
diff --git a/kttsd/filters/xhtml2ssml/xmlelement.h b/kttsd/filters/xhtml2ssml/xmlelement.h
new file mode 100644
index 0000000..c78cd6f
--- /dev/null
+++ b/kttsd/filters/xhtml2ssml/xmlelement.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+ XMLElement class
+
+ Representation of an XML element with methods for getting/setting
+ attributes and generating "opening" and "closing" tags.
+ -------------------
+ Copyright:
+ (C) 2004 by Paul Giannaros <ceruleanblaze@gmail.com>
+ -------------------
+ Original author: Paul Giannaros <ceruleanblaze@gmail.com>
+******************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; version 2 of the License. *
+ * *
+ ***************************************************************************/
+
+
+#ifndef XMLELEMENT_H
+#define XMLELEMENT_H
+
+#include <qmap.h>
+
+class QString;
+
+typedef QMap<QString, QString> AttributeToValueMap;
+
+class XMLElement {
+public:
+ XMLElement();
+ XMLElement(const QString &name);
+ ~XMLElement();
+
+ /// Copy constructor
+ XMLElement(const XMLElement &);
+
+ /// Assignment operator
+ XMLElement operator=(const XMLElement &element);
+
+ /// Get the name of the tag (the text between the greater than and less than symbols).
+ /// @returns the name of the tag.
+ QString name();
+
+ /// set the name of the tag.
+ /// @param name the new name of the tag.
+ void setName(const QString &name);
+
+ /// Get a textual representation of the starting of the tag with all attributes and their values set out.
+ /// @verbatim
+ /// XMLElement element("elem");
+ /// element.addAttribute("foo", "bar");
+ /// element.startTag(); <- <elem foo="bar">
+ /// @endverbatim
+ /// @returns A textual representation of the start of the element.
+ QString startTag();
+
+ /// Get a textual representation of the closed tag that XMLElement represents.
+ /// @returns A textual representation of the closed tag represented by the XMLElement.
+ QString endTag();
+
+ /// Create an attribute and set its value.
+ /// @param attr The attribute.
+ /// @param value The value of the attribute.
+ void setAttribute(const QString &attr, const QString &value);
+
+ /// Get the value of an attribute.
+ /// @param attr The attribute.
+ /// @returns The value of @param attr
+ QString attribute(const QString &attr);
+
+ /// Convert to a QString.
+ /// Had issues with QMap and custom classes. For now you can just convert to/from QString and use
+ /// That as the key/value pair.
+ /// @returns A QString representation of the XMLAttribute.
+ QString toQString();
+
+ /// Create an XMLElement from a QString.
+ /// @param str The QString to convert from. Must be of the following syntax- "foo name=\"bar\""
+ static XMLElement fromQString(const QString &str);
+
+private:
+ /// The name of the tag.
+ QString m_name;
+ /// Attribute : value mappings.
+ AttributeToValueMap m_attrmapper;
+};
+
+#endif