|
|
| version 1.82, 2002/01/31 11:51:46 | version 1.85, 2002/02/08 08:30:10 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: @b xdoc parser class. | Parser: @b xdoc parser class. |
| Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) | Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) |
| Author: Alexander Petrosyan <paf@design.ru> (http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) |
| $Id$ | $Id$ |
| */ | */ |
| Line 402 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 827 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); |