Diff for /parser3/src/classes/xnode.C between versions 1.73 and 1.76

version 1.73, 2005/12/16 15:08:46 version 1.76, 2007/02/03 18:08:38
Line 17  static const char * const IDENT_XNODE_C= Line 17  static const char * const IDENT_XNODE_C=
 #include "pa_vxdoc.h"  #include "pa_vxdoc.h"
 #include "pa_vvoid.h"  #include "pa_vvoid.h"
 #include "pa_xml_exception.h"  #include "pa_xml_exception.h"
   #include "pa_vbool.h"
   
 #include "xnode.h"  #include "xnode.h"
 #include "libxml/xpath.h"  #include "libxml/xpath.h"
Line 170  xmlNs& pa_xmlMapNs(xmlDoc& doc, const xm Line 171  xmlNs& pa_xmlMapNs(xmlDoc& doc, const xm
 static void pa_addAttributeNode(xmlNode& selfNode, xmlAttr& attrNode)   static void pa_addAttributeNode(xmlNode& selfNode, xmlAttr& attrNode) 
 {  {
         if(attrNode.type!=XML_ATTRIBUTE_NODE)          if(attrNode.type!=XML_ATTRIBUTE_NODE)
                 throw Exception("xml",                  throw Exception("parser.runtime",
                         0,                          0,
                         "must be ATTRIBUTE_NODE");                          "must be ATTRIBUTE_NODE");
   
Line 265  static void _replaceChild(Request& r, Me Line 266  static void _replaceChild(Request& r, Me
         xmlDoc& xmldoc=vxdoc.get_xmldoc();          xmlDoc& xmldoc=vxdoc.get_xmldoc();
         xmlNode& selfNode=vnode.get_xmlnode();          xmlNode& selfNode=vnode.get_xmlnode();
         xmlNode& newChild=as_node(params, 0, "newChild must be node");          xmlNode& newChild=as_node(params, 0, "newChild must be node");
         xmlNode& oldChild=as_node(params, 1, "refChild must be node");          xmlNode& oldChild=as_node(params, 1, "oldChild must be node");
   
         if(newChild.doc!=&xmldoc)          if(newChild.doc!=&xmldoc)
                 throw Exception("xml",                  throw Exception("xml.dom",
                         0,                          0,
                         "WRONG_DOCUMENT_ERR");                          "WRONG_DOCUMENT_ERR");
         if(oldChild.doc!=&xmldoc)          if(oldChild.doc!=&xmldoc)
                 throw Exception("xml",                  throw Exception("xml.dom",
                         0,                          0,
                         "WRONG_DOCUMENT_ERR");                          "WRONG_DOCUMENT_ERR");
   
           if(oldChild.parent!=&selfNode)
                   throw Exception("xml.dom",
                           0,
                           "NOT_FOUND_ERR");
   
         xmlNode* refChild=oldChild.next;          xmlNode* refChild=oldChild.next;
         xmlUnlinkNode(&oldChild);          xmlUnlinkNode(&oldChild);
         xmlNode* retNode;          xmlNode* retNode;
Line 297  static void _removeChild(Request& r, Met Line 303  static void _removeChild(Request& r, Met
         xmlNode& oldChild=as_node(params, 0, "refChild must be node");          xmlNode& oldChild=as_node(params, 0, "refChild must be node");
                   
         if(oldChild.doc!=&xmldoc)          if(oldChild.doc!=&xmldoc)
                 throw Exception("xml",                  throw Exception("xml.dom",
                         0,                          0,
                         "WRONG_DOCUMENT_ERR");                          "WRONG_DOCUMENT_ERR");
   
Line 412  static void _setAttributeNode(Request& r Line 418  static void _setAttributeNode(Request& r
         xmlAttr& newAttr=as_attr(params, 0, "newAttr must be ATTRIBUTE node");          xmlAttr& newAttr=as_attr(params, 0, "newAttr must be ATTRIBUTE node");
   
         if(newAttr.doc!=&xmldoc)          if(newAttr.doc!=&xmldoc)
                 throw Exception("xml",                  throw Exception("xml.dom",
                         0,                          0,
                         "WRONG_DOCUMENT_ERR");                          "WRONG_DOCUMENT_ERR");
   
         if(newAttr.parent)          if(newAttr.parent)
                 throw Exception("xml",                  throw Exception("xml.dom",
                         0,                          0,
                         "INUSE_ATTRIBUTE_ERR");                          "INUSE_ATTRIBUTE_ERR");
                   
Line 438  static void _removeAttributeNode(Request Line 444  static void _removeAttributeNode(Request
         xmlAttr& oldAttr=as_attr(params, 0, "oldAttr must be ATTRIBUTE node");          xmlAttr& oldAttr=as_attr(params, 0, "oldAttr must be ATTRIBUTE node");
   
         if(oldAttr.parent!=&element)          if(oldAttr.parent!=&element)
                 throw Exception("xml",                  throw Exception("xml.dom",
                         0,                          0,
                         "NOT_FOUND_ERR");                          "NOT_FOUND_ERR");
   
Line 631  static void _selectX(Request& r, MethodP Line 637  static void _selectX(Request& r, MethodP
                                                           Value*& result))                                                             Value*& result)) 
 {  {
         VXnode& vnode=GET_SELF(r, VXnode);          VXnode& vnode=GET_SELF(r, VXnode);
         xmlNode& element=get_self_element(vnode);          xmlNode& xmlnode=vnode.get_xmlnode();
         VXdoc& vdoc=vnode.get_vxdoc();          VXdoc& vdoc=vnode.get_vxdoc();
         xmlDoc& xmldoc=vdoc.get_xmldoc();          xmlDoc& xmldoc=vdoc.get_xmldoc();
   
Line 640  static void _selectX(Request& r, MethodP Line 646  static void _selectX(Request& r, MethodP
         xmlXPathContext_auto_ptr ctxt(xmlXPathNewContext(&xmldoc));          xmlXPathContext_auto_ptr ctxt(xmlXPathNewContext(&xmldoc));
         {          {
                 Register_one_ns_info info={&r, ctxt.get()};                  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*>(register_one_ns, &info);
         }          }
         ctxt->node=&element;          ctxt->node=&xmlnode;
         /*error to stderr for now*/          /*error to stderr for now*/
         xmlXPathObject_auto_ptr res(          xmlXPathObject_auto_ptr res(
                 xmlXPathEvalExpression(r.transcode(expression), ctxt.get()));                  xmlXPathEvalExpression(r.transcode(expression), ctxt.get()));
Line 677  static void selectNodesHandler(Request&, Line 683  static void selectNodesHandler(Request&,
                         }                          }
                 break;                  break;
         default:           default: 
                 throw Exception(0,                  throw Exception("parser.runtime",
                         &expression,                          &expression,
                         "wrong xmlXPathEvalExpression result type (%d)", res->type);                          "wrong xmlXPathEvalExpression result type (%d)", res->type);
                 break; // never                  break; // never

Removed from v.1.73  
changed lines
  Added in v.1.76


E-mail: