|
|
| version 1.79, 2002/01/28 10:33:52 | version 1.83, 2002/02/07 12:15:47 |
|---|---|
| Line 6 | Line 6 |
| $Id$ | $Id$ |
| */ | */ |
| #include "pa_types.h" | #include "classes.h" |
| #ifdef XML | #ifdef XML |
| #include "pa_stylesheet_connection.h" | |
| #include "pa_request.h" | |
| #include "pa_vxdoc.h" | |
| #include "pa_charset.h" | |
| #include "pa_vfile.h" | |
| #include "xnode.h" | |
| #include "gdome.h" | #include "gdome.h" |
| #include "libxml/tree.h" | #include "libxml/tree.h" |
| extern "C" { | extern "C" { |
| Line 19 extern "C" { | Line 26 extern "C" { |
| #include "libxslt/transform.h" | #include "libxslt/transform.h" |
| #include "libxslt/xsltutils.h" | #include "libxslt/xsltutils.h" |
| #include "pa_stylesheet_connection.h" | |
| #include "classes.h" | |
| #include "pa_request.h" | |
| #include "pa_vxdoc.h" | |
| #include "pa_charset.h" | |
| #include "pa_vfile.h" | |
| #include "xnode.h" | |
| // defines | // defines |
| #define XDOC_CLASS_NAME "xdoc" | #define XDOC_CLASS_NAME "xdoc" |
| Line 404 static void _create(Request& r, const St | Line 402 static void _create(Request& r, const St |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| VXdoc& vdoc=*static_cast<VXdoc *>(r.self); | VXdoc& vdoc=*static_cast<VXdoc *>(r.self); |
| const String& qualifiedName=params->as_string(0, "qualifiedName must be string"); | Value& param=params->get(0); |
| GdomeDocument *document; | |
| GdomeException exc; | if(param.get_junction()) { // {<tag/>} |
| /* | Temp_lang temp_lang(r, String::UL_XML); |
| GdomeDocumentType *documentType=gdome_di_createDocumentType ( | const String& xml=r.process(param).as_string(); |
| docimpl, | |
| pool.transcode(qualifiedName), | const char *cstr=xml.cstr(String::UL_UNSPECIFIED); |
| 0/*publicId* /, | document=(GdomeDocument *) |
| 0/*systemId* /, | gdome_xml_n_mkref((xmlNode *)xmlParseMemory( |
| &exc); | cstr, strlen(cstr) |
| if(!documentType || exc || xmlHaveGenericErrors()) | )); |
| throw Exception(0, 0, | if(!document || xmlHaveGenericErrors()) { |
| &method_name, | GdomeException exc=0; |
| exc); | throw Exception(0, 0, |
| */ | &method_name, |
| GdomeDocument *document=gdome_di_createDocument (domimpl, | exc); |
| 0/*namespaceURI*/, | } |
| pool.transcode(qualifiedName).get(), | } else { // [name] |
| 0/*doctype*/, | const String& qualifiedName=param.as_string(); |
| &exc); | |
| if(!document || exc || xmlHaveGenericErrors()) | |
| throw Exception(0, 0, | |
| &method_name, | |
| exc); | |
| /// +xalan createXMLDecl ? | |
| // replace any previous parsed source | |
| vdoc.set_document(document); | |
| } | |
| static void _set(Request& r, const String& method_name, MethodParams *params) { | |
| // _asm int 3; | |
| Pool& pool=r.pool(); | |
| VXdoc& vdoc=*static_cast<VXdoc *>(r.self); | |
| Value& vxml=params->as_junction(0, "xml must be code"); | GdomeException exc; |
| Temp_lang temp_lang(r, String::UL_XML); | /* |
| const String& xml=r.process(vxml).as_string(); | GdomeDocumentType *documentType=gdome_di_createDocumentType ( |
| docimpl, | |
| pool.transcode(qualifiedName), | |
| 0/*publicId* /, | |
| 0/*systemId* /, | |
| &exc); | |
| if(!documentType || exc || xmlHaveGenericErrors()) | |
| throw Exception(0, 0, | |
| &method_name, | |
| exc); | |
| */ | |
| document=gdome_di_createDocument (domimpl, | |
| 0/*namespaceURI*/, | |
| pool.transcode(qualifiedName).get(), | |
| 0/*doctype*/, | |
| &exc); | |
| if(!document || exc || xmlHaveGenericErrors()) | |
| throw Exception(0, 0, | |
| &method_name, | |
| exc); | |
| const char *cstr=xml.cstr(String::UL_UNSPECIFIED); | /// +xalan createXMLDecl ? |
| GdomeDocument *document=(GdomeDocument *) | |
| gdome_xml_n_mkref((xmlNode *)xmlParseMemory( | |
| cstr, strlen(cstr) | |
| )); | |
| if(!document || xmlHaveGenericErrors()) { | |
| GdomeException exc=0; | |
| throw Exception(0, 0, | |
| &method_name, | |
| exc); | |
| } | } |
| // replace any previous parsed source | // replace any previous parsed source |
| vdoc.set_document(document); | vdoc.set_document(document); |
| } | } |
| Line 829 MXdoc::MXdoc(Pool& apool) : MXnode(apool | Line 820 MXdoc::MXdoc(Pool& apool) : MXnode(apool |
| /// parser | /// parser |
| // ^xdoc::create{qualifiedName} | // ^xdoc::create{qualifiedName} |
| // ^xdoc::_create[<some>xml</some>] | |
| add_native_method("create", Method::CT_DYNAMIC, _create, 1, 1); | add_native_method("create", Method::CT_DYNAMIC, _create, 1, 1); |
| // ^xdoc::set[<some>xml</some>] | // for backward compatibility with <=v 1.82 2002/01/31 11:51:46 paf |
| add_native_method("set", Method::CT_DYNAMIC, _set, 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, 1); |