--- parser3/src/classes/xdoc.C 2001/10/05 17:33:50 1.10 +++ parser3/src/classes/xdoc.C 2001/10/08 08:35:56 1.12 @@ -4,7 +4,7 @@ Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: xdoc.C,v 1.10 2001/10/05 17:33:50 parser Exp $ + $Id: xdoc.C,v 1.12 2001/10/08 08:35:56 parser Exp $ */ #include "classes.h" #ifdef XML @@ -110,6 +110,7 @@ public: } ~XalanSourceTreeParserLiaison2() { + delete ferror_handler; } private: ErrorHandler *ferror_handler; @@ -121,9 +122,6 @@ public: XalanDefaultParsedSource2(const XSLTInputSource& theInputSource); - virtual - ~XalanDefaultParsedSource2(); - virtual XalanDocument* getDocument() const; @@ -152,12 +150,6 @@ XalanDefaultParsedSource2::XalanDefaultP -XalanDefaultParsedSource2::~XalanDefaultParsedSource2() -{ -} - - - XalanDocument* XalanDefaultParsedSource2::getDocument() const { @@ -339,18 +331,9 @@ static void _set(Request& r, const Strin std::istrstream stream(xml.cstr()); const XalanParsedSource* parsedSource; -/* int error=vdoc.transformer().parseSource(&stream, parsedSource); - if(error) - PTHROW(0, 0, - &method_name, - vdoc.transformer().getLastError()); -*/ - - try - { - parsedSource = new XalanDefaultParsedSource2(&stream); - //todo free parsedSource + try { + parsedSource = new XalanDefaultParsedSource2(&stream); } catch (XSLException& e) { r._throw(&method_name, e); @@ -381,12 +364,24 @@ static void _load(Request& r, const Stri const char *filespec=r.absolute(file_name).cstr(String::UL_FILE_SPEC); const XalanParsedSource* parsedSource; - int error=vdoc.transformer().parseSource(filespec, parsedSource); - - if(error) - PTHROW(0, 0, - &file_name, - vdoc.transformer().getLastError()); + try { + parsedSource = new XalanDefaultParsedSource2(filespec); + } + catch (XSLException& e) { + r._throw(&method_name, e); + } + catch (SAXParseException& e) { + r._throw(&method_name, e); + } + catch (SAXException& e) { + r._throw(&method_name, e); + } + catch (XMLException& e) { + r._throw(&method_name, e); + } + catch(const XalanDOMException& e) { + r._throw(&method_name, e); + } // replace any previous parsed source vdoc.set_parsed_source(*parsedSource);