--- parser3/src/classes/xdoc.C 2005/12/16 10:15:12 1.149 +++ parser3/src/classes/xdoc.C 2007/04/23 10:30:10 1.154 @@ -9,7 +9,7 @@ #ifdef XML -static const char * const IDENT_XDOC_C="$Date: 2005/12/16 10:15:12 $"; +static const char * const IDENT_XDOC_C="$Date: 2007/04/23 10:30:10 $"; #include "libxml/tree.h" #include "libxml/HTMLtree.h" @@ -158,7 +158,7 @@ private: static void writeNode(Request& r, VXdoc& xdoc, xmlNode* node) { if(!node) - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "error creating node"); // OOM, bad name, things like that @@ -399,30 +399,36 @@ static void _create(Request& r, MethodPa // must be last action in if, see after if} } else { // [localName] - xmlChar* localName=r.transcode(param.as_string()); - + if(const String* value = param.get_string()){ + xmlChar* localName=r.transcode(*value); #if 0 - GdomeDocumentType *documentType=gdome_di_createDocumentType ( - docimpl, - r.transcode(qualifiedName), - 0/*publicId*/, - 0/*systemId*/, - &exc); - if(!documentType || exc || xmlHaveGenericErrors()) - throw Exception( - method_name, - exc); - /// +xalan createXMLDecl ? + GdomeDocumentType *documentType=gdome_di_createDocumentType ( + docimpl, + r.transcode(qualifiedName), + 0/*publicId*/, + 0/*systemId*/, + &exc); + if(!documentType || exc || xmlHaveGenericErrors()) + throw Exception( + method_name, + exc); + /// +xalan createXMLDecl ? #endif - xmldoc=xmlNewDoc(0); - if(!xmldoc || xmlHaveGenericErrors()) - throw XmlException(0); - xmlNode* node=xmlNewChild((xmlNode*)xmldoc, NULL, localName, NULL); - if(!node || xmlHaveGenericErrors()) - throw XmlException(0); - - set_encoding=true; - // must be last action in if, see after if} + xmldoc=xmlNewDoc(0); + if(!xmldoc || xmlHaveGenericErrors()) + throw XmlException(0); + xmlNode* node=xmlNewChild((xmlNode*)xmldoc, NULL, localName, NULL); + if(!node || xmlHaveGenericErrors()) + throw XmlException(0); + + set_encoding=true; + // must be last action in if, see after if} + } else { + VFile* vfile=param.as_vfile(String::L_UNSPECIFIED); + xmldoc=xmlParseMemory(vfile->value_ptr(), vfile->value_size()); + if(!xmldoc || xmlHaveGenericErrors()) + throw XmlException(0); + } } // must be first action after if} // replace any previous parsed source @@ -481,7 +487,7 @@ static void param_option_over_output_opt else if(s=="no") output_option=0; else - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, &s, "%s must be either 'yes' or 'no'", option_name); } @@ -571,7 +577,7 @@ static Xdoc2buf_result xdoc2buf(Request& xmlCharEncodingHandler *renderer=xmlFindCharEncodingHandler(render_encoding); if(!renderer) - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "encoding '%s' not supported", render_encoding); // UTF-8 renderer contains empty input/output converters, @@ -766,10 +772,10 @@ static void _transform(Request& r, Metho &transform_strings, transform_params }; - hash->for_each(add_xslt_param, &info); + hash->for_each(add_xslt_param, &info); transform_params[hash->count()*2]=0; } else - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "transform parameters parameter must be hash"); }