Diff for /parser3/src/classes/xnode.C between versions 1.57 and 1.60

version 1.57, 2003/09/22 07:05:53 version 1.60, 2003/11/06 09:15:16
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 146  static void _insertBefore(Request& r, Me Line 147  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 161  static void _replaceChild(Request& r, Me Line 162  static void _replaceChild(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 removeChild(in Node oldChild) raises(DOMException);  // Node removeChild(in Node oldChild) raises(DOMException);
Line 175  static void _removeChild(Request& r, Met Line 176  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 190  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 256  static void _setAttribute(Request& r, Me Line 257  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 268  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 282  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 295  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 306  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 327  static void _getElementsByTagName(Reques Line 322  static void _getElementsByTagName(Reques
                 gulong length=gdome_nl_length(nodes, &exc);                  gulong length=gdome_nl_length(nodes, &exc);
                 for(gulong i=0; i<length; i++)                  for(gulong i=0; i<length; i++)
                         result.hash().put(                          result.hash().put(
                                 StringBody::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 340  static void _getElementsByTagName(Reques Line 333  static void _getElementsByTagName(Reques
   
 // DOM 2  // DOM 2
   
 // DOMString getAttributeNS(in DOMString name);  // DOMString getAttributeNS(in DOMString namespaceURI, in DOMString localName);
 static void _getAttributeNS(Request& r, MethodParams& params) {  static void _getAttributeNS(Request& r, MethodParams& params) {
         GdomeElement* element=get_self_element(r);          GdomeElement* element=get_self_element(r);
                   
Line 356  static void _getAttributeNS(Request& r, Line 349  static void _getAttributeNS(Request& r,
         r.write_no_lang(r.transcode(attribute_value));          r.write_no_lang(r.transcode(attribute_value));
 }  }
   
 // void setAttributeNS(in DOMString name, in DOMString value) raises(DOMException);  // void setAttributeNS(in DOMString namespaceURI, in DOMString qualifiedName, in DOMString value) raises(DOMException);
 static void _setAttributeNS(Request& r, MethodParams& params) {  static void _setAttributeNS(Request& r, MethodParams& params) {
         GdomeElement* element=get_self_element(r);          GdomeElement* element=get_self_element(r);
         const String& namespaceURI=params.as_string(0, "namespaceURI must be string");          const String& namespaceURI=params.as_string(0, "namespaceURI must be string");
Line 370  static void _setAttributeNS(Request& r, Line 363  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 name) raises(DOMException);  // void removeAttributeNS(in DOMString namespaceURI, in DOMString localName) raises(DOMException);
 static void _removeAttributeNS(Request& r, MethodParams& params) {  static void _removeAttributeNS(Request& r, MethodParams& params) {
         GdomeElement* element=get_self_element(r);          GdomeElement* element=get_self_element(r);
         const String& namespaceURI=params.as_string(0, "namespaceURI must be string");          const String& namespaceURI=params.as_string(0, "namespaceURI must be string");
Line 385  static void _removeAttributeNS(Request& Line 378  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 name);  // Attr getAttributeNodeNS(in DOMString namespaceURI, in DOMString localName);
 static void _getAttributeNodeNS(Request& r, MethodParams& params) {  static void _getAttributeNodeNS(Request& r, MethodParams& params) {
         GdomeElement* element=get_self_element(r);          GdomeElement* element=get_self_element(r);
         const String& namespaceURI=params.as_string(0, "namespaceURI must be string");          const String& namespaceURI=params.as_string(0, "namespaceURI must be string");
Line 400  static void _getAttributeNodeNS(Request& Line 393  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 406  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();  // boolean hasAttribute(in DOMString name) raises(DOMException);
 static void _hasAttribute(Request& r, MethodParams& params) {  static void _hasAttribute(Request& r, MethodParams& params) {
         GdomeElement* element=get_self_element(r);          GdomeElement* element=get_self_element(r);
   
Line 434  static void _hasAttribute(Request& r, Me Line 423  static void _hasAttribute(Request& r, Me
         r.write_no_lang(*new VBool(result));          r.write_no_lang(*new VBool(result));
 }  }
   
 // boolean hasAttributeNS();  // boolean hasAttributeNS(n DOMString namespaceURI, in DOMString localName) raises(DOMException);
 static void _hasAttributeNS(Request& r, MethodParams& params) {  static void _hasAttributeNS(Request& r, MethodParams& params) {
         GdomeElement* element=get_self_element(r);          GdomeElement* element=get_self_element(r);
   
Line 468  static void _getElementsByTagNameNS(Requ Line 457  static void _getElementsByTagNameNS(Requ
                 gulong length=gdome_nl_length(nodes, &exc);                  gulong length=gdome_nl_length(nodes, &exc);
                 for(gulong i=0; i<length; i++)                  for(gulong i=0; i<length; i++)
                         result.hash().put(                          result.hash().put(
                                 StringBody::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)));
         }          }
   
Line 484  static void _normalize(Request& r, Metho Line 473  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 500  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 537  static void selectNodesHandler(Request& Line 524  static void selectNodesHandler(Request&
                                 HashStringValue& hash=vhash.hash();                                  HashStringValue& hash=vhash.hash();
                                 for(int i=0; i<size; i++)                                  for(int i=0; i<size; i++)
                                         hash.put(                                          hash.put(
                                                 StringBody::Format(i),                                                   String::Body::Format(i), 
                                                 new VXnode(                                                  new VXnode(
                                                         &r.charsets,                                                           &r.charsets, 
                                                         gdome_xml_n_mkref(res->nodesetval->nodeTab[i])));                                                          gdome_xml_n_mkref(res->nodesetval->nodeTab[i])));
Line 719  MXnode::MXnode(const char* aname, VState Line 706  MXnode::MXnode(const char* aname, VState
   
         /// DOM2 element          /// DOM2 element
   
         // DOMString getAttributeNS(in DOMString name);          // DOMString getAttributeNS(in DOMString namespaceURI, in DOMString localName);
         add_native_method("getAttributeNS", Method::CT_DYNAMIC, _getAttributeNS, 2, 2);          add_native_method("getAttributeNS", Method::CT_DYNAMIC, _getAttributeNS, 2, 2);
         // void setAttributeNS(in DOMString name, in DOMString value) raises(DOMException);          // void setAttributeNS(in DOMString namespaceURI, in DOMString qualifiedName, in DOMString value) raises(DOMException);
         add_native_method("setAttributeNS", Method::CT_DYNAMIC, _setAttributeNS, 3, 3);          add_native_method("setAttributeNS", Method::CT_DYNAMIC, _setAttributeNS, 3, 3);
         // void removeAttributeNS(in DOMString name) raises(DOMException);          // void removeAttributeNS(in DOMString namespaceURI, in DOMString localName) raises(DOMException);
         add_native_method("removeAttributeNS", Method::CT_DYNAMIC, _removeAttributeNS, 2, 2);          add_native_method("removeAttributeNS", Method::CT_DYNAMIC, _removeAttributeNS, 2, 2);
         // Attr getAttributeNodeNS(in DOMString name);          // Attr getAttributeNodeNS(in DOMString namespaceURI, in DOMString localName);
         add_native_method("getAttributeNodeNS", Method::CT_DYNAMIC, _getAttributeNodeNS, 2, 2);          add_native_method("getAttributeNodeNS", Method::CT_DYNAMIC, _getAttributeNodeNS, 2, 2);
         // Attr setAttributeNodeNS(in Attr newAttr) raises(DOMException);          // Attr setAttributeNodeNS(in Attr newAttr) raises(DOMException);
         add_native_method("setAttributeNodeNS", Method::CT_DYNAMIC, _setAttributeNodeNS, 1, 1);          add_native_method("setAttributeNodeNS", Method::CT_DYNAMIC, _setAttributeNodeNS, 1, 1);
         // boolean hasAttribute(in Attr newAttr) raises(DOMException);          // boolean hasAttribute(in DOMString name) raises(DOMException);
         add_native_method("hasAttribute", Method::CT_DYNAMIC, _hasAttribute, 1, 1);          add_native_method("hasAttribute", Method::CT_DYNAMIC, _hasAttribute, 1, 1);
         // boolean hasAttributeNS(in Attr newAttr) raises(DOMException);          // boolean hasAttributeNS(in DOMString namespaceURI, in DOMString localName) raises(DOMException);
         add_native_method("hasAttributeNS", Method::CT_DYNAMIC, _hasAttributeNS, 2, 2);          add_native_method("hasAttributeNS", Method::CT_DYNAMIC, _hasAttributeNS, 2, 2);
   
         /// parser          /// parser
Line 750  MXnode::MXnode(const char* aname, VState Line 737  MXnode::MXnode(const char* aname, VState
         // consts          // consts
   
 #define CONST(name) \  #define CONST(name) \
         consts.put(StringBody(#name), new VInt(GDOME_##name))          consts.put(String::Body(#name), new VInt(GDOME_##name))
   
         CONST(ELEMENT_NODE);          CONST(ELEMENT_NODE);
         CONST(ATTRIBUTE_NODE);          CONST(ATTRIBUTE_NODE);

Removed from v.1.57  
changed lines
  Added in v.1.60


E-mail: