--- parser3/src/classes/Attic/dom.C 2001/09/20 09:17:55 1.27 +++ parser3/src/classes/Attic/dom.C 2001/09/21 09:04:18 1.32 @@ -5,12 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) */ -static const char *RCSId="$Id: dom.C,v 1.27 2001/09/20 09:17:55 parser Exp $"; - -#if _MSC_VER -# pragma warning(disable:4291) // disable warning -// "no matching operator delete found; memory will not be freed if initialization throws an exception -#endif +static const char *RCSId="$Id: dom.C,v 1.32 2001/09/21 09:04:18 parser Exp $"; #include "classes.h" #include "pa_request.h" @@ -86,7 +81,8 @@ static void create_optioned_listener( const char *& content_type, const char *& charset, FormatterListener *& listener, Pool& pool, const String& method_name, MethodParams *params, int index, Writer& writer) { - charset=0; + // default encoding from pool + const String *scharset=&pool.get_charset(); const String *method=0; XalanDOMString xalan_encoding; @@ -102,8 +98,7 @@ static void create_optioned_listener( // $.encoding[windows-1251|...] if(Value *vencoding=static_cast(options->get(*new(pool) String(pool, DOM_OUTPUT_ENCODING_OPTION_NAME)))) { - charset=vencoding->as_string().cstr(); - xalan_encoding.append(charset, strlen(charset)); + scharset=&vencoding->as_string(); } } else PTHROW(0, 0, @@ -112,6 +107,7 @@ static void create_optioned_listener( } } + xalan_encoding.append(charset=scharset->cstr()); if(!method/*default='xml'*/ || *method == DOM_OUTPUT_METHOD_OPTION_VALUE_XML) { content_type="text/xml"; listener=new FormatterToXML(writer, @@ -167,7 +163,7 @@ static void _save(Request& r, const Stri FormatterTreeWalker treeWalker(*formatterListener); treeWalker.traverse(&node); // Walk that node and produce the XML... } catch(const XSLException& e) { - _throw(pool, &method_name, e); + r._throw(&method_name, e); } } @@ -192,7 +188,7 @@ static void _string(Request& r, const St // write out result r.write_no_lang(parserString); } catch(const XSLException& e) { - _throw(pool, &method_name, e); + r._throw(&method_name, e); } } @@ -231,7 +227,7 @@ static void _file(Request& r, const Stri vfile.set(false/*tainted*/, cstr, strlen(cstr), 0/*file_name*/, vcontent_type); r.write_no_lang(vfile); } catch(const XSLException& e) { - _throw(pool, &method_name, e); + r._throw(&method_name, e); } }