--- parser3/src/classes/xdoc.C 2003/12/15 14:56:19 1.127 +++ parser3/src/classes/xdoc.C 2004/02/03 16:29:45 1.130 @@ -9,7 +9,7 @@ #ifdef XML -static const char * const IDENT_XDOC_C="$Date: 2003/12/15 14:56:19 $"; +static const char * const IDENT_XDOC_C="$Date: 2004/02/03 16:29:45 $"; #include "gdome.h" #include "libxml/tree.h" @@ -615,7 +615,8 @@ static Xdoc2buf_result xdoc2buf(Request& // UTF-8 encoder contains empty input/output converters, // which is wrong for xmlOutputBufferCreateIO // while zero encoder goes perfectly - if(encoder && strcmp(encoder->name, "UTF-8")==0) + const char* encoder_name=encoder->name; + if(strcmp(encoder_name, "UTF-8")==0) encoder=0; xmlOutputBuffer_auto_ptr outputBuffer(xmlAllocOutputBuffer(encoder)); @@ -635,13 +636,14 @@ static Xdoc2buf_result xdoc2buf(Request& OOS2STYLE(encoding); OOS2STYLE(mediaType); // OOS2STYLE(doctypeSystem); - //OOS2STYLE(doctypePublic); +// OOS2STYLE(doctypePublic); OOE2STYLE(indent); OOS2STYLE(version); OOE2STYLE(standalone); OOE2STYLE(omitXmlDeclaration); xmlDoc *document=gdome_xml_doc_get_xmlDoc(vdoc.get_document()); + document->encoding=BAD_CAST xmlMemStrdup(encoder_name); if(xsltSaveResultTo(outputBuffer.get(), document, stylesheet.get())<0) { GdomeException exc=0; throw XmlException(0, exc); @@ -819,9 +821,6 @@ static void _transform(Request& r, Metho static_cast(vxdoc)->get_document()); // compile xdoc stylesheet xsltStylesheet_auto_ptr stylesheet_ptr(xsltParseStylesheetDoc(document)); - // strange thing - xsltParseStylesheetDoc records document and destroys it in stylesheet destructor - // we don't need that - stylesheet_ptr->doc=0; if(xmlHaveGenericErrors()) { GdomeException exc=0; throw XmlException(0, exc); @@ -830,6 +829,9 @@ static void _transform(Request& r, Metho throw Exception("xml", 0, "stylesheet failed to compile"); + // strange thing - xsltParseStylesheetDoc records document and destroys it in stylesheet destructor + // we don't need that + stylesheet_ptr->doc=0; // transform! result=&_transform(r, 0,