Diff for /parser3/src/classes/xnode.C between versions 1.83 and 1.87

version 1.83, 2009/04/16 01:10:22 version 1.87, 2012/03/16 09:24:08
Line 1 Line 1
 /** @file  /** @file
         Parser: @b dom parser class.          Parser: @b dom parser class.
   
         Copyright (c) 2001-2009 ArtLebedev Group (http://www.artlebedev.com)          Copyright (c) 2001-2012 Art. Lebedev Studio (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 * const IDENT_XNODE_C="$Date$";  
   
 #include "pa_vmethod_frame.h"  #include "pa_vmethod_frame.h"
   
 #include "pa_charset.h"  #include "pa_charset.h"
Line 23  static const char * const IDENT_XNODE_C= Line 21  static const char * const IDENT_XNODE_C=
 #include "libxml/xpath.h"  #include "libxml/xpath.h"
 #include "libxml/xpathInternals.h"  #include "libxml/xpathInternals.h"
   
   volatile const char * IDENT_XNODE_C="$Id$" IDENT_XNODE_H;
   
 // global variable  // global variable
   
 DECLARE_CLASS_VAR(xnode, new MXnode, 0);  DECLARE_CLASS_VAR(xnode, new MXnode, 0);
Line 99  private: Line 99  private:
   
 xmlNode& as_node(MethodParams& params, int index, const char* msg) {  xmlNode& as_node(MethodParams& params, int index, const char* msg) {
         Value& value=params.as_no_junction(index, msg);          Value& value=params.as_no_junction(index, msg);
         if(Value* vxnode=value.as(VXNODE_TYPE, false))          if(Value* vxnode=value.as(VXNODE_TYPE))
                 return static_cast<VXnode*>(vxnode)->get_xmlnode();                  return static_cast<VXnode*>(vxnode)->get_xmlnode();
         else          else
                 throw Exception(PARSER_RUNTIME,                  throw Exception(PARSER_RUNTIME,
Line 111  xmlChar* as_xmlchar(Request& r, MethodPa Line 111  xmlChar* as_xmlchar(Request& r, MethodPa
         return r.transcode(params.as_string(index, msg));          return r.transcode(params.as_string(index, msg));
 }  }
   
   xmlChar* as_xmlqname(Request& r, MethodParams& params, int index, const char* msg) {
           xmlChar* qname=r.transcode(params.as_string(index, msg ? msg : XML_QUALIFIED_NAME_MUST_BE_STRING));
           if(xmlValidateQName(qname, 0))
                   throw XmlException(0, XML_INVALID_QUALIFIED_NAME, qname);
           return qname;
   }
   
   xmlChar* as_xmlncname(Request& r, MethodParams& params, int index, const char* msg) {
           xmlChar* ncname=r.transcode(params.as_string(index, msg ? msg : XML_NC_NAME_MUST_BE_STRING));
           if(xmlValidateNCName(ncname, 0))
                   throw XmlException(0, XML_INVALID_NC_NAME, ncname);
           return ncname;
   }
   
   xmlChar* as_xmlname(Request& r, MethodParams& params, int index, const char* msg) {
           xmlChar* localName=r.transcode(params.as_string(index, msg ? msg : XML_LOCAL_NAME_MUST_BE_STRING));
           if(xmlValidateName(localName, 0))
                   throw XmlException(0, XML_INVALID_LOCAL_NAME, localName);
           return localName;
   }
   
   xmlChar* as_xmlnsuri(Request& r, MethodParams& params, int index) {
           return r.transcode(params.as_string(index, XML_NAMESPACEURI_MUST_BE_STRING));
   }
   
 xmlAttr& as_attr(MethodParams& params, int index, const char* msg) {  xmlAttr& as_attr(MethodParams& params, int index, const char* msg) {
         xmlNode& xmlnode=as_node(params, index, msg);          xmlNode& xmlnode=as_node(params, index, msg);
         if(xmlnode.type!=XML_ATTRIBUTE_NODE)          if(xmlnode.type!=XML_ATTRIBUTE_NODE)
Line 247  pa_xmlNamedPreorderTraversal ( Line 272  pa_xmlNamedPreorderTraversal (
   
 // Node insertBefore(in Node newChild,in Node refChild) raises(DOMException);  // Node insertBefore(in Node newChild,in Node refChild) raises(DOMException);
 static void _insertBefore(Request& r, MethodParams& params) {  static void _insertBefore(Request& r, MethodParams& params) {
           xmlNode& newChild=as_node(params, 0, "newChild must be node");
           xmlNode& refChild=as_node(params, 1, "refChild must be node");
   
         VXnode& vnode=GET_SELF(r, VXnode);          VXnode& vnode=GET_SELF(r, VXnode);
         VXdoc& vxdoc=vnode.get_vxdoc();          VXdoc& vxdoc=vnode.get_vxdoc();
   
         //xmlNode& selfNode=vnode.get_xmlnode();          //xmlNode& selfNode=vnode.get_xmlnode();
         xmlNode& newChild=as_node(params, 0, "newChild must be node");  
         xmlNode& refChild=as_node(params, 1, "refChild must be node");  
                   
         xmlNode* retNode=xmlAddPrevSibling(&refChild, &newChild);          xmlNode* retNode=xmlAddPrevSibling(&refChild, &newChild);
         // write out result          // write out result
Line 261  static void _insertBefore(Request& r, Me Line 287  static void _insertBefore(Request& r, Me
   
 // Node replaceChild(in Node newChild,in Node oldChild) raises(DOMException);  // Node replaceChild(in Node newChild,in Node oldChild) raises(DOMException);
 static void _replaceChild(Request& r, MethodParams& params) {  static void _replaceChild(Request& r, MethodParams& params) {
           xmlNode& newChild=as_node(params, 0, "newChild must be node");
           xmlNode& oldChild=as_node(params, 1, "oldChild must be node");
   
         VXnode& vnode=GET_SELF(r, VXnode);          VXnode& vnode=GET_SELF(r, VXnode);
         VXdoc& vxdoc=vnode.get_vxdoc();          VXdoc& vxdoc=vnode.get_vxdoc();
         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& oldChild=as_node(params, 1, "oldChild must be node");  
   
         if(newChild.doc!=&xmldoc)          if(newChild.doc!=&xmldoc)
                 throw Exception("xml.dom",                  throw Exception("xml.dom",
Line 296  static void _replaceChild(Request& r, Me Line 323  static void _replaceChild(Request& r, Me
   
 // Node removeChild(in Node oldChild) raises(DOMException);  // Node removeChild(in Node oldChild) raises(DOMException);
 static void _removeChild(Request& r, MethodParams& params) {  static void _removeChild(Request& r, MethodParams& params) {
           xmlNode& oldChild=as_node(params, 0, "refChild must be node");
   
         VXnode& vnode=GET_SELF(r, VXnode);          VXnode& vnode=GET_SELF(r, VXnode);
         VXdoc& vxdoc=vnode.get_vxdoc();          VXdoc& vxdoc=vnode.get_vxdoc();
         xmlDoc& xmldoc=vxdoc.get_xmldoc();          xmlDoc& xmldoc=vxdoc.get_xmldoc();
 //      xmlNode& selfNode=vnode.get_xmlnode();  //      xmlNode& selfNode=vnode.get_xmlnode();
         xmlNode& oldChild=as_node(params, 0, "refChild must be node");  
                   
         if(oldChild.doc!=&xmldoc)          if(oldChild.doc!=&xmldoc)
                 throw Exception("xml.dom",                  throw Exception("xml.dom",
Line 314  static void _removeChild(Request& r, Met Line 342  static void _removeChild(Request& r, Met
   
 // Node appendChild(in Node newChild) raises(DOMException);  // Node appendChild(in Node newChild) raises(DOMException);
 static void _appendChild(Request& r, MethodParams& params) {  static void _appendChild(Request& r, MethodParams& params) {
           xmlNode& newChild=as_node(params, 0, "newChild must be node");
   
         VXnode& vnode=GET_SELF(r, VXnode);          VXnode& vnode=GET_SELF(r, VXnode);
         VXdoc& vxdoc=vnode.get_vxdoc();          VXdoc& vxdoc=vnode.get_vxdoc();
         xmlNode& selfNode=vnode.get_xmlnode();          xmlNode& selfNode=vnode.get_xmlnode();
         xmlNode& newChild=as_node(params, 0, "newChild must be node");  
                   
         xmlNode* retNode=xmlAddChild(&selfNode, &newChild);          xmlNode* retNode=xmlAddChild(&selfNode, &newChild);
         // write out result          // write out result
Line 335  static void _hasChildNodes(Request& r, M Line 364  static void _hasChildNodes(Request& r, M
   
 // Node cloneNode(in boolean deep);  // Node cloneNode(in boolean deep);
 static void _cloneNode(Request& r, MethodParams& params) {  static void _cloneNode(Request& r, MethodParams& params) {
           bool deep=params.as_bool(0, "deep must be bool", r);
   
         VXnode& vnode=GET_SELF(r, VXnode);          VXnode& vnode=GET_SELF(r, VXnode);
         xmlNode& selfNode=vnode.get_xmlnode();          xmlNode& selfNode=vnode.get_xmlnode();
         VXdoc& vxdoc=vnode.get_vxdoc();          VXdoc& vxdoc=vnode.get_vxdoc();
         xmlDoc& xmldoc=vxdoc.get_xmldoc();          xmlDoc& xmldoc=vxdoc.get_xmldoc();
   
         bool deep=params.as_bool(0, "deep must be bool", r);  
   
         xmlNode* retNode=xmlDocCopyNode(&selfNode, &xmldoc, deep?1: 0);          xmlNode* retNode=xmlDocCopyNode(&selfNode, &xmldoc, deep?1: 0);
         // write out result          // write out result
         writeNode(r, vxdoc, retNode);          writeNode(r, vxdoc, retNode);
Line 360  xmlNode& get_self_element(VXnode& vnode) Line 389  xmlNode& get_self_element(VXnode& vnode)
         return node;          return node;
 }  }
   
   // DOMString getAttribute(in DOMString name);
 static void _getAttribute(Request& r, MethodParams& params) {  static void _getAttribute(Request& r, MethodParams& params) {
           const xmlChar* name=as_xmlname(r, params, 0);
   
         VXnode& vnode=GET_SELF(r, VXnode);          VXnode& vnode=GET_SELF(r, VXnode);
         xmlNode& element=get_self_element(vnode);          xmlNode& element=get_self_element(vnode);
         const xmlChar* name=as_xmlchar(r, params, 0, NAME_MUST_BE_STRING);  
   
         // @todo: when name="xmlns"          // @todo: when name="xmlns"
         xmlChar* attribute_value=xmlGetProp(&element, name);          xmlChar* attribute_value=xmlGetProp(&element, name);
Line 374  static void _getAttribute(Request& r, Me Line 404  static void _getAttribute(Request& r, Me
   
 // void setAttribute(in DOMString name, in DOMString value) raises(DOMException);  // void setAttribute(in DOMString name, in DOMString value) raises(DOMException);
 static void _setAttribute(Request& r, MethodParams& params) {  static void _setAttribute(Request& r, MethodParams& params) {
           const xmlChar* name=as_xmlname(r, params, 0);
           const xmlChar* attribute_value=as_xmlchar(r, params, 1, XML_VALUE_MUST_BE_STRING);
   
         VXnode& vnode=GET_SELF(r, VXnode);          VXnode& vnode=GET_SELF(r, VXnode);
         xmlNode& element=get_self_element(vnode);          xmlNode& element=get_self_element(vnode);
         const xmlChar* name=as_xmlchar(r, params, 0, NAME_MUST_BE_STRING);  
         const xmlChar* attribute_value=as_xmlchar(r, params, 1, VALUE_MUST_BE_STRING);  
   
         // @todo: when name="xmlns"          // @todo: when name="xmlns"
         if(!xmlSetProp(&element, name,  attribute_value))          if(!xmlSetProp(&element, name,  attribute_value))
Line 386  static void _setAttribute(Request& r, Me Line 417  static void _setAttribute(Request& r, Me
   
 // void removeAttribute(in DOMString name) raises(DOMException);  // void removeAttribute(in DOMString name) raises(DOMException);
 static void _removeAttribute(Request& r, MethodParams& params) {  static void _removeAttribute(Request& r, MethodParams& params) {
           const xmlChar* name=as_xmlname(r, params, 0);
   
         VXnode& vnode=GET_SELF(r, VXnode);          VXnode& vnode=GET_SELF(r, VXnode);
         xmlNode& element=get_self_element(vnode);          xmlNode& element=get_self_element(vnode);
         const xmlChar* name=as_xmlchar(r, params, 0, NAME_MUST_BE_STRING);  
   
         // @todo: when name="xmlns"          // @todo: when name="xmlns"
         xmlUnsetProp(&element, name);          xmlUnsetProp(&element, name);
Line 396  static void _removeAttribute(Request& r, Line 428  static void _removeAttribute(Request& r,
   
 // Attr getAttributeNode(in DOMString name);  // Attr getAttributeNode(in DOMString name);
 static void _getAttributeNode(Request& r, MethodParams& params) {  static void _getAttributeNode(Request& r, MethodParams& params) {
           const xmlChar* localName=as_xmlname(r, params, 0);
   
         VXnode& vnode=GET_SELF(r, VXnode);          VXnode& vnode=GET_SELF(r, VXnode);
         VXdoc& vxdoc=vnode.get_vxdoc();          VXdoc& vxdoc=vnode.get_vxdoc();
         xmlNode& element=get_self_element(vnode);          xmlNode& element=get_self_element(vnode);
         const xmlChar* localName=as_xmlchar(r, params, 0, NAME_MUST_BE_STRING);  
   
         if(xmlNode* retNode=pa_getAttributeNodeNS(element, localName, 0)){          if(xmlNode* retNode=pa_getAttributeNodeNS(element, localName, 0)){
                 // write out result                  // write out result
Line 414  static void _setAttributeNode(Request& r Line 447  static void _setAttributeNode(Request& r
         VXdoc& vxdoc=vnode.get_vxdoc();          VXdoc& vxdoc=vnode.get_vxdoc();
         xmlNode& element=get_self_element(vnode);          xmlNode& element=get_self_element(vnode);
         xmlDoc& xmldoc=vxdoc.get_xmldoc();          xmlDoc& xmldoc=vxdoc.get_xmldoc();
   
         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)
Line 437  static void _setAttributeNode(Request& r Line 471  static void _setAttributeNode(Request& r
   
 // Attr removeAttributeNode(in Attr oldAttr) raises(DOMException);  // Attr removeAttributeNode(in Attr oldAttr) raises(DOMException);
 static void _removeAttributeNode(Request& r, MethodParams& params) {  static void _removeAttributeNode(Request& r, MethodParams& params) {
           xmlAttr& oldAttr=as_attr(params, 0, "oldAttr must be ATTRIBUTE node");
   
         VXnode& vnode=GET_SELF(r, VXnode);          VXnode& vnode=GET_SELF(r, VXnode);
         VXdoc& vxdoc=vnode.get_vxdoc();          VXdoc& vxdoc=vnode.get_vxdoc();
         xmlNode& element=get_self_element(vnode);          xmlNode& element=get_self_element(vnode);
         xmlAttr& oldAttr=as_attr(params, 0, "oldAttr must be ATTRIBUTE node");  
   
         if(oldAttr.parent!=&element)          if(oldAttr.parent!=&element)
                 throw Exception("xml.dom",                  throw Exception("xml.dom",
Line 454  static void _removeAttributeNode(Request Line 489  static void _removeAttributeNode(Request
 }         }       
   
 // NodeList getElementsByTagName(in DOMString name);  // NodeList getElementsByTagName(in DOMString name);
   // '*' means all tags
 static void _getElementsByTagName(Request& r, MethodParams& params) {  static void _getElementsByTagName(Request& r, MethodParams& params) {
           xmlChar* tagName=as_xmlchar(r, params, 0, XML_LOCAL_NAME_MUST_BE_STRING);
           if(xmlValidateName(tagName, 0) != 0 && strcmp((const char*)tagName, "*") != 0)
                   throw XmlException(0, XML_INVALID_LOCAL_NAME, tagName);
   
         VXnode& vnode=GET_SELF(r, VXnode);          VXnode& vnode=GET_SELF(r, VXnode);
         VXdoc& vxdoc=vnode.get_vxdoc();          VXdoc& vxdoc=vnode.get_vxdoc();
         xmlNode& xmlnode=vnode.get_xmlnode();          xmlNode& xmlnode=vnode.get_xmlnode();
   
         xmlChar* tagName=as_xmlchar(r, params, 0, NAME_MUST_BE_STRING);  
   
         VHash& result=*new VHash;          VHash& result=*new VHash;
         AccumulateFoundInfo info={&result.hash(), &vxdoc, 0};          AccumulateFoundInfo info={&result.hash(), &vxdoc, 0};
         pa_xmlNamedPreorderTraversal(&xmlnode,           pa_xmlNamedPreorderTraversal(&xmlnode, 
Line 477  static void _getElementsByTagName(Reques Line 515  static void _getElementsByTagName(Reques
   
 // DOMString getAttributeNS(in DOMString namespaceURI, in DOMString localName);  // DOMString getAttributeNS(in DOMString namespaceURI, in DOMString localName);
 static void _getAttributeNS(Request& r, MethodParams& params) {  static void _getAttributeNS(Request& r, MethodParams& params) {
           xmlChar* namespaceURI=as_xmlnsuri(r, params, 0);
           xmlChar* localName=as_xmlname(r, params, 1);
   
         VXnode& vnode=GET_SELF(r, VXnode);          VXnode& vnode=GET_SELF(r, VXnode);
         xmlNode& element=get_self_element(vnode);          xmlNode& element=get_self_element(vnode);
                   
         xmlChar* namespaceURI=as_xmlchar(r, params, 0, NAMESPACEURI_MUST_BE_STRING);  
         xmlChar* localName=as_xmlchar(r, params, 1, LOCALNAME_MUST_BE_STRING);  
   
         // todo: when name="xmlns"          // todo: when name="xmlns"
         xmlChar* attribute_value=xmlGetNsProp(&element, localName, namespaceURI);          xmlChar* attribute_value=xmlGetNsProp(&element, localName, namespaceURI);
         // write out result          // write out result
Line 492  static void _getAttributeNS(Request& r, Line 530  static void _getAttributeNS(Request& r,
   
 // void setAttributeNS(in DOMString namespaceURI, in DOMString qualifiedName, 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) {
           const xmlChar* namespaceURI=as_xmlnsuri(r, params, 0);
           const xmlChar* qualifiedName=as_xmlqname(r, params, 1);
           const xmlChar* attribute_value=as_xmlchar(r, params, 2, XML_VALUE_MUST_BE_STRING);
   
         VXnode& vnode=GET_SELF(r, VXnode);          VXnode& vnode=GET_SELF(r, VXnode);
         xmlNode& element=get_self_element(vnode);          xmlNode& element=get_self_element(vnode);
         VXdoc& vxdoc=vnode.get_vxdoc();          VXdoc& vxdoc=vnode.get_vxdoc();
         xmlDoc& xmldoc=vxdoc.get_xmldoc();          xmlDoc& xmldoc=vxdoc.get_xmldoc();
         const xmlChar* namespaceURI=as_xmlchar(r, params, 0, NAMESPACEURI_MUST_BE_STRING);  
         const xmlChar* qualifiedName=as_xmlchar(r, params, 1, "qualifiedName must be string");  
         const xmlChar* attribute_value=as_xmlchar(r, params, 2, VALUE_MUST_BE_STRING);  
   
         xmlChar* prefix=0;          xmlChar* prefix=0;
         xmlChar* localName=xmlSplitQName2(qualifiedName, &prefix);          xmlChar* localName=xmlSplitQName2(qualifiedName, &prefix);
Line 523  static void _setAttributeNS(Request& r, Line 562  static void _setAttributeNS(Request& r,
   
 // void removeAttributeNS(in DOMString namespaceURI, in DOMString localName) 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) {
           const xmlChar* namespaceURI=as_xmlnsuri(r, params, 0);
           const xmlChar* localName=as_xmlname(r, params, 1);
   
         VXnode& vnode=GET_SELF(r, VXnode);          VXnode& vnode=GET_SELF(r, VXnode);
         xmlNode& element=get_self_element(vnode);          xmlNode& element=get_self_element(vnode);
         VXdoc& vxdoc=vnode.get_vxdoc();          VXdoc& vxdoc=vnode.get_vxdoc();
         xmlDoc& xmldoc=vxdoc.get_xmldoc();          xmlDoc& xmldoc=vxdoc.get_xmldoc();
         const xmlChar* namespaceURI=as_xmlchar(r, params, 0, NAMESPACEURI_MUST_BE_STRING);  
         const xmlChar* localName=as_xmlchar(r, params, 1, LOCALNAME_MUST_BE_STRING);  
   
         // @todo: when name="xmlns"          // @todo: when name="xmlns"
         xmlNs& ns=pa_xmlMapNs(xmldoc, namespaceURI, 0);          xmlNs& ns=pa_xmlMapNs(xmldoc, namespaceURI, 0);
Line 537  static void _removeAttributeNS(Request& Line 577  static void _removeAttributeNS(Request&
   
 // Attr getAttributeNodeNS(in DOMString namespaceURI, in DOMString localName);  // Attr getAttributeNodeNS(in DOMString namespaceURI, in DOMString localName);
 static void _getAttributeNodeNS(Request& r, MethodParams& params) {  static void _getAttributeNodeNS(Request& r, MethodParams& params) {
           const xmlChar* namespaceURI=as_xmlnsuri(r, params, 0);
           const xmlChar* localName=as_xmlname(r, params, 1);
   
         VXnode& vnode=GET_SELF(r, VXnode);          VXnode& vnode=GET_SELF(r, VXnode);
         VXdoc& vxdoc=vnode.get_vxdoc();          VXdoc& vxdoc=vnode.get_vxdoc();
         xmlNode& element=get_self_element(vnode);          xmlNode& element=get_self_element(vnode);
         const xmlChar* namespaceURI=as_xmlchar(r, params, 0, NAMESPACEURI_MUST_BE_STRING);  
         const xmlChar* localName=as_xmlchar(r, params, 1, LOCALNAME_MUST_BE_STRING);  
   
         if(xmlNode* retNode=pa_getAttributeNodeNS(element, localName, namespaceURI)){          if(xmlNode* retNode=pa_getAttributeNodeNS(element, localName, namespaceURI)){
                 // write out result                  // write out result
Line 551  static void _getAttributeNodeNS(Request& Line 592  static void _getAttributeNodeNS(Request&
   
 // boolean hasAttribute(in DOMString name) raises(DOMException);  // boolean hasAttribute(in DOMString name) raises(DOMException);
 static void _hasAttribute(Request& r, MethodParams& params) {  static void _hasAttribute(Request& r, MethodParams& params) {
           const xmlChar* name=as_xmlname(r, params, 0);
   
         VXnode& vnode=GET_SELF(r, VXnode);          VXnode& vnode=GET_SELF(r, VXnode);
         xmlNode& element=get_self_element(vnode);          xmlNode& element=get_self_element(vnode);
   
         const xmlChar* name=as_xmlchar(r, params, 0, NAME_MUST_BE_STRING);  
   
         // @todo: when name="xmlns"          // @todo: when name="xmlns"
         // write out result          // write out result
         r.write_no_lang(VBool::get(xmlHasProp(&element, name)!=0));          r.write_no_lang(VBool::get(xmlHasProp(&element, name)!=0));
Line 563  static void _hasAttribute(Request& r, Me Line 604  static void _hasAttribute(Request& r, Me
   
 // boolean hasAttributeNS(n DOMString namespaceURI, in DOMString localName) raises(DOMException);  // boolean hasAttributeNS(n DOMString namespaceURI, in DOMString localName) raises(DOMException);
 static void _hasAttributeNS(Request& r, MethodParams& params) {  static void _hasAttributeNS(Request& r, MethodParams& params) {
           const xmlChar* namespaceURI=as_xmlnsuri(r, params, 0);
           const xmlChar* localName=as_xmlname(r, params, 1);
   
         VXnode& vnode=GET_SELF(r, VXnode);          VXnode& vnode=GET_SELF(r, VXnode);
         xmlNode& element=get_self_element(vnode);          xmlNode& element=get_self_element(vnode);
   
         const xmlChar* namespaceURI=as_xmlchar(r, params, 0, NAMESPACEURI_MUST_BE_STRING);  
         const xmlChar* localName=as_xmlchar(r, params, 1, LOCALNAME_MUST_BE_STRING);  
   
         // write out result          // write out result
         r.write_no_lang(VBool::get(xmlHasNsProp(&element, localName, namespaceURI)!=0));          r.write_no_lang(VBool::get(xmlHasNsProp(&element, localName, namespaceURI)!=0));
 }  }
Line 582  static void _hasAttributes(Request& r, M Line 623  static void _hasAttributes(Request& r, M
         r.write_no_lang(VBool::get(element.properties!=0));          r.write_no_lang(VBool::get(element.properties!=0));
 }  }
   
   // NodeList getElementsByTagNameNS(in DOMString namespaceURI, in DOMString localName);
   // '*' as namespaceURI means get all namespaces
   // '*' as localName means get all tags
 static void _getElementsByTagNameNS(Request& r, MethodParams& params) {  static void _getElementsByTagNameNS(Request& r, MethodParams& params) {
           xmlChar* namespaceURI=as_xmlchar(r, params, 0, XML_NAMESPACEURI_MUST_BE_STRING);
   
           xmlChar* localName=as_xmlchar(r, params, 1, XML_LOCAL_NAME_MUST_BE_STRING);
           if(xmlValidateName(localName, 0) != 0 && strcmp((const char*)localName, "*") != 0)
                   throw XmlException(0, XML_INVALID_LOCAL_NAME, localName);
   
         VXnode& vnode=GET_SELF(r, VXnode);          VXnode& vnode=GET_SELF(r, VXnode);
         VXdoc& vdoc=vnode.get_vxdoc();          VXdoc& vdoc=vnode.get_vxdoc();
         xmlDoc& xmldoc=vdoc.get_xmldoc();          xmlDoc& xmldoc=vdoc.get_xmldoc();
   
         // namespaceURI;localName  
         xmlChar* namespaceURI=as_xmlchar(r, params, 0, NAMESPACEURI_MUST_BE_STRING);  
         xmlChar* localName=as_xmlchar(r, params, 1, NAME_MUST_BE_STRING);  
   
         VHash& result=*new VHash;          VHash& result=*new VHash;
         AccumulateFoundInfo info={&result.hash(), &vdoc, 0};          AccumulateFoundInfo info={&result.hash(), &vdoc, 0};
         pa_xmlNamedPreorderTraversal((xmlNode*)&xmldoc,           pa_xmlNamedPreorderTraversal((xmlNode*)&xmldoc, 

Removed from v.1.83  
changed lines
  Added in v.1.87


E-mail: