--- parser3/src/classes/xnode.C 2012/03/16 09:24:08 1.87 +++ parser3/src/classes/xnode.C 2016/04/06 16:08:19 1.93 @@ -1,7 +1,7 @@ /** @file Parser: @b dom parser class. - Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ #include "classes.h" @@ -21,11 +21,11 @@ #include "libxml/xpath.h" #include "libxml/xpathInternals.h" -volatile const char * IDENT_XNODE_C="$Id: xnode.C,v 1.87 2012/03/16 09:24:08 moko Exp $" IDENT_XNODE_H; +volatile const char * IDENT_XNODE_C="$Id: xnode.C,v 1.93 2016/04/06 16:08:19 moko Exp $" IDENT_XNODE_H; // global variable -DECLARE_CLASS_VAR(xnode, new MXnode, 0); +DECLARE_CLASS_VAR(xnode, new MXnode); // classes @@ -148,7 +148,7 @@ xmlAttr& as_attr(MethodParams& params, i static void writeNode(Request& r, VXdoc& xdoc, xmlNode* node) { if(!node|| xmlHaveGenericErrors()) - throw XmlException(0); // OOM, bad name, things like that + throw XmlException(0, r); // OOM, bad name, things like that // write out result r.write_no_lang(xdoc.wrap(*node)); @@ -162,7 +162,7 @@ static xmlNode* pa_getAttributeNodeNS(xm currentNode; currentNode=currentNode->next) { - if(!namespaceURI || currentNode->ns && xmlStrEqual(currentNode->ns->href, namespaceURI)) + if(!namespaceURI || (currentNode->ns && xmlStrEqual(currentNode->ns->href, namespaceURI)) ) if(!localName || xmlStrEqual(currentNode->name, localName)) return currentNode; } @@ -184,7 +184,7 @@ xmlNs& pa_xmlMapNs(xmlDoc& doc, const xm if (cur == NULL) { cur = xmlNewNs (NULL, href, prefix); if(!cur || xmlHaveGenericErrors()) - throw XmlException(0); + throw XmlException(); cur->next = doc.oldNs; doc.oldNs = cur; } @@ -412,7 +412,7 @@ static void _setAttribute(Request& r, Me // @todo: when name="xmlns" if(!xmlSetProp(&element, name, attribute_value)) - throw XmlException(0); + throw XmlException(0, r); } // void removeAttribute(in DOMString name) raises(DOMException); @@ -557,7 +557,7 @@ static void _setAttributeNS(Request& r, } if(!attrNode) - throw XmlException(0); + throw XmlException(0, r); } // void removeAttributeNS(in DOMString namespaceURI, in DOMString localName) raises(DOMException); @@ -706,7 +706,7 @@ static void _selectX(Request& r, MethodP xmlXPathEvalExpression(r.transcode(expression), ctxt.get())); if(xmlHaveGenericErrors()) - throw XmlException(0); + throw XmlException(0, r); Value* result=0; if(res.get()) @@ -869,9 +869,7 @@ static void _selectString(Request& r, Me // constructor /// @bug one can change const and ruin other's work, we need unchangable VIntConst class -MXnode::MXnode(const char* aname, VStateless_class *abase): - Methoded(aname?aname:"xnode", abase) -{ +MXnode::MXnode(const char* aname): Methoded(aname?aname:"xnode") { /// DOM1 node // Node insertBefore(in Node newChild,in Node refChild) raises(DOMException); @@ -943,10 +941,8 @@ MXnode::MXnode(const char* aname, VState // consts -#define CONST(name) \ - consts.put(String::Body(#name), new VInt(XML_##name)) -#define CONST2(name, value) \ - consts.put(String::Body(#name), new VInt(value)) +#define CONST(name) consts.put(#name, new VInt(XML_##name)) +#define CONST2(name, value) consts.put(#name, new VInt(value)) CONST(ELEMENT_NODE); CONST(ATTRIBUTE_NODE); @@ -966,6 +962,6 @@ MXnode::MXnode(const char* aname, VState // global variable -DECLARE_CLASS_VAR(xnode, 0, 0); // fictive +DECLARE_CLASS_VAR(xnode, 0); // fictive #endif