--- parser3/src/classes/xdoc.C 2002/06/27 08:32:18 1.94 +++ parser3/src/classes/xdoc.C 2002/08/01 11:26:44 1.96 @@ -3,12 +3,13 @@ Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) - - $Id: xdoc.C,v 1.94 2002/06/27 08:32:18 paf Exp $ */ + #include "classes.h" #ifdef XML +static const char* IDENT_XDOC_C="$Id: xdoc.C,v 1.96 2002/08/01 11:26:44 paf Exp $"; + #include "pa_stylesheet_connection.h" #include "pa_request.h" #include "pa_vxdoc.h" @@ -332,15 +333,13 @@ GdomeElement *gdome_doc_createElementNS GdomeAttr *gdome_doc_createAttributeNS (GdomeDocument *self, GdomeDOMString *namespaceURI, GdomeDOMString *qualifiedName, GdomeException *exc); */ - static void _create(Request& r, const String& method_name, MethodParams *params) { - //_asm int 3; Pool& pool=r.pool(); VXdoc& vdoc=*static_cast(r.self); - Value& param=params->get(0); + Value& param=params->get(params->size()-1); GdomeDocument *document; - if(param.get_junction()) { // {} + if(param.get_junction()) { // {...} Temp_lang temp_lang(r, String::UL_XML); const String& xml=r.process_to_string(param); @@ -383,6 +382,18 @@ static void _create(Request& r, const St /// +xalan createXMLDecl ? } + + // URI + const char *URI_cstr; + if(params->size()>1) { // absolute(param) + const String& URI=params->as_string(0, "URI must be string"); + URI_cstr=r.absolute(URI).cstr(); + } else // default = disk path to requested document + URI_cstr=r.info.path_translated; + xmlDoc *doc=gdome_xml_doc_get_xmlDoc(document); + if(URI_cstr) + doc->URL=pool.transcode_buf2xchar(URI_cstr, strlen(URI_cstr)); + // replace any previous parsed source vdoc.set_document(document); } @@ -788,8 +799,9 @@ MXdoc::MXdoc(Pool& apool) : MXnode(apool /// parser // ^xdoc::create{qualifiedName} - // ^xdoc::_create[xml] - add_native_method("create", Method::CT_DYNAMIC, _create, 1, 1); + // ^xdoc::create[xml] + // ^xdoc::create[URI][xml] + add_native_method("create", Method::CT_DYNAMIC, _create, 1, 2); // for backward compatibility with <=v 1.82 2002/01/31 11:51:46 paf add_native_method("set", Method::CT_DYNAMIC, _create, 1, 1);