--- parser3/src/classes/xnode.C 2002/04/18 10:51:00 1.44 +++ parser3/src/classes/xnode.C 2002/08/19 09:37:05 1.51 @@ -3,12 +3,12 @@ Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) - - $Id: xnode.C,v 1.44 2002/04/18 10:51:00 paf Exp $ */ #include "classes.h" #ifdef XML +static const char* IDENT_XNODE_C="$Date: 2002/08/19 09:37:05 $"; + #include "pa_charset.h" #include "pa_request.h" #include "pa_vxnode.h" @@ -97,14 +97,12 @@ private: GdomeNode *as_node(const String& method_name, MethodParams *params, int index, const char *msg) { Value& value=params->as_no_junction(index, msg); - if(!(strcmp(value.type(), VXNODE_TYPE)==0 - || strcmp(value.type(), VXDOC_TYPE)==0)) + if(Value *vxnode=value.as(VXNODE_TYPE, false)) + return static_cast(vxnode)->get_node(&method_name); + else throw Exception("parser.runtime", &method_name, msg); - - VXnode& vnode=*static_cast(&value); - return vnode.get_node(&method_name); } // helpers @@ -232,7 +230,7 @@ GdomeElement *get_self_element(Request& if(gdome_n_nodeType(node, &exc)!=GDOME_ELEMENT_NODE) throw Exception("parser.runtime", &method_name, - "method can be called on node of ELEMENT type"); + "method can only be called on nodes of ELEMENT type"); return GDOME_EL(node); } @@ -606,7 +604,9 @@ static void _selectString(Request& r, co // constructor -MXnode::MXnode(Pool& apool) : Methoded(apool, "xnode"), +MXnode::MXnode(Pool& apool, const char *aname, VStateless_class *abase) : + Methoded(apool, aname?aname:"xnode", abase), + consts(apool) { /// DOM1 node