Diff for /parser3/src/classes/xnode.C between versions 1.59 and 1.65

version 1.59, 2003/09/25 09:15:02 version 1.65, 2004/02/11 15:33:13
Line 1 Line 1
 /** @file  /** @file
         Parser: @b dom parser class.          Parser: @b dom parser class.
   
         Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com)          Copyright (c) 2001-2004 ArtLebedev Group (http://www.artlebedev.com)
         Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)          Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
 */  */
 #include "classes.h"  #include "classes.h"
 #ifdef XML  #ifdef XML
   
 static const char* IDENT_XNODE_C="$Date$";  static const char * const IDENT_XNODE_C="$Date$";
   
 #include "pa_vmethod_frame.h"  #include "pa_vmethod_frame.h"
   
Line 16  static const char* IDENT_XNODE_C="$Date$ Line 16  static const char* IDENT_XNODE_C="$Date$
 #include "pa_vxnode.h"  #include "pa_vxnode.h"
 #include "pa_vxdoc.h"  #include "pa_vxdoc.h"
 #include "pa_vvoid.h"  #include "pa_vvoid.h"
   #include "pa_xml_exception.h"
   
 #include "xnode.h"  #include "xnode.h"
   
Line 110  GdomeNode* as_node(MethodParams& params, Line 111  GdomeNode* as_node(MethodParams& params,
                 throw Exception("parser.runtime",                  throw Exception("parser.runtime",
                         0,                          0,
                         msg);                          msg);
                 result=0; // calm, compiler  
         }          }
   
         return result;          return result;
Line 146  static void _insertBefore(Request& r, Me Line 146  static void _insertBefore(Request& r, Me
                 // write out result                  // write out result
                 r.write_no_lang(*new VXnode(&r.charsets, retNode));                  r.write_no_lang(*new VXnode(&r.charsets, retNode));
         } else          } else
                 throw Exception(0, exc);                  throw XmlException(0, exc);
 }  }
   
 // Node replaceChild(in Node newChild,in Node oldChild) raises(DOMException);  // Node replaceChild(in Node newChild,in Node oldChild) raises(DOMException);
Line 154  static void _replaceChild(Request& r, Me Line 154  static void _replaceChild(Request& r, Me
         VXnode& vnode=GET_SELF(r, VXnode);          VXnode& vnode=GET_SELF(r, VXnode);
         GdomeNode* selfNode=vnode.get_node();          GdomeNode* selfNode=vnode.get_node();
         GdomeNode* newChild=as_node(params, 0, "newChild must be node");          GdomeNode* newChild=as_node(params, 0, "newChild must be node");
         GdomeNode* refChild=as_node(params, 1, "refChild must be node");          GdomeNode* oldChild=as_node(params, 1, "oldChild must be node");
                   
         GdomeException exc;          GdomeException exc;
         if(GdomeNode* retNode=gdome_n_replaceChild(selfNode, newChild, refChild, &exc)) {          if(GdomeNode* retNode=gdome_n_replaceChild(selfNode, newChild, oldChild, &exc)) {
                 // write out result                  // write out result
                 r.write_no_lang(*new VXnode(&r.charsets, retNode));                  r.write_no_lang(*new VXnode(&r.charsets, retNode));
         } else          } else
                 throw Exception(0, exc);                  throw XmlException(0, exc);
 }  }
   
 // Node removeChild(in Node oldChild) raises(DOMException);  // Node removeChild(in Node oldChild) raises(DOMException);
Line 175  static void _removeChild(Request& r, Met Line 175  static void _removeChild(Request& r, Met
                 // write out result                  // write out result
                 r.write_no_lang(*new VXnode(&r.charsets, retNode));                  r.write_no_lang(*new VXnode(&r.charsets, retNode));
         } else          } else
                 throw Exception(0, exc);                  throw XmlException(0, exc);
 }  }
   
 // Node appendChild(in Node newChild) raises(DOMException);  // Node appendChild(in Node newChild) raises(DOMException);
Line 189  static void _appendChild(Request& r, Met Line 189  static void _appendChild(Request& r, Met
                 // write out result                  // write out result
                 r.write_no_lang(*new VXnode(&r.charsets, retNode));                               r.write_no_lang(*new VXnode(&r.charsets, retNode));             
         }  else          }  else
                 throw Exception(0, exc);                  throw XmlException(0, exc);
 }  }
   
 // boolean hasChildNodes();  // boolean hasChildNodes();
Line 232  GdomeElement* get_self_element(Request& Line 232  GdomeElement* get_self_element(Request&
   
   
   
 // DOMString getAttribute(in DOMString name);  /// @bug attribute_value must be freed!  [// DOMString getAttribute(in DOMString name);
 static void _getAttribute(Request& r, MethodParams& params) {  static void _getAttribute(Request& r, MethodParams& params) {
         GdomeElement* element=get_self_element(r);          GdomeElement* element=get_self_element(r);
         const String& name=params.as_string(0, "name must be string");          const String& name=params.as_string(0, "name must be string");
Line 256  static void _setAttribute(Request& r, Me Line 256  static void _setAttribute(Request& r, Me
                 r.transcode(attribute_value).use(),                  r.transcode(attribute_value).use(),
                 &exc);                  &exc);
         if(exc)          if(exc)
                 throw Exception(0, exc);                  throw XmlException(0, exc);
 }  }
   
 // void removeAttribute(in DOMString name) raises(DOMException);  // void removeAttribute(in DOMString name) raises(DOMException);
Line 267  static void _removeAttribute(Request& r, Line 267  static void _removeAttribute(Request& r,
         GdomeException exc;          GdomeException exc;
         gdome_el_removeAttribute(element, r.transcode(name).use(), &exc);          gdome_el_removeAttribute(element, r.transcode(name).use(), &exc);
         if(exc)          if(exc)
                 throw Exception(0, exc);                  throw XmlException(0, exc);
 }  }
   
 // Attr getAttributeNode(in DOMString name);  // Attr getAttributeNode(in DOMString name);
Line 281  static void _getAttributeNode(Request& r Line 281  static void _getAttributeNode(Request& r
                 // write out result                  // write out result
                 r.write_no_lang(*new VXnode(&r.charsets, (GdomeNode* )attr));                  r.write_no_lang(*new VXnode(&r.charsets, (GdomeNode* )attr));
         } else if(exc)          } else if(exc)
                 throw Exception(                  throw XmlException(0, exc);
                         0,   
                         exc);  
 }         }       
   
 // Attr setAttributeNode(in Attr newAttr) raises(DOMException);  // Attr setAttributeNode(in Attr newAttr) raises(DOMException);
Line 296  static void _setAttributeNode(Request& r Line 294  static void _setAttributeNode(Request& r
                 // write out result                  // write out result
                 r.write_no_lang(*new VXnode(&r.charsets, (GdomeNode* )returnAttr));                  r.write_no_lang(*new VXnode(&r.charsets, (GdomeNode* )returnAttr));
         } else          } else
                 throw Exception(                  throw XmlException(0, exc);
                         0,   
                         exc);  
 }         }       
   
 // Attr removeAttributeNode(in Attr oldAttr) raises(DOMException);  // Attr removeAttributeNode(in Attr oldAttr) raises(DOMException);
Line 309  static void _removeAttributeNode(Request Line 305  static void _removeAttributeNode(Request
         GdomeException exc;          GdomeException exc;
         gdome_el_removeAttributeNode(element, oldAttr, &exc);          gdome_el_removeAttributeNode(element, oldAttr, &exc);
         if(exc)          if(exc)
                 throw Exception(                  throw XmlException(0, exc);
                         0,   
                         exc);  
 }         }       
   
 // NodeList getElementsByTagName(in DOMString name);  // NodeList getElementsByTagName(in DOMString name);
Line 330  static void _getElementsByTagName(Reques Line 324  static void _getElementsByTagName(Reques
                                 String::Body::Format(i),                                   String::Body::Format(i), 
                                 new VXnode(&r.charsets, gdome_nl_item(nodes, i, &exc)));                                  new VXnode(&r.charsets, gdome_nl_item(nodes, i, &exc)));
         } else if(exc)          } else if(exc)
                 throw Exception(                  throw XmlException(0, exc);
                         0,   
                         exc);  
   
         // write out result          // write out result
         r.write_no_lang(result);          r.write_no_lang(result);
Line 370  static void _setAttributeNS(Request& r, Line 362  static void _setAttributeNS(Request& r,
                 r.transcode(attribute_value).use(),                  r.transcode(attribute_value).use(),
                 &exc);                  &exc);
         if(exc)          if(exc)
                 throw Exception(0, exc);                  throw XmlException(0, exc);
 }  }
   
 // void removeAttributeNS(in DOMString namespaceURI, in DOMString localName) raises(DOMException);  // void removeAttributeNS(in DOMString namespaceURI, in DOMString localName) raises(DOMException);
Line 385  static void _removeAttributeNS(Request& Line 377  static void _removeAttributeNS(Request&
         r.transcode(localName).use(),           r.transcode(localName).use(), 
         &exc);          &exc);
         if(exc)          if(exc)
                 throw Exception(0, exc);                  throw XmlException(0, exc);
 }  }
   
 // Attr getAttributeNodeNS(in DOMString namespaceURI, in DOMString localName);  // Attr getAttributeNodeNS(in DOMString namespaceURI, in DOMString localName);
Line 400  static void _getAttributeNodeNS(Request& Line 392  static void _getAttributeNodeNS(Request&
                 // write out result                  // write out result
                 r.write_no_lang(*new VXnode(&r.charsets, (GdomeNode* )attr));                  r.write_no_lang(*new VXnode(&r.charsets, (GdomeNode* )attr));
         } else if(exc)          } else if(exc)
                 throw Exception(                  throw XmlException(0, exc);
                         0,   
                         exc);  
 }  }
   
 // Attr setAttributeNodeNS(in Attr newAttr) raises(DOMException);  // Attr setAttributeNodeNS(in Attr newAttr) raises(DOMException);
Line 415  static void _setAttributeNodeNS(Request& Line 405  static void _setAttributeNodeNS(Request&
                 // write out result                  // write out result
                 r.write_no_lang(*new VXnode(&r.charsets, (GdomeNode* )returnAttr));                  r.write_no_lang(*new VXnode(&r.charsets, (GdomeNode* )returnAttr));
         } else          } else
                 throw Exception(                  throw XmlException(0, exc);
                         0,   
                         exc);  
 }  }
   
 // boolean hasAttribute(in DOMString name) raises(DOMException);  // boolean hasAttribute(in DOMString name) raises(DOMException);
Line 484  static void _normalize(Request& r, Metho Line 472  static void _normalize(Request& r, Metho
         GdomeException exc;          GdomeException exc;
         gdome_n_normalize(selfNode, &exc);          gdome_n_normalize(selfNode, &exc);
         if(exc)          if(exc)
                 throw Exception(                  throw XmlException(0, exc);
                         0,   
                         exc);  
 }  }
   
 static void _selectX(Request& r, MethodParams& params,  static void _selectX(Request& r, MethodParams& params,
Line 513  static void _selectX(Request& r, MethodP Line 499  static void _selectX(Request& r, MethodP
   
         if(xmlHaveGenericErrors()) {          if(xmlHaveGenericErrors()) {
                 GdomeException exc=0;                  GdomeException exc=0;
                 throw Exception(&expression, exc);                  throw XmlException(&expression, exc);
         }          }
   
         Value* result=0;          Value* result=0;
Line 588  static void selectNodeHandler(Request& r Line 574  static void selectNodeHandler(Request& r
         }          }
 }  }
   
 static void selectBoolHandler(Request& r,  static void selectBoolHandler(Request&,
                               const String& expression,                                const String& expression,
                               xmlXPathObject_auto_ptr res,                                xmlXPathObject_auto_ptr res,
                               Value*& result) {                                Value*& result) {
Line 608  static void selectBoolHandler(Request& r Line 594  static void selectBoolHandler(Request& r
         }          }
 }  }
   
 static void selectNumberHandler(Request& r,  static void selectNumberHandler(Request&,
                                 const String& expression,                                  const String& expression,
                                 xmlXPathObject_auto_ptr res,                                  xmlXPathObject_auto_ptr res,
                                 Value*& result) {                                  Value*& result) {

Removed from v.1.59  
changed lines
  Added in v.1.65


E-mail: