--- parser3/src/classes/xdoc.C 2003/09/22 09:02:24 1.113 +++ parser3/src/classes/xdoc.C 2003/11/20 17:22:48 1.121 @@ -9,7 +9,7 @@ #ifdef XML -static const char* IDENT_XDOC_C="$Date: 2003/09/22 09:02:24 $"; +static const char * const IDENT_XDOC_C="$Date: 2003/11/20 17:22:48 $"; #include "gdome.h" #include "libxml/tree.h" @@ -26,6 +26,7 @@ static const char* IDENT_XDOC_C="$Date: #include "pa_vxdoc.h" #include "pa_charset.h" #include "pa_vfile.h" +#include "pa_xml_exception.h" #include "xnode.h" // defines @@ -41,13 +42,11 @@ static const char* IDENT_XDOC_C="$Date: class MXdoc: public MXnode { public: // VStateless_class - Value* create_new_value() { return new VXdoc(0, 0); } + Value* create_new_value(Pool&) { return new VXdoc(0, 0); } public: MXdoc(); -public: // Methoded - void configure_admin(Request& r); }; // global variable @@ -160,7 +159,7 @@ private: static void writeNode(Request& r, GdomeNode *node, GdomeException exc) { if(!node || exc) - throw Exception(0, exc); + throw XmlException(0, exc); // write out result r.write_no_lang(*new VXnode(&r.charsets, node)); @@ -328,10 +327,10 @@ static void _getElementsByTagName(Reques gulong length=gdome_nl_length(nodes, &exc); for(gulong i=0; ias_string(); } static void param_option_over_output_option( HashStringValue& param_options, const char* option_name, bool& output_option) { - if(Value* value=param_options.get(StringBody(option_name))) { + if(Value* value=param_options.get(String::Body(option_name))) { const String& s=value->as_string(); if(s=="yes") output_option=true; @@ -561,7 +558,7 @@ static void prepare_output_options(Reque if(voptions.is_defined()) { if(HashStringValue *options=voptions.get_hash()) { // $.method[xml|html|text] - if(Value* vmethod=options->get(StringBody(XDOC_OUTPUT_METHOD_OPTION_NAME))) + if(Value* vmethod=options->get(String::Body(XDOC_OUTPUT_METHOD_OPTION_NAME))) oo.method=&vmethod->as_string(); // $.version[1.0] @@ -651,7 +648,7 @@ static Xdoc2buf_result xdoc2buf(Request& xmlDoc *document=gdome_xml_doc_get_xmlDoc(vdoc.get_document()); if(xsltSaveResultTo(outputBuffer.get(), document, stylesheet.get())<0) { GdomeException exc=0; - throw Exception(0, exc); + throw XmlException(0, exc); } // write out result @@ -664,14 +661,15 @@ static Xdoc2buf_result xdoc2buf(Request& gnome_str=(char *)outputBuffer->buffer->content; } + if((result.length=gnome_length)) { + result.str=pa_strdup(gnome_str, gnome_length); + } else + result.str=0; + if(file_spec) file_write(*file_spec, gnome_str, gnome_length, true/*as_text*/); - else if(result.length=gnome_length) { - result.str=pa_strdup(gnome_str, gnome_length); - } else - result.str=0; return result; } @@ -692,7 +690,7 @@ static void _file(Request& r, MethodPara value_name, new VString(*oo.mediaType)); vhcontent_type.hash().put( - StringBody("charset"), + String::Body("charset"), new VString(*oo.encoding)); vfile.set(false/*tainted*/, buf.str?buf.str:""/*to distinguish from stat-ed file*/, buf.length, @@ -755,7 +753,7 @@ static VXdoc& _transform(Request& r, con transformContext.get()); if(!transformed || xmlHaveGenericErrors()) { GdomeException exc=0; - throw Exception(stylesheet_source, exc); + throw XmlException(stylesheet_source, exc); } //gdome_xml_doc_mkref dislikes XML_HTML_DOCUMENT_NODE type, fixing @@ -832,7 +830,7 @@ static void _transform(Request& r, Metho stylesheet_ptr->doc=0; if(xmlHaveGenericErrors()) { GdomeException exc=0; - throw Exception(0, exc); + throw XmlException(0, exc); } if(!stylesheet_ptr.get()) throw Exception("xml", @@ -932,9 +930,6 @@ MXdoc::MXdoc(): MXnode(XDOC_CLASS_NAME, } -void MXdoc::configure_admin(Request& r) { -} - # else #include "classes.h"