Diff for /parser3/src/classes/xnode.C between versions 1.35 and 1.39

version 1.35, 2002/01/28 10:50:03 version 1.39, 2002/02/19 15:03:10
Line 1 Line 1
 /** @file  /** @file
         Parser: @b dom parser class.          Parser: @b dom parser class.
   
         Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)          Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com)
         Author: Alexander Petrosyan <paf@design.ru> (http://paf.design.ru)          Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
   
         $Id$          $Id$
 */  */
Line 101  private: Line 101  private:
 GdomeNode *as_node(Pool& pool, const String& method_name, MethodParams *params,   GdomeNode *as_node(Pool& pool, const String& method_name, MethodParams *params, 
                                                 int index, const char *msg) {                                                  int index, const char *msg) {
         Value& value=params->as_no_junction(index, msg);          Value& value=params->as_no_junction(index, msg);
         if(strcmp(value.type(), VXNODE_TYPE)!=0           if(!(strcmp(value.type(), VXNODE_TYPE)==0 
                 || strcmp(value.type(), VXDOC_TYPE)!=0)                  || strcmp(value.type(), VXDOC_TYPE)==0))
                 throw Exception(0, 0,                  throw Exception(0, 0,
                         &method_name,                          &method_name,
                         msg);                          msg);
Line 368  static void _getElementsByTagName(Reques Line 368  static void _getElementsByTagName(Reques
         r.write_no_lang(result);          r.write_no_lang(result);
 }  }
   
   static void _getElementsByTagNameNS(Request& r, const String& method_name, MethodParams *params) {
           Pool& pool=r.pool();
           GdomeElement *element=get_self_element(r, method_name);
   
           // namespaceURI;localName
           const String& namespaceURI=params->as_string(0, "namespaceURI must be string");
           const String& localName=params->as_string(1, "localName must be string");
   
           GdomeException exc;
           VHash& result=*new(pool) VHash(pool);
           if(GdomeNodeList *nodes=
                   gdome_el_getElementsByTagNameNS(
                           element, 
                           pool.transcode(namespaceURI).get(),
                           pool.transcode(localName).get(),
                           &exc)) {
                   gulong length=gdome_nl_length(nodes, &exc);
                   for(gulong i=0; i<length; i++) {
                           String& skey=*new(pool) String(pool);
                           {
                                   char *buf=(char *)pool.malloc(MAX_NUMBER);
                                   snprintf(buf, MAX_NUMBER, "%d", i);
                                   skey << buf;
                           }
   
                           result.hash(0).put(skey, new(pool) VXnode(pool, gdome_nl_item(nodes, i, &exc)));
                   }
           }
   
           // write out result
           r.write_no_lang(result);
   }
   
 // void normalize();  // void normalize();
 static void _normalize(Request& r, const String& method_name, MethodParams *) {  static void _normalize(Request& r, const String& method_name, MethodParams *) {
         Pool& pool=r.pool();          Pool& pool=r.pool();
Line 618  MXnode::MXnode(Pool& apool) : Methoded(a Line 651  MXnode::MXnode(Pool& apool) : Methoded(a
         add_native_method("removeAttributeNode", Method::CT_DYNAMIC, _removeAttributeNode, 1, 1);          add_native_method("removeAttributeNode", Method::CT_DYNAMIC, _removeAttributeNode, 1, 1);
         // NodeList getElementsByTagName(in DOMString name);          // NodeList getElementsByTagName(in DOMString name);
         add_native_method("getElementsByTagName", Method::CT_DYNAMIC, _getElementsByTagName, 1, 1);          add_native_method("getElementsByTagName", Method::CT_DYNAMIC, _getElementsByTagName, 1, 1);
           // NodeList getElementsByTagNameNS(in DOMString namespaceURI, in DOMString localName);
           add_native_method("getElementsByTagNameNS", Method::CT_DYNAMIC, _getElementsByTagNameNS, 2, 2);
         // void normalize();          // void normalize();
         add_native_method("normalize", Method::CT_DYNAMIC, _normalize, 0, 0);          add_native_method("normalize", Method::CT_DYNAMIC, _normalize, 0, 0);
   

Removed from v.1.35  
changed lines
  Added in v.1.39


E-mail: