--- parser3/src/classes/xnode.C 2015/04/08 18:08:52 1.89 +++ parser3/src/classes/xnode.C 2024/09/11 21:07:36 1.99 @@ -1,8 +1,8 @@ /** @file Parser: @b dom parser class. - Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com) - Author: Alexandr Petrosian (http://paf.design.ru) + Copyright (c) 2001-2023 Art. Lebedev Studio (http://www.artlebedev.com) + Authors: Konstantin Morshnev , Alexandr Petrosian */ #include "classes.h" #ifdef XML @@ -21,11 +21,7 @@ #include "libxml/xpath.h" #include "libxml/xpathInternals.h" -volatile const char * IDENT_XNODE_C="$Id: xnode.C,v 1.89 2015/04/08 18:08:52 moko Exp $" IDENT_XNODE_H; - -// global variable - -DECLARE_CLASS_VAR(xnode, new MXnode, 0); +volatile const char * IDENT_XNODE_C="$Id: xnode.C,v 1.99 2024/09/11 21:07:36 moko Exp $" IDENT_XNODE_H; // classes @@ -151,7 +147,7 @@ static void writeNode(Request& r, VXdoc& throw XmlException(0, r); // OOM, bad name, things like that // write out result - r.write_no_lang(xdoc.wrap(*node)); + r.write(xdoc.wrap(*node)); } static xmlNode* pa_getAttributeNodeNS(xmlNode& selfNode, @@ -237,7 +233,7 @@ struct AccumulateFoundInfo static void AccumulateFound(xmlNode& node, AccumulateFoundInfo* info) { info->hash->put( - String::Body::Format(info->index++), + pa_uitoa(info->index++), &info->vdoc->wrap(node)); } template static void @@ -359,7 +355,7 @@ static void _hasChildNodes(Request& r, M xmlNode& node=vnode.get_xmlnode(); // write out result - r.write_no_lang(VBool::get(node.children!=0)); + r.write(VBool::get(node.children!=0)); } // Node cloneNode(in boolean deep); @@ -399,7 +395,7 @@ static void _getAttribute(Request& r, Me // @todo: when name="xmlns" xmlChar* attribute_value=xmlGetProp(&element, name); // write out result - r.write_pass_lang(r.transcode(attribute_value)); + r.write(r.transcode(attribute_value)); } // void setAttribute(in DOMString name, in DOMString value) raises(DOMException); @@ -508,7 +504,7 @@ static void _getElementsByTagName(Reques &info); // write out result - r.write_no_lang(result); + r.write(result); } // DOM 2 @@ -524,7 +520,7 @@ static void _getAttributeNS(Request& r, // todo: when name="xmlns" xmlChar* attribute_value=xmlGetNsProp(&element, localName, namespaceURI); // write out result - r.write_pass_lang(r.transcode(attribute_value)); + r.write(r.transcode(attribute_value)); } @@ -599,7 +595,7 @@ static void _hasAttribute(Request& r, Me // @todo: when name="xmlns" // write out result - r.write_no_lang(VBool::get(xmlHasProp(&element, name)!=0)); + r.write(VBool::get(xmlHasProp(&element, name)!=0)); } // boolean hasAttributeNS(n DOMString namespaceURI, in DOMString localName) raises(DOMException); @@ -611,7 +607,7 @@ static void _hasAttributeNS(Request& r, xmlNode& element=get_self_element(vnode); // write out result - r.write_no_lang(VBool::get(xmlHasNsProp(&element, localName, namespaceURI)!=0)); + r.write(VBool::get(xmlHasNsProp(&element, localName, namespaceURI)!=0)); } // boolean hasAttributes @@ -620,7 +616,7 @@ static void _hasAttributes(Request& r, M xmlNode& element=get_self_element(vnode); // write out result - r.write_no_lang(VBool::get(element.properties!=0)); + r.write(VBool::get(element.properties!=0)); } // NodeList getElementsByTagNameNS(in DOMString namespaceURI, in DOMString localName); @@ -646,7 +642,7 @@ static void _getElementsByTagNameNS(Requ &info); // write out result - r.write_no_lang(result); + r.write(result); } @@ -712,7 +708,7 @@ static void _selectX(Request& r, MethodP if(res.get()) handler(r, expression, res, vdoc, result); if(result) - r.write_no_lang(*result); + r.write(*result); } static void selectNodesHandler(Request&, @@ -729,9 +725,7 @@ static void selectNodesHandler(Request&, if(int size=res->nodesetval->nodeNr) { HashStringValue& hash=vhash.hash(); for(int i=0; inodesetval->nodeTab[i])); + hash.put(pa_uitoa(i), &xdoc.wrap(*res->nodesetval->nodeTab[i])); } break; default: @@ -869,9 +863,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 +935,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); @@ -962,10 +952,4 @@ MXnode::MXnode(const char* aname, VState CONST(NOTATION_NODE); } -#else - -// global variable - -DECLARE_CLASS_VAR(xnode, 0, 0); // fictive - #endif