Bug 683416 - C: Remove #ifdef TX_EXE codepaths now that it is never defined; r=khuey
authorEd Morley <bmo@edmorley.co.uk>
Thu, 01 Sep 2011 17:49:25 +0100
changeset 76400 962b157801a617de3a24c8b1139751d6d2bd83e5
parent 76399 0c97e9647100cd33a73725b06e66c175f06b3a69
child 76401 c2c5d46e9c3960b8d48ff288d01e9b955cabfff9
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewerskhuey
bugs683416
milestone9.0a1
Bug 683416 - C: Remove #ifdef TX_EXE codepaths now that it is never defined; r=khuey
content/xslt/src/base/txAtoms.h
content/xslt/src/base/txErrorObserver.h
content/xslt/src/base/txStringUtils.h
content/xslt/src/base/txURIUtils.cpp
content/xslt/src/base/txURIUtils.h
content/xslt/src/xml/txXMLParser.cpp
content/xslt/src/xml/txXMLParser.h
content/xslt/src/xml/txXMLUtils.h
content/xslt/src/xpath/txNameTest.cpp
content/xslt/src/xpath/txXPathNode.h
content/xslt/src/xpath/txXPathTreeWalker.h
content/xslt/src/xslt/txEXSLTFunctions.cpp
content/xslt/src/xslt/txXMLEventHandler.h
content/xslt/src/xslt/txXPathResultComparator.cpp
content/xslt/src/xslt/txXPathResultComparator.h
content/xslt/src/xslt/txXSLTPatterns.cpp
content/xslt/src/xslt/txXSLTProcessor.cpp
parser/expat/lib/xmlparse.c
--- a/content/xslt/src/base/txAtoms.h
+++ b/content/xslt/src/base/txAtoms.h
@@ -34,80 +34,15 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef TRANSFRMX_ATOMS_H
 #define TRANSFRMX_ATOMS_H
 
-#ifndef TX_EXE
-
 #include "nsGkAtoms.h"
 typedef class nsGkAtoms txXPathAtoms;
 typedef class nsGkAtoms txXMLAtoms;
 typedef class nsGkAtoms txXSLTAtoms;
 typedef class nsGkAtoms txHTMLAtoms;
 
-#else
-
-class nsIAtom;
-
-/*
- * Declare all atoms
- *
- * The atom names and values are stored in tx*AtomList.h and
- * are brought to you by the magic of C preprocessing.
- * Add new atoms to tx*AtomList.h and all support logic will
- * be auto-generated.
- */
-
-#define DOM_ATOMS                               \
-TX_ATOM(comment, "#comment")                    \
-TX_ATOM(document, "#document")                  \
-TX_ATOM(text, "#text")
-
-#define XML_ATOMS             \
-TX_ATOM(_empty, "")           \
-TX_ATOM(base, "base")         \
-TX_ATOM(_default, "default")  \
-TX_ATOM(lang, "lang")         \
-TX_ATOM(preserve, "preserve") \
-TX_ATOM(space, "space")       \
-TX_ATOM(xml, "xml")           \
-TX_ATOM(xmlns, "xmlns")       \
-DOM_ATOMS
-
-#define TX_ATOM(_name, _value) static nsIAtom* _name;
-
-class txXMLAtoms
-{
-public:
-    static void init();
-XML_ATOMS
-};
-
-class txXPathAtoms
-{
-public:
-    static void init();
-#include "txXPathAtomList.h"
-};
-
-class txXSLTAtoms
-{
-public:
-    static void init();
-#include "txXSLTAtomList.h"
-};
-
-class txHTMLAtoms
-{
-public:
-    static void init();
-#include "txHTMLAtomList.h"
-};
-
-#undef TX_ATOM
-
 #endif
-
-#endif
--- a/content/xslt/src/base/txErrorObserver.h
+++ b/content/xslt/src/base/txErrorObserver.h
@@ -35,19 +35,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef MITRE_ERROROBSERVER_H
 #define MITRE_ERROROBSERVER_H
 
 #include "txCore.h"
-#ifdef TX_EXE
-#include <iostream.h>
-#endif
 
 /**
  * A simple interface for observing errors
 **/
 class ErrorObserver {
 
 public:
 
@@ -69,44 +66,9 @@ public:
     {
         receiveError(errorMessage, NS_ERROR_FAILURE);
     }
 
         
 
 }; //-- ErrorObserver
 
-#ifdef TX_EXE
-/**
- * A simple ErrorObserver which allows printing error messages to a stream
-**/
-class SimpleErrorObserver : public ErrorObserver {
-
-public:
-
-    /**
-     * Creates a new SimpleErrorObserver.
-     * All errors will be printed to the console (cout).
-    **/
-    SimpleErrorObserver();
-
-    /**
-     * Creates a new SimpleErrorObserver.
-     * All errors will be printed to the given ostream.
-    **/
-    SimpleErrorObserver(ostream& errStream);
-
-    /**
-     *  Notifies this Error observer of a new error aRes
-    **/
-    void receiveError(const nsAString& errorMessage, nsresult aRes);
-
-    virtual void suppressWarnings(MBool suppress);
-
-private:
-
-    ostream* errStream;
-    MBool hideWarnings;
-}; //-- SimpleErrorObserver
 #endif
-
-#endif
-
--- a/content/xslt/src/base/txStringUtils.h
+++ b/content/xslt/src/base/txStringUtils.h
@@ -37,50 +37,31 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef txStringUtils_h__
 #define txStringUtils_h__
 
 #include "nsAString.h"
 #include "nsIAtom.h"
+#include "nsUnicharUtils.h"
+
+#define TX_ToLowerCase ToLowerCase
+
+typedef nsCaseInsensitiveStringComparator txCaseInsensitiveStringComparator;
 
 /**
  * Check equality between a string and an atom containing ASCII.
  */
 inline PRBool
 TX_StringEqualsAtom(const nsASingleFragmentString& aString, nsIAtom* aAtom)
 {
   return aAtom->Equals(aString);
 }
 
-#ifndef TX_EXE
-
-#include "nsUnicharUtils.h"
-typedef nsCaseInsensitiveStringComparator txCaseInsensitiveStringComparator;
-
-#define TX_ToLowerCase ToLowerCase
-
-#else
-
-// These only work for ASCII ranges!
-
-class txCaseInsensitiveStringComparator
-: public nsStringComparator
-{
-public:
-  virtual int operator()(const char_type*, const char_type*, PRUint32 aLength) const;
-  virtual int operator()(char_type, char_type) const;
-};
-
-void TX_ToLowerCase(nsAString& aString);
-void TX_ToLowerCase(const nsAString& aSource, nsAString& aDest);
-
-#endif
-
 inline already_AddRefed<nsIAtom>
 TX_ToLowerCaseAtom(nsIAtom* aAtom)
 {
   nsAutoString str;
   aAtom->ToString(str);
   TX_ToLowerCase(str);
   return do_GetAtom(str);
 }
--- a/content/xslt/src/base/txURIUtils.cpp
+++ b/content/xslt/src/base/txURIUtils.cpp
@@ -33,180 +33,54 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "txURIUtils.h"
-
-#ifndef TX_EXE
 #include "nsNetUtil.h"
 #include "nsIAttribute.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
 #include "nsIContent.h"
 #include "nsIPrincipal.h"
 #include "nsINodeInfo.h"
-#endif
 
 /**
  * URIUtils
  * A set of utilities for handling URIs
 **/
 
-#ifdef TX_EXE
-//- Constants -/
-
-const char   URIUtils::HREF_PATH_SEP  = '/';
-
-/**
- * Implementation of utility functions for parsing URLs.
- * Just file paths for now.
- */
-void
-txParsedURL::init(const nsAFlatString& aSpec)
-{
-    mPath.Truncate();
-    mName.Truncate();
-    mRef.Truncate();
-    PRUint32 specLength = aSpec.Length();
-    if (!specLength) {
-        return;
-    }
-    const PRUnichar* start = aSpec.get();
-    const PRUnichar* end = start + specLength;
-    const PRUnichar* c = end - 1;
-
-    // check for #ref
-    for (; c >= start; --c) {
-        if (*c == '#') {
-            // we could eventually unescape this, too.
-            mRef = Substring(c + 1, end);
-            end = c;
-            --c;
-            if (c == start) {
-                // we're done,
-                return;
-            }
-            break;
-        }
-    }
-    for (c = end - 1; c >= start; --c) {
-        if (*c == '/') {
-            mName = Substring(c + 1, end);
-            mPath = Substring(start, c + 1);
-            return;
-        }
-    }
-    mName = Substring(start, end);
-}
-
-void
-txParsedURL::resolve(const txParsedURL& aRef, txParsedURL& aDest)
-{
-    /*
-     * No handling of absolute URLs now.
-     * These aren't really URLs yet, anyway, but paths with refs
-     */
-    aDest.mPath = mPath + aRef.mPath;
-
-    if (aRef.mName.IsEmpty() && aRef.mPath.IsEmpty()) {
-        // the relative URL is just a fragment identifier
-        aDest.mName = mName;
-        if (aRef.mRef.IsEmpty()) {
-            // and not even that, keep the base ref
-            aDest.mRef = mRef;
-            return;
-        }
-        aDest.mRef = aRef.mRef;
-        return;
-    }
-    aDest.mName = aRef.mName;
-    aDest.mRef = aRef.mRef;
-}
-
-/**
- * Returns an InputStream for the file represented by the href
- * argument
- * @param href the href of the file to get the input stream for.
- * @return an InputStream to the desired resource
- * @exception java.io.FileNotFoundException when the file could not be
- * found
-**/
-istream* URIUtils::getInputStream(const nsAString& href, nsAString& errMsg)
-{
-    return new ifstream(NS_LossyConvertUTF16toASCII(href).get(), ios::in);
-} //-- getInputStream
-
-/**
-    * Returns the document base of the href argument
-    * @return the document base of the given href
-**/
-void URIUtils::getDocumentBase(const nsAFlatString& href, nsAString& dest)
-{
-    if (href.IsEmpty()) {
-        return;
-    }
-
-    nsAFlatString::const_char_iterator temp;
-    href.BeginReading(temp);
-    PRUint32 iter = href.Length();
-    while (iter > 0) {
-        if (temp[--iter] == HREF_PATH_SEP) {
-            dest.Append(StringHead(href, iter));
-            break;
-        }
-    }
-}
-#endif
-
 /**
  * Resolves the given href argument, using the given documentBase
  * if necessary.
  * The new resolved href will be appended to the given dest String
 **/
 void URIUtils::resolveHref(const nsAString& href, const nsAString& base,
                            nsAString& dest) {
     if (base.IsEmpty()) {
         dest.Append(href);
         return;
     }
     if (href.IsEmpty()) {
         dest.Append(base);
         return;
     }
-
-#ifndef TX_EXE
     nsCOMPtr<nsIURI> pURL;
     nsAutoString resultHref;
     nsresult result = NS_NewURI(getter_AddRefs(pURL), base);
     if (NS_SUCCEEDED(result)) {
         NS_MakeAbsoluteURI(resultHref, href, pURL);
         dest.Append(resultHref);
     }
-#else
-    nsAutoString documentBase;
-    getDocumentBase(PromiseFlatString(base), documentBase);
-
-    //-- join document base + href
-    if (!documentBase.IsEmpty()) {
-        dest.Append(documentBase);
-        if (documentBase.CharAt(documentBase.Length()-1) != HREF_PATH_SEP)
-            dest.Append(PRUnichar(HREF_PATH_SEP));
-    }
-    dest.Append(href);
-
-#endif
 } //-- resolveHref
 
-#ifndef TX_EXE
-
 // static
 void
 URIUtils::ResetWithSource(nsIDocument *aNewDoc, nsIDOMNode *aSourceNode)
 {
     nsCOMPtr<nsINode> node = do_QueryInterface(aSourceNode);
     if (!node) {
         // XXXbz passing nsnull as the first arg to Reset is illegal
         aNewDoc->Reset(nsnull, nsnull);
@@ -240,10 +114,8 @@ URIUtils::ResetWithSource(nsIDocument *a
     aNewDoc->SetPrincipal(sourcePrincipal);
     aNewDoc->SetBaseURI(sourceDoc->GetDocBaseURI());
 
     // Copy charset
     aNewDoc->SetDocumentCharacterSetSource(
           sourceDoc->GetDocumentCharacterSetSource());
     aNewDoc->SetDocumentCharacterSet(sourceDoc->GetDocumentCharacterSet());
 }
-
-#endif /* TX_EXE */
--- a/content/xslt/src/base/txURIUtils.h
+++ b/content/xslt/src/base/txURIUtils.h
@@ -34,72 +34,33 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef TRANSFRMX_URIUTILS_H
 #define TRANSFRMX_URIUTILS_H
 
 #include "txCore.h"
-#ifdef TX_EXE
-#include <fstream.h>
-#include <iostream.h>
-#include "nsString.h"
-#else
+
 class nsIDocument;
 class nsIDOMNode;
 
-#endif
-
 /**
  * A utility class for URI handling
  * Not yet finished, only handles file URI at this point
 **/
 
-#ifdef TX_EXE
-class txParsedURL
-{
-public:
-    void init(const nsAFlatString& aSpec);
-    void resolve(const txParsedURL& aRef, txParsedURL& aDest);
-    void getFile(nsString& aResult) const
-    {
-        aResult = mPath + mName;
-    }
-    nsString mPath, mName, mRef;
-};
-#endif
-
 class URIUtils {
 public:
 
-#ifdef TX_EXE
-    /**
-     * the path separator for an URI
-    **/
-    static const char HREF_PATH_SEP;
-
-    static istream* getInputStream
-        (const nsAString& href, nsAString& errMsg);
-
-    /**
-     * Returns the document base of the href argument
-     * The document base will be appended to the given dest String
-    **/
-    static void getDocumentBase(const nsAFlatString& href, nsAString& dest);
-
-#else /* TX_EXE */
-
     /**
      * Reset the given document with the document of the source node
      */
     static void ResetWithSource(nsIDocument *aNewDoc, nsIDOMNode *aSourceNode);
 
-#endif /* TX_EXE */
-
     /**
      * Resolves the given href argument, using the given documentBase
      * if necessary.
      * The new resolved href will be appended to the given dest String
     **/
     static void resolveHref(const nsAString& href, const nsAString& base,
                             nsAString& dest);
 }; //-- URIUtils
--- a/content/xslt/src/xml/txXMLParser.cpp
+++ b/content/xslt/src/xml/txXMLParser.cpp
@@ -35,68 +35,28 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "txXMLParser.h"
 #include "txURIUtils.h"
 #include "txXPathTreeWalker.h"
 
-#ifndef TX_EXE
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
 #include "nsSyncLoadService.h"
 #include "nsNetUtil.h"
 #include "nsIPrincipal.h"
-#else
-#include "expat_config.h"
-#include "expat.h"
-#include "txXMLUtils.h"
-#endif
-
-#ifdef TX_EXE
-/**
- *  Implementation of an In-Memory DOM based XML parser.  The actual XML
- *  parsing is provided by EXPAT.
- */
-class txXMLParser
-{
-  public:
-    nsresult parse(istream& aInputStream, const nsAString& aUri,
-                   txXPathNode** aResultDoc);
-    const nsAString& getErrorString();
-
-    /**
-     * Expat handlers
-     */
-    int StartElement(const XML_Char *aName, const XML_Char **aAtts);
-    int EndElement(const XML_Char* aName);
-    void CharacterData(const XML_Char* aChars, int aLength);
-    void Comment(const XML_Char* aChars);
-    int ProcessingInstruction(const XML_Char *aTarget, const XML_Char *aData);
-    int ExternalEntityRef(const XML_Char *aContext, const XML_Char *aBase,
-                          const XML_Char *aSystemId,
-                          const XML_Char *aPublicId);
-
-  protected:
-    void createErrorString();
-    nsString  mErrorString;
-    Document* mDocument;
-    Node*  mCurrentNode;
-    XML_Parser mExpatParser;
-};
-#endif
 
 nsresult
 txParseDocumentFromURI(const nsAString& aHref, const txXPathNode& aLoader,
                        nsAString& aErrMsg, txXPathNode** aResult)
 {
     NS_ENSURE_ARG_POINTER(aResult);
     *aResult = nsnull;
-#ifndef TX_EXE
     nsCOMPtr<nsIURI> documentURI;
     nsresult rv = NS_NewURI(getter_AddRefs(documentURI), aHref);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsIDocument* loaderDocument = txXPathNativeNode::getDocument(aLoader);
 
     nsCOMPtr<nsILoadGroup> loadGroup = loaderDocument->GetDocumentLoadGroup();
 
@@ -118,316 +78,9 @@ txParseDocumentFromURI(const nsAString& 
 
     *aResult = txXPathNativeNode::createXPathNode(theDocument);
     if (!*aResult) {
         NS_RELEASE(theDocument);
         return NS_ERROR_FAILURE;
     }
 
     return NS_OK;
-#else
-    istream* xslInput = URIUtils::getInputStream(aHref, aErrMsg);
-    if (!xslInput) {
-        return NS_ERROR_FAILURE;
-    }
-    return txParseFromStream(*xslInput, aHref, aErrMsg, aResult);
-#endif
 }
-
-#ifdef TX_EXE
-nsresult
-txParseFromStream(istream& aInputStream, const nsAString& aUri,
-                  nsAString& aErrorString, txXPathNode** aResult)
-{
-    NS_ENSURE_ARG_POINTER(aResult);
-    txXMLParser parser;
-    nsresult rv = parser.parse(aInputStream, aUri, aResult);
-    aErrorString = parser.getErrorString();
-    return rv;
-}
-
-/**
- * expat C stub handlers
- */
-
-// shortcut macro for redirection into txXMLParser method calls
-#define TX_XMLPARSER(_userData) static_cast<txXMLParser*>(_userData)
-#define TX_ENSURE_DATA(_userData)                       \
-  PR_BEGIN_MACRO                                        \
-    if (!aUserData) {                                   \
-        NS_WARNING("no userData in comment handler");   \
-        return;                                         \
-    }                                                   \
-  PR_END_MACRO
-
-static void
-startElement(void *aUserData, const XML_Char *aName, const XML_Char **aAtts)
-{
-    TX_ENSURE_DATA(aUserData);
-    TX_XMLPARSER(aUserData)->StartElement(aName, aAtts);
-}
-
-static void
-endElement(void *aUserData, const XML_Char* aName)
-{
-    TX_ENSURE_DATA(aUserData);
-    TX_XMLPARSER(aUserData)->EndElement(aName);
-}
-
-static void
-charData(void* aUserData, const XML_Char* aChars, int aLength)
-{
-    TX_ENSURE_DATA(aUserData);
-    TX_XMLPARSER(aUserData)->CharacterData(aChars, aLength);
-}
-
-static void
-commentHandler(void* aUserData, const XML_Char* aChars)
-{
-    TX_ENSURE_DATA(aUserData);
-    TX_XMLPARSER(aUserData)->Comment(aChars);
-}
-
-static void
-piHandler(void *aUserData, const XML_Char *aTarget, const XML_Char *aData)
-{
-    TX_ENSURE_DATA(aUserData);
-    TX_XMLPARSER(aUserData)->ProcessingInstruction(aTarget, aData);
-}
-
-static int
-externalEntityRefHandler(XML_Parser aParser,
-                         const XML_Char *aContext,
-                         const XML_Char *aBase,
-                         const XML_Char *aSystemId,
-                         const XML_Char *aPublicId)
-{
-    // aParser is aUserData is the txXMLParser,
-    // we set that in txXMLParser::parse
-    NS_ENSURE_TRUE(aParser, XML_ERROR_NONE);
-    return ((txXMLParser*)aParser)->ExternalEntityRef(aContext, aBase,
-                                                      aSystemId, aPublicId);
-}
-
-
-/**
- *  Parses the given input stream and returns a DOM Document.
- *  A NULL pointer will be returned if errors occurred
- */
-nsresult
-txXMLParser::parse(istream& aInputStream, const nsAString& aUri,
-                   txXPathNode** aResultDoc)
-{
-    mErrorString.Truncate();
-    *aResultDoc = nsnull;
-    if (!aInputStream) {
-        mErrorString.AppendLiteral("unable to parse xml: invalid or unopen stream encountered.");
-        return NS_ERROR_FAILURE;
-    }
-
-    static const XML_Memory_Handling_Suite memsuite = {
-        (void *(*)(size_t))PR_Malloc,
-        (void *(*)(void *, size_t))PR_Realloc,
-        PR_Free
-    };
-    static const PRUnichar expatSeparator = kExpatSeparatorChar;
-    mExpatParser = XML_ParserCreate_MM(nsnull, &memsuite, &expatSeparator);
-    if (!mExpatParser) {
-        return NS_ERROR_OUT_OF_MEMORY;
-    }
-    mDocument = new Document();
-    if (!mDocument) {
-        XML_ParserFree(mExpatParser);
-        return NS_ERROR_OUT_OF_MEMORY;
-    }
-    mDocument->documentBaseURI = aUri;
-    mCurrentNode = mDocument;
-
-    XML_SetReturnNSTriplet(mExpatParser, XML_TRUE);
-    XML_SetUserData(mExpatParser, this);
-    XML_SetElementHandler(mExpatParser, startElement, endElement);
-    XML_SetCharacterDataHandler(mExpatParser, charData);
-    XML_SetProcessingInstructionHandler(mExpatParser, piHandler);
-    XML_SetCommentHandler(mExpatParser, commentHandler);
-#ifdef XML_DTD
-    XML_SetParamEntityParsing(mExpatParser, XML_PARAM_ENTITY_PARSING_ALWAYS);
-#endif
-    XML_SetExternalEntityRefHandler(mExpatParser, externalEntityRefHandler);
-    XML_SetExternalEntityRefHandlerArg(mExpatParser, this);
-    XML_SetBase(mExpatParser,
-                (const XML_Char*)(PromiseFlatString(aUri).get()));
-
-    const int bufferSize = 1024;
-    char buf[bufferSize];
-    PRBool done;
-    do {
-        aInputStream.read(buf, bufferSize);
-        done = aInputStream.eof();
-
-        if (!XML_Parse(mExpatParser, buf, aInputStream.gcount(), done)) {
-            createErrorString();
-            done = MB_TRUE;
-            delete mDocument;
-            mDocument = nsnull;
-        }
-    } while (!done);
-    aInputStream.clear();
-
-    // clean up
-    XML_ParserFree(mExpatParser);
-    // ownership to the caller
-    *aResultDoc = txXPathNativeNode::createXPathNode(mDocument);
-    mDocument = nsnull;
-    return *aResultDoc ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
-}
-
-const nsAString&
-txXMLParser::getErrorString()
-{
-    return mErrorString;
-}
-
-
-int
-txXMLParser::StartElement(const XML_Char *aName, const XML_Char **aAtts)
-{
-    nsCOMPtr<nsIAtom> prefix, localName;
-    PRInt32 nsID;
-    XMLUtils::splitExpatName(aName, getter_AddRefs(prefix),
-                             getter_AddRefs(localName), &nsID);
-    Element* newElement = mDocument->createElementNS(prefix, localName, nsID);
-    if (!newElement) {
-        return XML_ERROR_NO_MEMORY;
-    }
-
-    const XML_Char** theAtts = aAtts;
-    while (*theAtts) {
-        XMLUtils::splitExpatName(*theAtts++, getter_AddRefs(prefix),
-                                 getter_AddRefs(localName), &nsID);
-        nsDependentString attValue(*theAtts++);
-        nsresult rv = newElement->appendAttributeNS(prefix, localName, nsID,
-                                                    attValue);
-        if (NS_FAILED(rv)) {
-            return XML_ERROR_NO_MEMORY;
-        }
-    }
-
-    int idx;
-    if ((idx = XML_GetIdAttributeIndex(mExpatParser)) > -1) {
-        nsDependentString idName((const PRUnichar*)*(aAtts + idx));
-        nsDependentString idValue((const PRUnichar*)*(aAtts + idx + 1));
-        // make sure IDs are unique
-        if (!idValue.IsEmpty()) {
-            mDocument->setElementID(idValue, newElement);
-        }
-    }
-    mCurrentNode->appendChild(newElement);
-    mCurrentNode = newElement;
-
-    return XML_ERROR_NONE;
-}
-
-int
-txXMLParser::EndElement(const XML_Char* aName)
-{
-    if (mCurrentNode->getParentNode()) {
-        mCurrentNode = mCurrentNode->getParentNode();
-    }
-    return XML_ERROR_NONE;
-}
-
-void
-txXMLParser::CharacterData(const XML_Char* aChars, int aLength)
-{
-    Node* prevSib = mCurrentNode->getLastChild();
-    const PRUnichar* pChars = static_cast<const PRUnichar*>(aChars);
-    if (prevSib && prevSib->getNodeType() == Node::TEXT_NODE) {
-        static_cast<NodeDefinition*>(prevSib)->appendData(pChars, aLength);
-    }
-    else {
-        // aChars is not null-terminated so we use Substring here.
-        Node* node = mDocument->createTextNode(Substring(pChars,
-                                                         pChars + aLength));
-        mCurrentNode->appendChild(node);
-    }
-}
-
-void
-txXMLParser::Comment(const XML_Char* aChars)
-{
-    Node* node = mDocument->createComment(
-        nsDependentString(static_cast<const PRUnichar*>(aChars)));
-    mCurrentNode->appendChild(node);
-}
-
-int
-txXMLParser::ProcessingInstruction(const XML_Char *aTarget,
-                                   const XML_Char *aData)
-{
-    nsCOMPtr<nsIAtom> target = do_GetAtom(aTarget);
-    nsDependentString data((const PRUnichar*)aData);
-    Node* node = mDocument->createProcessingInstruction(target, data);
-    mCurrentNode->appendChild(node);
-
-    return XML_ERROR_NONE;
-}
-
-int
-txXMLParser::ExternalEntityRef(const XML_Char *aContext,
-                               const XML_Char *aBase,
-                               const XML_Char *aSystemId,
-                               const XML_Char *aPublicId)
-{
-    if (aPublicId) {
-        // not supported, this is "http://some.site.net/foo.dtd" stuff
-        return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
-    }
-    nsAutoString absUrl;
-    URIUtils::resolveHref(nsDependentString((PRUnichar*)aSystemId),
-                          nsDependentString((PRUnichar*)aBase), absUrl);
-    istream* extInput = URIUtils::getInputStream(absUrl, mErrorString);
-    if (!extInput) {
-        return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
-    }
-    XML_Parser parent = mExpatParser;
-    mExpatParser = 
-        XML_ExternalEntityParserCreate(mExpatParser, aContext, nsnull);
-    if (!mExpatParser) {
-        mExpatParser = parent;
-        delete extInput;
-        return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
-    }
-    XML_SetBase(mExpatParser, absUrl.get());
-
-    const int bufSize = 1024;
-    char buffer[bufSize];
-    int result;
-    PRBool done;
-    do {
-        extInput->read(buffer, bufSize);
-        done = extInput->eof();
-        if (!(result =
-              XML_Parse(mExpatParser, buffer,  extInput->gcount(), done))) {
-            createErrorString();
-            mErrorString.Append(PRUnichar('\n'));
-            done = MB_TRUE;
-        }
-    } while (!done);
-
-    delete extInput;
-    XML_ParserFree(mExpatParser);
-
-    mExpatParser = parent;
-
-    return result;
-}
-
-void
-txXMLParser::createErrorString()
-{
-    XML_Error errCode = XML_GetErrorCode(mExpatParser);
-    mErrorString.AppendWithConversion(XML_ErrorString(errCode));
-    mErrorString.AppendLiteral(" at line ");
-    mErrorString.AppendInt(XML_GetCurrentLineNumber(mExpatParser));
-    mErrorString.AppendLiteral(" in ");
-    mErrorString.Append((const PRUnichar*)XML_GetBase(mExpatParser));
-}
-#endif
--- a/content/xslt/src/xml/txXMLParser.h
+++ b/content/xslt/src/xml/txXMLParser.h
@@ -36,36 +36,24 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef MITRE_XMLPARSER_H
 #define MITRE_XMLPARSER_H
 
 #include "txCore.h"
 
-#ifdef TX_EXE
-#include <iostream.h>
-#endif
-
 class txXPathNode;
 
 /**
  * API to load XML files into DOM datastructures.
  * Parsing is either done by expat, or by expat via the syncloaderservice
  */
 
 /**
  * Parse a document from the aHref location, with referrer URI on behalf
  * of the document aLoader.
  */
 extern "C" nsresult
 txParseDocumentFromURI(const nsAString& aHref, const txXPathNode& aLoader,
                        nsAString& aErrMsg, txXPathNode** aResult);
 
-#ifdef TX_EXE
-/**
- * Parse a document from the given stream
- */
-extern "C" nsresult
-txParseFromStream(istream& aInputStream, const nsAString& aUri,
-                  nsAString& aErrorString, txXPathNode** aResult);
 #endif
-#endif
--- a/content/xslt/src/xml/txXMLUtils.h
+++ b/content/xslt/src/xml/txXMLUtils.h
@@ -43,21 +43,18 @@
 #ifndef MITRE_XMLUTILS_H
 #define MITRE_XMLUTILS_H
 
 #include "txCore.h"
 #include "nsCOMPtr.h"
 #include "nsDependentSubstring.h"
 #include "nsIAtom.h"
 #include "txXPathNode.h"
-
-#ifndef TX_EXE
 #include "nsIParserService.h"
 #include "nsContentUtils.h"
-#endif
 
 #define kExpatSeparatorChar 0xFFFF
 
 class nsIAtom;
 class txNamespaceMap;
 
 class txExpandedName {
 public:
@@ -109,23 +106,16 @@ public:
         return ((mLocalName != rhs.mLocalName) ||
                 (mNamespaceID != rhs.mNamespaceID));
     }
 
     PRInt32 mNamespaceID;
     nsCOMPtr<nsIAtom> mLocalName;
 };
 
-#ifdef TX_EXE
-extern "C" int MOZ_XMLCheckQName(const char* ptr, const char* end,
-                                 int ns_aware, const char** colon);
-extern "C" int MOZ_XMLIsLetter(const char* ptr);
-extern "C" int MOZ_XMLIsNCNameChar(const char* ptr);
-#endif
-
 class XMLUtils {
 
 public:
     static nsresult splitExpatName(const PRUnichar *aExpatName,
                                    nsIAtom **aPrefix, nsIAtom **aLocalName,
                                    PRInt32* aNameSpaceID);
     static nsresult splitQName(const nsAString& aName, nsIAtom** aPrefix,
                                nsIAtom** aLocalName);
@@ -152,58 +142,36 @@ public:
     static void normalizePIValue(nsAString& attValue);
 
     /**
      * Returns true if the given string is a valid XML QName
      */
     static PRBool isValidQName(const nsAFlatString& aQName,
                                const PRUnichar** aColon)
     {
-#ifdef TX_EXE
-        const PRUnichar* end;
-        aQName.EndReading(end);
-
-        const char *colonPtr;
-        int result = MOZ_XMLCheckQName(reinterpret_cast<const char*>
-                                                       (aQName.get()),
-                                       reinterpret_cast<const char*>
-                                                       (end),
-                                       PR_TRUE, &colonPtr);
-        *aColon = reinterpret_cast<const PRUnichar*>(colonPtr);
-        return result == 0;
-#else
         nsIParserService* ps = nsContentUtils::GetParserService();
         return ps && NS_SUCCEEDED(ps->CheckQName(aQName, PR_TRUE, aColon));
-#endif
     }
 
     /**
      * Returns true if the given character represents an Alpha letter
      */
     static PRBool isLetter(PRUnichar aChar)
     {
-#ifdef TX_EXE
-        return MOZ_XMLIsLetter(reinterpret_cast<const char*>(&aChar));
-#else
         nsIParserService* ps = nsContentUtils::GetParserService();
         return ps && ps->IsXMLLetter(aChar);
-#endif
     }
 
     /**
      * Returns true if the given character is an allowable NCName character
      */
     static PRBool isNCNameChar(PRUnichar aChar)
     {
-#ifdef TX_EXE
-        return MOZ_XMLIsNCNameChar(reinterpret_cast<const char*>(&aChar));
-#else
         nsIParserService* ps = nsContentUtils::GetParserService();
         return ps && ps->IsXMLNCNameChar(aChar);
-#endif
     }
 
     /*
      * Walks up the document tree and returns true if the closest xml:space
      * attribute is "preserve"
      */
     static MBool getXMLSpacePreserve(const txXPathNode& aNode);
 };
--- a/content/xslt/src/xpath/txNameTest.cpp
+++ b/content/xslt/src/xpath/txNameTest.cpp
@@ -68,20 +68,18 @@ PRBool txNameTest::matches(const txXPath
     }
 
     // Totally wild?
     if (mLocalName == txXPathAtoms::_asterix && !mPrefix)
         return MB_TRUE;
 
     // Compare namespaces
     if (mNamespace != txXPathNodeUtils::getNamespaceID(aNode) 
-#ifndef TX_EXE
         && !(mNamespace == kNameSpaceID_None &&
              txXPathNodeUtils::isHTMLElementInHTMLDocument(aNode))
-#endif
        )
         return MB_FALSE;
 
     // Name wild?
     if (mLocalName == txXPathAtoms::_asterix)
         return MB_TRUE;
 
     // Compare local-names
--- a/content/xslt/src/xpath/txXPathNode.h
+++ b/content/xslt/src/xpath/txXPathNode.h
@@ -34,32 +34,24 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef txXPathNode_h__
 #define txXPathNode_h__
 
-#ifdef TX_EXE
-#include "txDOM.h"
-#else
 #include "nsAutoPtr.h"
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsIDOMNode.h"
 #include "nsINameSpaceManager.h"
 #include "nsContentUtils.h"
-#endif
 
-#ifdef TX_EXE
-typedef Node txXPathNodeType;
-#else
 typedef nsIDOMNode txXPathNodeType;
-#endif
 
 class txXPathNode
 {
 public:
     PRBool operator==(const txXPathNode& aNode) const;
     PRBool operator!=(const txXPathNode& aNode) const
     {
         return !(*this == aNode);
@@ -69,23 +61,16 @@ public:
 private:
     friend class txNodeSet;
     friend class txXPathNativeNode;
     friend class txXPathNodeUtils;
     friend class txXPathTreeWalker;
 
     txXPathNode(const txXPathNode& aNode);
 
-#ifdef TX_EXE
-    txXPathNode(NodeDefinition* aNode) : mInner(aNode)
-    {
-    }
-
-    NodeDefinition* mInner;
-#else
     txXPathNode(nsIDocument* aDocument) : mNode(aDocument),
                                           mRefCountRoot(0),
                                           mIndex(eDocument)
     {
         MOZ_COUNT_CTOR(txXPathNode);
     }
     txXPathNode(nsINode *aNode, PRUint32 aIndex, nsINode *aRoot)
         : mNode(aNode),
@@ -143,55 +128,42 @@ private:
     {
         eDocument = (1 << 30),
         eContent = eDocument - 1
     };
 
     nsINode* mNode;
     PRUint32 mRefCountRoot : 1;
     PRUint32 mIndex : 31;
-#endif
 };
 
 class txNamespaceManager
 {
 public:
     static PRInt32 getNamespaceID(const nsAString& aNamespaceURI);
     static nsresult getNamespaceURI(const PRInt32 aID, nsAString& aResult);
 };
 
 /* static */
 inline PRInt32
 txNamespaceManager::getNamespaceID(const nsAString& aNamespaceURI)
 {
-#ifdef TX_EXE
-    return txStandaloneNamespaceManager::getNamespaceID(aNamespaceURI);
-#else
     PRInt32 namespaceID = kNameSpaceID_Unknown;
     nsContentUtils::NameSpaceManager()->
         RegisterNameSpace(aNamespaceURI, namespaceID);
     return namespaceID;
-#endif
 }
 
 /* static */
 inline nsresult
 txNamespaceManager::getNamespaceURI(const PRInt32 aID, nsAString& aResult)
 {
-#ifdef TX_EXE
-    return txStandaloneNamespaceManager::getNamespaceURI(aID, aResult);
-#else
     return nsContentUtils::NameSpaceManager()->
         GetNameSpaceURI(aID, aResult);
-#endif
 }
 
 inline PRBool
 txXPathNode::operator==(const txXPathNode& aNode) const
 {
-#ifdef TX_EXE
-    return (mInner == aNode.mInner);
-#else
     return mIndex == aNode.mIndex && mNode == aNode.mNode;
-#endif
 }
 
 #endif /* txXPathNode_h__ */
--- a/content/xslt/src/xpath/txXPathTreeWalker.h
+++ b/content/xslt/src/xpath/txXPathTreeWalker.h
@@ -36,22 +36,21 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef txXPathTreeWalker_h__
 #define txXPathTreeWalker_h__
 
 #include "txCore.h"
 #include "txXPathNode.h"
+#include "nsINodeInfo.h"
+#include "nsTArray.h"
 
 class nsIAtom;
-
-#ifndef TX_EXE
-#include "nsINodeInfo.h"
-#include "nsTArray.h"
+class nsIDOMDocument;
 
 class txUint32Array : public nsTArray<PRUint32>
 {
 public:
     PRBool AppendValue(PRUint32 aValue)
     {
         return AppendElement(aValue) != nsnull;
     }
@@ -63,19 +62,16 @@ public:
         return PR_TRUE;
     }
     PRUint32 ValueAt(PRUint32 aIndex) const
     {
         return (aIndex < Length()) ? ElementAt(aIndex) : 0;
     }
 };
 
-class nsIDOMDocument;
-#endif
-
 class txXPathTreeWalker
 {
 public:
     txXPathTreeWalker(const txXPathTreeWalker& aOther);
     explicit txXPathTreeWalker(const txXPathNode& aNode);
 
     PRBool getAttr(nsIAtom* aLocalName, PRInt32 aNSID, nsAString& aValue) const;
     PRInt32 getNamespaceID() const;
@@ -98,23 +94,21 @@ public:
 
     PRBool isOnNode(const txXPathNode& aNode) const;
 
     const txXPathNode& getCurrentPosition() const;
 
 private:
     txXPathNode mPosition;
 
-#ifndef TX_EXE
     PRBool moveToValidAttribute(PRUint32 aStartIndex);
     PRBool moveToSibling(PRInt32 aDir);
 
     PRUint32 mCurrentIndex;
     txUint32Array mDescendants;
-#endif
 };
 
 class txXPathNodeUtils
 {
 public:
     static PRBool getAttr(const txXPathNode& aNode, nsIAtom* aLocalName,
                           PRInt32 aNSID, nsAString& aValue);
     static already_AddRefed<nsIAtom> getLocalName(const txXPathNode& aNode);
@@ -139,40 +133,26 @@ public:
     static PRBool localNameEquals(const txXPathNode& aNode,
                                   nsIAtom* aLocalName);
     static PRBool isRoot(const txXPathNode& aNode);
     static PRBool isElement(const txXPathNode& aNode);
     static PRBool isAttribute(const txXPathNode& aNode);
     static PRBool isProcessingInstruction(const txXPathNode& aNode);
     static PRBool isComment(const txXPathNode& aNode);
     static PRBool isText(const txXPathNode& aNode);
-#ifndef TX_EXE
     static inline PRBool isHTMLElementInHTMLDocument(const txXPathNode& aNode)
     {
       if (!aNode.isContent()) {
         return PR_FALSE;
       }
       nsIContent* content = aNode.Content();
       return content->IsHTML() && content->IsInHTMLDocument();
     }
-#else
-private:
-    static void appendNodeValueHelper(NodeDefinition* aNode, nsAString& aResult);
-#endif
 };
 
-#ifdef TX_EXE
-class txXPathNativeNode
-{
-public:
-    static txXPathNode* createXPathNode(Node* aNode);
-    static nsresult getElement(const txXPathNode& aNode, Element** aResult);
-    static nsresult getDocument(const txXPathNode& aNode, Document** aResult);
-};
-#else
 class txXPathNativeNode
 {
 public:
     static txXPathNode* createXPathNode(nsIDOMNode* aNode,
                                         PRBool aKeepRootAlive = PR_FALSE);
     static txXPathNode* createXPathNode(nsIContent* aContent,
                                         PRBool aKeepRootAlive = PR_FALSE);
     static txXPathNode* createXPathNode(nsIDOMDocument* aDocument);
@@ -185,18 +165,16 @@ public:
     }
     static void release(const txXPathNode& aNode)
     {
         nsINode *node = aNode.mNode;
         NS_RELEASE(node);
     }
 };
 
-#endif
-
 inline const txXPathNode&
 txXPathTreeWalker::getCurrentPosition() const
 {
     return mPosition;
 }
 
 inline PRBool
 txXPathTreeWalker::getAttr(nsIAtom* aLocalName, PRInt32 aNSID,
@@ -221,19 +199,16 @@ inline void
 txXPathTreeWalker::getNodeName(nsAString& aName) const
 {
     txXPathNodeUtils::getNodeName(mPosition, aName);
 }
 
 inline void
 txXPathTreeWalker::moveTo(const txXPathTreeWalker& aWalker)
 {
-#ifdef TX_EXE
-    mPosition.mInner = aWalker.mPosition.mInner;
-#else
     nsINode *root = nsnull;
     if (mPosition.mRefCountRoot) {
         root = mPosition.Root();
     }
     mPosition.mIndex = aWalker.mPosition.mIndex;
     mPosition.mRefCountRoot = aWalker.mPosition.mRefCountRoot;
     mPosition.mNode = aWalker.mPosition.mNode;
     nsINode *newRoot = nsnull;
@@ -242,135 +217,95 @@ txXPathTreeWalker::moveTo(const txXPathT
     }
     if (root != newRoot) {
         NS_IF_ADDREF(newRoot);
         NS_IF_RELEASE(root);
     }
 
     mCurrentIndex = aWalker.mCurrentIndex;
     mDescendants.Clear();
-#endif
 }
 
 inline PRBool
 txXPathTreeWalker::isOnNode(const txXPathNode& aNode) const
 {
     return (mPosition == aNode);
 }
 
 /* static */
 inline PRInt32
 txXPathNodeUtils::getUniqueIdentifier(const txXPathNode& aNode)
 {
-#ifdef TX_EXE
-    return NS_PTR_TO_INT32(aNode.mInner);
-#else
     NS_PRECONDITION(!aNode.isAttribute(),
                     "Not implemented for attributes.");
     return NS_PTR_TO_INT32(aNode.mNode);
-#endif
 }
 
 /* static */
 inline void
 txXPathNodeUtils::release(txXPathNode* aNode)
 {
-#ifdef TX_EXE
-    delete aNode->mInner;
-#else
     NS_RELEASE(aNode->mNode);
-#endif
 }
 
 /* static */
 inline PRBool
 txXPathNodeUtils::localNameEquals(const txXPathNode& aNode,
                                   nsIAtom* aLocalName)
 {
-#ifdef TX_EXE
-    nsCOMPtr<nsIAtom> localName;
-    aNode.mInner->getLocalName(getter_AddRefs(localName));
-
-    return localName == aLocalName;
-#else
     if (aNode.isContent() &&
         aNode.Content()->IsElement()) {
         return aNode.Content()->NodeInfo()->Equals(aLocalName);
     }
 
     nsCOMPtr<nsIAtom> localName = txXPathNodeUtils::getLocalName(aNode);
 
     return localName == aLocalName;
-#endif
 }
 
 /* static */
 inline PRBool
 txXPathNodeUtils::isRoot(const txXPathNode& aNode)
 {
-#ifdef TX_EXE
-    return aNode.mInner->getNodeType() == Node::DOCUMENT_NODE;
-#else
     return !aNode.isAttribute() && !aNode.mNode->GetNodeParent();
-#endif
 }
 
 /* static */
 inline PRBool
 txXPathNodeUtils::isElement(const txXPathNode& aNode)
 {
-#ifdef TX_EXE
-    return aNode.mInner->getNodeType() == Node::ELEMENT_NODE;
-#else
     return aNode.isContent() &&
            aNode.Content()->IsElement();
-#endif
 }
 
 
 /* static */
 inline PRBool
 txXPathNodeUtils::isAttribute(const txXPathNode& aNode)
 {
-#ifdef TX_EXE
-    return aNode.mInner->getNodeType() == Node::ATTRIBUTE_NODE;
-#else
     return aNode.isAttribute();
-#endif
 }
 
 /* static */
 inline PRBool
 txXPathNodeUtils::isProcessingInstruction(const txXPathNode& aNode)
 {
-#ifdef TX_EXE
-    return aNode.mInner->getNodeType() == Node::PROCESSING_INSTRUCTION_NODE;
-#else
     return aNode.isContent() &&
            aNode.Content()->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION);
-#endif
 }
 
 /* static */
 inline PRBool
 txXPathNodeUtils::isComment(const txXPathNode& aNode)
 {
-#ifdef TX_EXE
-    return aNode.mInner->getNodeType() == Node::COMMENT_NODE;
-#else
     return aNode.isContent() &&
            aNode.Content()->IsNodeOfType(nsINode::eCOMMENT);
-#endif
 }
 
 /* static */
 inline PRBool
 txXPathNodeUtils::isText(const txXPathNode& aNode)
 {
-#ifdef TX_EXE
-    return aNode.mInner->getNodeType() == Node::TEXT_NODE;
-#else
     return aNode.isContent() &&
            aNode.Content()->IsNodeOfType(nsINode::eTEXT);
-#endif
 }
 
 #endif /* txXPathTreeWalker_h__ */
--- a/content/xslt/src/xslt/txEXSLTFunctions.cpp
+++ b/content/xslt/src/xslt/txEXSLTFunctions.cpp
@@ -42,25 +42,22 @@
 #include "txExecutionState.h"
 #include "txExpr.h"
 #include "txIXPathContext.h"
 #include "txNodeSet.h"
 #include "txOutputFormat.h"
 #include "txRtfHandler.h"
 #include "txXPathTreeWalker.h"
 #include "nsPrintfCString.h"
-
-#ifndef TX_EXE
 #include "nsComponentManagerUtils.h"
 #include "nsContentCID.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsIContent.h"
 #include "nsIDOMDocumentFragment.h"
 #include "txMozillaXMLOutput.h"
-#endif
 
 class txStylesheetCompilerState;
 
 // ------------------------------------------------------------------
 // Utility functions
 // ------------------------------------------------------------------
 
 static nsresult
@@ -71,19 +68,16 @@ convertRtfToNode(txIEvalContext *aContex
     if (!es) {
         NS_ERROR("Need txExecutionState!");
 
         return NS_ERROR_UNEXPECTED;
     }
 
     const txXPathNode& document = es->getSourceDocument();
 
-#ifdef TX_EXE
-    return NS_ERROR_NOT_IMPLEMENTED;
-#else
     nsIDocument *doc = txXPathNativeNode::getDocument(document);
     nsCOMPtr<nsIDOMDocumentFragment> domFragment;
     nsresult rv = NS_NewDocumentFragment(getter_AddRefs(domFragment),
                                          doc->NodeInfoManager());
     NS_ENSURE_SUCCESS(rv, rv);
 
     txOutputFormat format;
     txMozillaXMLOutput mozHandler(&format, domFragment, PR_TRUE);
@@ -97,52 +91,46 @@ convertRtfToNode(txIEvalContext *aContex
     // The txResultTreeFragment will own this.
     const txXPathNode* node = txXPathNativeNode::createXPathNode(domFragment,
                                                                  PR_TRUE);
     NS_ENSURE_TRUE(node, NS_ERROR_OUT_OF_MEMORY);
 
     aRtf->setNode(node);
 
     return NS_OK;
-#endif
 }
 
 static nsresult
 createTextNode(txIEvalContext *aContext, nsString& aValue,
                txXPathNode* *aResult)
 {
     txExecutionState* es = 
         static_cast<txExecutionState*>(aContext->getPrivateContext());
     if (!es) {
         NS_ERROR("Need txExecutionState!");
 
         return NS_ERROR_UNEXPECTED;
     }
 
     const txXPathNode& document = es->getSourceDocument();
 
-#ifdef TX_EXE
-    return NS_ERROR_NOT_IMPLEMENTED;
-#else
     nsIDocument *doc = txXPathNativeNode::getDocument(document);
     nsCOMPtr<nsIContent> text;
     nsresult rv = NS_NewTextNode(getter_AddRefs(text), doc->NodeInfoManager());
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = text->SetText(aValue, PR_FALSE);
     NS_ENSURE_SUCCESS(rv, rv);
 
     *aResult = txXPathNativeNode::createXPathNode(text, PR_TRUE);
     NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
 
     return NS_OK;
-#endif
 }
 
-#ifndef TX_EXE
 static nsresult
 createDocFragment(txIEvalContext *aContext, nsIContent** aResult)
 {
     txExecutionState* es = 
         static_cast<txExecutionState*>(aContext->getPrivateContext());
     if (!es) {
         NS_ERROR("Need txExecutionState!");
 
@@ -190,17 +178,16 @@ createAndAddToResult(nsIAtom* aName, con
     nsAutoPtr<txXPathNode> xpathNode(
           txXPathNativeNode::createXPathNode(elem, PR_TRUE));
     NS_ENSURE_TRUE(xpathNode, NS_ERROR_OUT_OF_MEMORY);
 
     aResultSet->append(*xpathNode);
 
     return NS_OK;
 }
-#endif
 
 // Need to update this array if types are added to the ResultType enum in
 // txAExprResult.
 static const char * const sTypes[] = {
   "node-set",
   "boolean",
   "number",
   "string",
--- a/content/xslt/src/xslt/txXMLEventHandler.h
+++ b/content/xslt/src/xslt/txXMLEventHandler.h
@@ -37,26 +37,21 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef TRANSFRMX_XML_EVENT_HANDLER_H
 #define TRANSFRMX_XML_EVENT_HANDLER_H
 
 #include "txCore.h"
 #include "nsIAtom.h"
 
-class txOutputFormat;
-
-#ifdef TX_EXE
-#include <iostream.h>
-#else
 #define kTXNameSpaceURI "http://www.mozilla.org/TransforMiix"
 #define kTXWrapper "transformiix:result"
 
+class txOutputFormat;
 class nsIDOMDocument;
-#endif
 
 /**
  * An interface for handling XML documents, loosely modeled
  * after Dave Megginson's SAX 1.0 API.
  */
 
 class txAXMLEventHandler
 {
@@ -174,34 +169,29 @@ public:
                                   nsIAtom* aLocalName,                       \
                                   nsIAtom* aLowercaseLocalName,              \
                                   PRInt32 aNsID);                            \
     virtual nsresult startElement(nsIAtom* aPrefix,                          \
                                   const nsSubstring& aName,                  \
                                   const PRInt32 aNsID);
 
 
-#ifdef TX_EXE
-typedef txAXMLEventHandler txAOutputXMLEventHandler;
-#define TX_DECL_TXAOUTPUTXMLEVENTHANDLER
-#else
 class txAOutputXMLEventHandler : public txAXMLEventHandler
 {
 public:
     /**
      * Gets the Mozilla output document
      *
      * @param aDocument the Mozilla output document
      */
     virtual void getOutputDocument(nsIDOMDocument** aDocument) = 0;
 };
 
 #define TX_DECL_TXAOUTPUTXMLEVENTHANDLER                        \
     virtual void getOutputDocument(nsIDOMDocument** aDocument);
-#endif
 
 /**
  * Interface used to create the appropriate outputhandler
  */
 class txAOutputHandlerFactory
 {
 public:
     virtual ~txAOutputHandlerFactory() {}
--- a/content/xslt/src/xslt/txXPathResultComparator.cpp
+++ b/content/xslt/src/xslt/txXPathResultComparator.cpp
@@ -35,47 +35,40 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "txXPathResultComparator.h"
 #include "txExpr.h"
 #include "txCore.h"
-#ifndef TX_EXE
 #include "nsCollationCID.h"
 #include "nsILocale.h"
 #include "nsILocaleService.h"
 #include "nsIServiceManager.h"
 #include "nsLocaleCID.h"
 #include "prmem.h"
-#else
-#include "txStringUtils.h"
-#endif
 
 #define kAscending (1<<0)
 #define kUpperFirst (1<<1)
 
 txResultStringComparator::txResultStringComparator(MBool aAscending,
                                                    MBool aUpperFirst,
                                                    const nsAFlatString& aLanguage)
 {
     mSorting = 0;
     if (aAscending)
         mSorting |= kAscending;
     if (aUpperFirst)
         mSorting |= kUpperFirst;
-#ifndef TX_EXE
     nsresult rv = init(aLanguage);
     if (NS_FAILED(rv))
         NS_ERROR("Failed to initialize txResultStringComparator");
-#endif
 }
 
-#ifndef TX_EXE
 nsresult txResultStringComparator::init(const nsAFlatString& aLanguage)
 {
     nsresult rv;
 
     nsCOMPtr<nsILocaleService> localeService =
                     do_GetService(NS_LOCALESERVICE_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
@@ -93,89 +86,59 @@ nsresult txResultStringComparator::init(
                     do_CreateInstance(NS_COLLATIONFACTORY_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = colFactory->CreateCollation(locale, getter_AddRefs(mCollation));
     NS_ENSURE_SUCCESS(rv, rv);
 
     return NS_OK;
 }
-#endif
 
 nsresult
 txResultStringComparator::createSortableValue(Expr *aExpr,
                                               txIEvalContext *aContext,
                                               txObject *&aResult)
 {
     nsAutoPtr<StringValue> val(new StringValue);
     if (!val) {
         return NS_ERROR_OUT_OF_MEMORY;
     }
 
-    nsresult rv;
-#ifdef TX_EXE
-    rv = aExpr->evaluateToString(aContext, val->mStr);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    // We don't support case-order on standalone
-    TX_ToLowerCase(val->mStr);
-#else
     if (!mCollation)
         return NS_ERROR_FAILURE;
 
     val->mCaseKey = new nsString;
     if (!val->mCaseKey) {
         return NS_ERROR_OUT_OF_MEMORY;
     }
 
     nsString& nsCaseKey = *(nsString *)val->mCaseKey;
-    rv = aExpr->evaluateToString(aContext, nsCaseKey);
+    nsresult rv = aExpr->evaluateToString(aContext, nsCaseKey);
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (nsCaseKey.IsEmpty()) {
         aResult = val.forget();
 
         return NS_OK;
     }
 
     rv = mCollation->AllocateRawSortKey(nsICollation::kCollationCaseInSensitive,
                                         nsCaseKey, &val->mKey, &val->mLength);
     NS_ENSURE_SUCCESS(rv, rv);
-#endif
 
     aResult = val.forget();
 
     return NS_OK;
 }
 
 int txResultStringComparator::compareValues(TxObject* aVal1, TxObject* aVal2)
 {
     StringValue* strval1 = (StringValue*)aVal1;
     StringValue* strval2 = (StringValue*)aVal2;
-#ifdef TX_EXE
-    PRUint32 len1 = strval1->mStr.Length();
-    PRUint32 len2 = strval2->mStr.Length();
-    PRUint32 minLength = (len1 < len2) ? len1 : len2;
 
-    PRUint32 c = 0;
-    while (c < minLength) {
-        PRUnichar ch1 = strval1->mStr.CharAt(c);
-        PRUnichar ch2 = strval2->mStr.CharAt(c);
-        if (ch1 < ch2)
-            return ((mSorting & kAscending) ? 1 : -1) * -1;
-        if (ch2 < ch1)
-            return ((mSorting & kAscending) ? 1 : -1) * 1;
-        c++;
-    }
-
-    if (len1 == len2)
-        return 0;
-
-    return ((mSorting & kAscending) ? 1 : -1) * ((len1 < len2) ? -1 : 1);
-#else
     if (!mCollation)
         return -1;
 
     if (strval1->mLength == 0) {
         if (strval2->mLength == 0)
             return 0;
         return ((mSorting & kAscending) ? -1 : 1);
     }
@@ -229,36 +192,33 @@ int txResultStringComparator::compareVal
                                        &result);
     if (NS_FAILED(rv)) {
         // XXX ErrorReport
         return -1;
     }
 
     return ((mSorting & kAscending) ? 1 : -1) *
            ((mSorting & kUpperFirst) ? -1 : 1) * result;
-#endif
 }
 
-#ifndef TX_EXE
 txResultStringComparator::StringValue::StringValue() : mKey(0),
                                                        mCaseKey(0),
                                                        mLength(0),
                                                        mCaseLength(0)
 {
 }
 
 txResultStringComparator::StringValue::~StringValue()
 {
     PR_Free(mKey);
     if (mCaseLength > 0)
         PR_Free((PRUint8*)mCaseKey);
     else
         delete (nsString*)mCaseKey;
 }
-#endif
 
 txResultNumberComparator::txResultNumberComparator(MBool aAscending)
 {
     mAscending = aAscending ? 1 : -1;
 }
 
 nsresult
 txResultNumberComparator::createSortableValue(Expr *aExpr,
--- a/content/xslt/src/xslt/txXPathResultComparator.h
+++ b/content/xslt/src/xslt/txXPathResultComparator.h
@@ -36,20 +36,18 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef TRANSFRMX_XPATHRESULTCOMPARATOR_H
 #define TRANSFRMX_XPATHRESULTCOMPARATOR_H
 
 #include "txCore.h"
-#ifndef TX_EXE
 #include "nsCOMPtr.h"
 #include "nsICollation.h"
-#endif
 #include "nsString.h"
 
 class Expr;
 class txIEvalContext;
 
 /*
  * Result comparators
  */
@@ -81,39 +79,33 @@ class txResultStringComparator : public 
 public:
     txResultStringComparator(MBool aAscending, MBool aUpperFirst,
                              const nsAFlatString& aLanguage);
 
     int compareValues(TxObject* aVal1, TxObject* aVal2);
     nsresult createSortableValue(Expr *aExpr, txIEvalContext *aContext,
                                  TxObject *&aResult);
 private:
-#ifndef TX_EXE
     nsCOMPtr<nsICollation> mCollation;
     nsresult init(const nsAFlatString& aLanguage);
     nsresult createRawSortKey(const PRInt32 aStrength,
                               const nsString& aString,
                               PRUint8** aKey,
                               PRUint32* aLength);
-#endif
     int mSorting;
 
     class StringValue : public TxObject
     {
     public:
-#ifdef TX_EXE
-        nsString mStr;
-#else
         StringValue();
         ~StringValue();
 
         PRUint8* mKey;
         void* mCaseKey;
         PRUint32 mLength, mCaseLength;
-#endif
     };
 };
 
 /*
  * Compare results as numbers (data-type="number")
  */
 class txResultNumberComparator : public txXPathResultComparator
 {
--- a/content/xslt/src/xslt/txXSLTPatterns.cpp
+++ b/content/xslt/src/xslt/txXSLTPatterns.cpp
@@ -39,19 +39,17 @@
 #include "nsReadableUtils.h"
 #include "txExecutionState.h"
 #include "txXSLTPatterns.h"
 #include "txNodeSetContext.h"
 #include "txForwardContext.h"
 #include "txXMLUtils.h"
 #include "txXSLTFunctions.h"
 #include "nsWhitespaceTokenizer.h"
-#ifndef TX_EXE
 #include "nsIContent.h"
-#endif
 
 /*
  * Returns the default priority of this Pattern.
  * UnionPatterns don't like this.
  * This should be called on the simple patterns.
  */
 double txUnionPattern::getDefaultPriority()
 {
@@ -299,32 +297,20 @@ txIdPattern::txIdPattern(const nsSubstri
 
 MBool txIdPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext)
 {
     if (!txXPathNodeUtils::isElement(aNode)) {
         return PR_FALSE;
     }
 
     // Get a ID attribute, if there is
-#ifdef TX_EXE
-    Element* elem;
-    nsresult rv = txXPathNativeNode::getElement(aNode, &elem);
-    NS_ASSERTION(NS_SUCCEEDED(rv), "So why claim it's an element above?");
-
-    nsAutoString value;
-    if (!elem->getIDValue(value)) {
-        return PR_FALSE;
-    }
-    nsCOMPtr<nsIAtom> id = do_GetAtom(value);
-#else
     nsIContent* content = txXPathNativeNode::getContent(aNode);
     NS_ASSERTION(content, "a Element without nsIContent");
 
     nsIAtom* id = content->GetID();
-#endif // TX_EXE
     return id && mIds.IndexOf(id) > -1;
 }
 
 double txIdPattern::getDefaultPriority()
 {
     return 0.5;
 }
 
--- a/content/xslt/src/xslt/txXSLTProcessor.cpp
+++ b/content/xslt/src/xslt/txXSLTProcessor.cpp
@@ -39,61 +39,39 @@
 #include "txXSLTProcessor.h"
 #include "txInstructions.h"
 #include "txAtoms.h"
 #include "txLog.h"
 #include "txStylesheetCompileHandlers.h"
 #include "txStylesheetCompiler.h"
 #include "txExecutionState.h"
 #include "txExprResult.h"
-#ifdef TX_EXE
-#include "txHTMLOutput.h"
-#endif
 
 TX_LG_IMPL
 
 /* static */
 MBool
 txXSLTProcessor::init()
 {
     TX_LG_CREATE;
 
-#ifdef TX_EXE
-    if (!txStandaloneNamespaceManager::init())
-        return MB_FALSE;
-
-    if (NS_FAILED(txHTMLOutput::init())) {
-        return MB_FALSE;
-    }
-
-    txXMLAtoms::init();
-    txXPathAtoms::init();
-    txXSLTAtoms::init();
-    txHTMLAtoms::init();
-#endif
-    
     if (!txHandlerTable::init())
         return MB_FALSE;
 
     extern PRBool TX_InitEXSLTFunction();
     if (!TX_InitEXSLTFunction())
         return MB_FALSE;
 
     return MB_TRUE;
 }
 
 /* static */
 void
 txXSLTProcessor::shutdown()
 {
-#ifdef TX_EXE
-    txStandaloneNamespaceManager::shutdown();
-    txHTMLOutput::shutdown();
-#endif
-
     txStylesheetCompilerState::shutdown();
     txHandlerTable::shutdown();
 }
 
 
 /* static */
 nsresult
 txXSLTProcessor::execute(txExecutionState& aEs)
--- a/parser/expat/lib/xmlparse.c
+++ b/parser/expat/lib/xmlparse.c
@@ -658,24 +658,16 @@ struct XML_ParserStruct {
 #define useForeignDTD (parser->m_useForeignDTD)
 #define paramEntityParsing (parser->m_paramEntityParsing)
 #endif /* XML_DTD */
 /* BEGIN MOZILLA CHANGE (Report opening tag of mismatched closing tag) */
 #define mismatch (parser->m_mismatch)
 /* END MOZILLA CHANGE */
 
 /* BEGIN MOZILLA CHANGE (unused API) */
-#ifdef TX_EXE
-XML_Parser XMLCALL
-XML_ParserCreate(const XML_Char *encodingName)
-{
-  return XML_ParserCreate_MM(encodingName, NULL, NULL);
-}
-#endif
-
 #if 0
 XML_Parser XMLCALL
 XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep)
 {
   XML_Char tmp[2];
   *tmp = nsSep;
   return XML_ParserCreate_MM(encodingName, NULL, tmp);
 }
@@ -1911,72 +1903,17 @@ XML_DefaultCurrent(XML_Parser parser)
       reportDefault(parser,
                     internalEncoding,
                     openInternalEntities->internalEventPtr,
                     openInternalEntities->internalEventEndPtr);
     else
       reportDefault(parser, encoding, eventPtr, eventEndPtr);
   }
 }
-#endif
-
-#ifdef TX_EXE
-const XML_LChar * XMLCALL
-XML_ErrorString(enum XML_Error code)
-{
-  static const XML_LChar* const message[] = {
-    0,
-    XML_L("out of memory"),
-    XML_L("syntax error"),
-    XML_L("no element found"),
-    XML_L("not well-formed (invalid token)"),
-    XML_L("unclosed token"),
-    XML_L("partial character"),
-    XML_L("mismatched tag"),
-    XML_L("duplicate attribute"),
-    XML_L("junk after document element"),
-    XML_L("illegal parameter entity reference"),
-    XML_L("undefined entity"),
-    XML_L("recursive entity reference"),
-    XML_L("asynchronous entity"),
-    XML_L("reference to invalid character number"),
-    XML_L("reference to binary entity"),
-    XML_L("reference to external entity in attribute"),
-    XML_L("XML or text declaration not at start of entity"),
-    XML_L("unknown encoding"),
-    XML_L("encoding specified in XML declaration is incorrect"),
-    XML_L("unclosed CDATA section"),
-    XML_L("error in processing external entity reference"),
-    XML_L("document is not standalone"),
-    XML_L("unexpected parser state - please send a bug report"),
-    XML_L("entity declared in parameter entity"),
-    XML_L("requested feature requires XML_DTD support in Expat"),
-    XML_L("cannot change setting once parsing has begun"),
-    XML_L("unbound prefix"),
-    XML_L("must not undeclare prefix"),
-    XML_L("incomplete markup in parameter entity"),
-    XML_L("XML declaration not well-formed"),
-    XML_L("text declaration not well-formed"),
-    XML_L("illegal character(s) in public id"),
-    XML_L("parser suspended"),
-    XML_L("parser not suspended"),
-    XML_L("parsing aborted"),
-    XML_L("parsing finished"),
-    XML_L("cannot suspend in external parameter entity"),
-    XML_L("reserved prefix (xml) must not be undeclared or bound to another namespace name"),
-    XML_L("reserved prefix (xmlns) must not be declared or undeclared"),
-    XML_L("prefix must not be bound to one of the reserved namespace names")
-  };
-  if (code > 0 && code < sizeof(message)/sizeof(message[0]))
-    return message[code];
-  return NULL;
-}
-#endif
-
-#if 0
+
 const XML_LChar * XMLCALL
 XML_ExpatVersion(void) {
 
   /* V1 is used to string-ize the version number. However, it would
      string-ize the actual version macro *names* unless we get them
      substituted before being passed to V1. CPP is defined to expand
      a macro, then rescan for more expansions. Thus, we use V2 to expand
      the version macros, then CPP will expand the resulting V1() macro