--- parser3/src/classes/xnode.C 2005/12/19 11:54:57 1.74 +++ parser3/src/classes/xnode.C 2007/04/23 10:30:10 1.77 @@ -7,7 +7,7 @@ #include "classes.h" #ifdef XML -static const char * const IDENT_XNODE_C="$Date: 2005/12/19 11:54:57 $"; +static const char * const IDENT_XNODE_C="$Date: 2007/04/23 10:30:10 $"; #include "pa_vmethod_frame.h" @@ -17,6 +17,7 @@ static const char * const IDENT_XNODE_C= #include "pa_vxdoc.h" #include "pa_vvoid.h" #include "pa_xml_exception.h" +#include "pa_vbool.h" #include "xnode.h" #include "libxml/xpath.h" @@ -101,7 +102,7 @@ xmlNode& as_node(MethodParams& params, i if(Value* vxnode=value.as(VXNODE_TYPE, false)) return static_cast(vxnode)->get_xmlnode(); else - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, msg); } @@ -113,7 +114,7 @@ xmlChar* as_xmlchar(Request& r, MethodPa xmlAttr& as_attr(MethodParams& params, int index, const char* msg) { xmlNode& xmlnode=as_node(params, index, msg); if(xmlnode.type!=XML_ATTRIBUTE_NODE) - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, msg); @@ -170,7 +171,7 @@ xmlNs& pa_xmlMapNs(xmlDoc& doc, const xm static void pa_addAttributeNode(xmlNode& selfNode, xmlAttr& attrNode) { if(attrNode.type!=XML_ATTRIBUTE_NODE) - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "must be ATTRIBUTE_NODE"); @@ -353,7 +354,7 @@ xmlNode& get_self_element(VXnode& vnode) xmlNode& node=vnode.get_xmlnode(); if(node.type!=XML_ELEMENT_NODE) - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "method can only be called on nodes of ELEMENT type"); @@ -624,7 +625,7 @@ static void register_one_ns( info->r->transcode(key), info->r->transcode(*svalue)); else - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, new String(key, String::L_TAINTED), "value is %s, must be string or number", value->type()); } @@ -645,7 +646,7 @@ static void _selectX(Request& r, MethodP xmlXPathContext_auto_ptr ctxt(xmlXPathNewContext(&xmldoc)); { Register_one_ns_info info={&r, ctxt.get()}; - vdoc.search_namespaces.hash().for_each(register_one_ns, &info); + vdoc.search_namespaces.hash().for_each(register_one_ns, &info); } ctxt->node=&xmlnode; /*error to stderr for now*/ @@ -682,7 +683,7 @@ static void selectNodesHandler(Request&, } break; default: - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, &expression, "wrong xmlXPathEvalExpression result type (%d)", res->type); break; // never @@ -700,7 +701,7 @@ static void selectNodeHandler(Request& r case XPATH_NODESET: if(res->nodesetval && res->nodesetval->nodeNr) { // empty result strangly has NODESET res->type if(res->nodesetval->nodeNr>1) - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, &expression, "resulted not in a single node (%d)", res->nodesetval->nodeNr); @@ -717,7 +718,7 @@ static void selectNodeHandler(Request& r result=new VString(r.transcode((xmlChar*)res->stringval)); break; default: - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, &expression, "wrong xmlXPathEvalExpression result type (%d)", res->type); } @@ -737,7 +738,7 @@ static void selectBoolHandler(Request&, break; // else[nodeset] fall down to default default: - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, &expression, "wrong xmlXPathEvalExpression result type (%d)", res->type); break; // never @@ -758,7 +759,7 @@ static void selectNumberHandler(Request& break; // else[nodeset] fall down to default default: - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, &expression, "wrong xmlXPathEvalExpression result type (%d)", res->type); break; // never @@ -781,7 +782,7 @@ static void selectStringHandler(Request& break; // else[nodeset] fall down to default default: - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, &expression, "wrong xmlXPathEvalExpression result type (%d)", res->type); break; // never