|
|
| version 1.102, 2002/09/20 11:23:33 | version 1.106, 2002/11/25 14:57:32 |
|---|---|
| Line 447 static void _create(Request& r, const St | Line 447 static void _create(Request& r, const St |
| &method_name, | &method_name, |
| exc); | exc); |
| xmlDoc *doc=gdome_xml_doc_get_xmlDoc(document); | |
| const char *source_charset_name=pool.get_source_charset().name().cstr(); | |
| doc->encoding=pool.get_source_charset().transcode_buf2xchar(source_charset_name, strlen(source_charset_name)); | |
| /// +xalan createXMLDecl ? | /// +xalan createXMLDecl ? |
| } | } |
| Line 472 static void _load(Request& r, const Stri | Line 476 static void _load(Request& r, const Stri |
| // filespec | // filespec |
| const String& file_name=params->as_string(0, "uri must be string"); | const String& file_name=params->as_string(0, "uri must be string"); |
| const String& uri=r.absolute(file_name); | const String& uri=r.absolute(file_name); |
| void *data; size_t size; | |
| file_read(pool, uri, data, size, false/*not text*/, | |
| params->size()>1?params->as_no_junction(1, "additional params must be hash").get_hash(&method_name) | |
| :0); | |
| GdomeDocument *document=(GdomeDocument *) | GdomeDocument *document=(GdomeDocument *) |
| gdome_xml_n_mkref((xmlNode *)xmlParseFile(uri.cstr())); | gdome_xml_n_mkref((xmlNode *)xmlParseMemory((const char *)data, size)); |
| if(!document || xmlHaveGenericErrors()) { | if(!document || xmlHaveGenericErrors()) { |
| GdomeException exc=0; | GdomeException exc=0; |
| throw Exception( | throw Exception( |
| Line 761 static VXdoc& _transform(Pool& pool, con | Line 770 static VXdoc& _transform(Pool& pool, con |
| memset(&result.output_options, 0, sizeof(result.output_options)); | memset(&result.output_options, 0, sizeof(result.output_options)); |
| VXdoc::Output_options& oo=result.output_options; | VXdoc::Output_options& oo=result.output_options; |
| oo.method=stylesheet->method?&pool.transcode(stylesheet->method):0; | oo.method=stylesheet->method?&pool.transcode(stylesheet->method, stylesheet_source):0; |
| oo.encoding=stylesheet->encoding?&pool.transcode(stylesheet->encoding):0; | oo.encoding=stylesheet->encoding?&pool.transcode(stylesheet->encoding, stylesheet_source):0; |
| oo.mediaType=stylesheet->mediaType?&pool.transcode(stylesheet->mediaType):0; | oo.mediaType=stylesheet->mediaType?&pool.transcode(stylesheet->mediaType, stylesheet_source):0; |
| oo.doctypeSystem=stylesheet->doctypeSystem?&pool.transcode(stylesheet->doctypeSystem):0; | oo.doctypeSystem=stylesheet->doctypeSystem?&pool.transcode(stylesheet->doctypeSystem, stylesheet_source):0; |
| oo.doctypePublic=stylesheet->doctypePublic?&pool.transcode(stylesheet->doctypePublic):0; | oo.doctypePublic=stylesheet->doctypePublic?&pool.transcode(stylesheet->doctypePublic, stylesheet_source):0; |
| oo.indent=stylesheet->indent!=0; | oo.indent=stylesheet->indent!=0; |
| oo.version=stylesheet->version?&pool.transcode(stylesheet->version):0; | oo.version=stylesheet->version?&pool.transcode(stylesheet->version, stylesheet_source):0; |
| oo.standalone=stylesheet->standalone!=0; | oo.standalone=stylesheet->standalone!=0; |
| oo.omitXmlDeclaration=stylesheet->omitXmlDeclaration!=0; | oo.omitXmlDeclaration=stylesheet->omitXmlDeclaration!=0; |
| Line 782 static void _transform(Request& r, const | Line 791 static void _transform(Request& r, const |
| const char **transform_params=0; | const char **transform_params=0; |
| if(params->size()>1) { | if(params->size()>1) { |
| Value& vparams=params->as_no_junction(1, "transform parameters must be hash"); | Value& vparams=params->as_no_junction(1, "transform parameters must be hash"); |
| if(vparams.is_defined()) | if(!vparams.is_string()) |
| if(Hash *params=vparams.get_hash(&method_name)) { | if(Hash *params=vparams.get_hash(&method_name)) { |
| const char **current_transform_param=transform_params= | const char **current_transform_param=transform_params= |
| (const char **)pool.malloc(sizeof(const char *)*(params->size()*2+1)); | (const char **)pool.malloc(sizeof(const char *)*(params->size()*2+1)); |
| Line 880 MXdoc::MXdoc(Pool& apool) : MXnode(apool | Line 889 MXdoc::MXdoc(Pool& apool) : MXnode(apool |
| add_native_method("set", Method::CT_DYNAMIC, _create, 1, 1); | add_native_method("set", Method::CT_DYNAMIC, _create, 1, 1); |
| // ^xdoc::load[some.xml] | // ^xdoc::load[some.xml] |
| add_native_method("load", Method::CT_DYNAMIC, _load, 1, 1); | add_native_method("load", Method::CT_DYNAMIC, _load, 1, 2); |
| // ^xdoc.save[some.xml] | // ^xdoc.save[some.xml] |
| // ^xdoc.save[some.xml;options hash] | // ^xdoc.save[some.xml;options hash] |