|
|
| version 1.90, 2015/10/09 11:42:38 | version 1.96, 2017/02/07 22:00:30 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: @b dom parser class. | Parser: @b dom parser class. |
| Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com) | Copyright (c) 2001-2017 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" |
| Line 23 | Line 23 |
| volatile const char * IDENT_XNODE_C="$Id$" IDENT_XNODE_H; | volatile const char * IDENT_XNODE_C="$Id$" IDENT_XNODE_H; |
| // global variable | |
| DECLARE_CLASS_VAR(xnode, new MXnode, 0); | |
| // classes | // classes |
| class xmlXPathObject_auto_ptr { | class xmlXPathObject_auto_ptr { |
| Line 151 static void writeNode(Request& r, VXdoc& | Line 147 static void writeNode(Request& r, VXdoc& |
| throw XmlException(0, r); // OOM, bad name, things like that | throw XmlException(0, r); // OOM, bad name, things like that |
| // write out result | // write out result |
| r.write_no_lang(xdoc.wrap(*node)); | r.write(xdoc.wrap(*node)); |
| } | } |
| static xmlNode* pa_getAttributeNodeNS(xmlNode& selfNode, | static xmlNode* pa_getAttributeNodeNS(xmlNode& selfNode, |
| Line 359 static void _hasChildNodes(Request& r, M | Line 355 static void _hasChildNodes(Request& r, M |
| xmlNode& node=vnode.get_xmlnode(); | xmlNode& node=vnode.get_xmlnode(); |
| // write out result | // write out result |
| r.write_no_lang(VBool::get(node.children!=0)); | r.write(VBool::get(node.children!=0)); |
| } | } |
| // Node cloneNode(in boolean deep); | // Node cloneNode(in boolean deep); |
| Line 399 static void _getAttribute(Request& r, Me | Line 395 static void _getAttribute(Request& r, Me |
| // @todo: when name="xmlns" | // @todo: when name="xmlns" |
| xmlChar* attribute_value=xmlGetProp(&element, name); | xmlChar* attribute_value=xmlGetProp(&element, name); |
| // write out result | // 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); | // void setAttribute(in DOMString name, in DOMString value) raises(DOMException); |
| Line 508 static void _getElementsByTagName(Reques | Line 504 static void _getElementsByTagName(Reques |
| &info); | &info); |
| // write out result | // write out result |
| r.write_no_lang(result); | r.write(result); |
| } | } |
| // DOM 2 | // DOM 2 |
| Line 524 static void _getAttributeNS(Request& r, | Line 520 static void _getAttributeNS(Request& r, |
| // 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 |
| r.write_pass_lang(r.transcode(attribute_value)); | r.write(r.transcode(attribute_value)); |
| } | } |
| Line 599 static void _hasAttribute(Request& r, Me | Line 595 static void _hasAttribute(Request& r, Me |
| // @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(VBool::get(xmlHasProp(&element, name)!=0)); |
| } | } |
| // boolean hasAttributeNS(n DOMString namespaceURI, in DOMString localName) raises(DOMException); | // boolean hasAttributeNS(n DOMString namespaceURI, in DOMString localName) raises(DOMException); |
| Line 611 static void _hasAttributeNS(Request& r, | Line 607 static void _hasAttributeNS(Request& r, |
| xmlNode& element=get_self_element(vnode); | xmlNode& element=get_self_element(vnode); |
| // write out result | // 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 | // boolean hasAttributes |
| Line 620 static void _hasAttributes(Request& r, M | Line 616 static void _hasAttributes(Request& r, M |
| xmlNode& element=get_self_element(vnode); | xmlNode& element=get_self_element(vnode); |
| // write out result | // 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); | // NodeList getElementsByTagNameNS(in DOMString namespaceURI, in DOMString localName); |
| Line 646 static void _getElementsByTagNameNS(Requ | Line 642 static void _getElementsByTagNameNS(Requ |
| &info); | &info); |
| // write out result | // write out result |
| r.write_no_lang(result); | r.write(result); |
| } | } |
| Line 712 static void _selectX(Request& r, MethodP | Line 708 static void _selectX(Request& r, MethodP |
| if(res.get()) | if(res.get()) |
| handler(r, expression, res, vdoc, result); | handler(r, expression, res, vdoc, result); |
| if(result) | if(result) |
| r.write_no_lang(*result); | r.write(*result); |
| } | } |
| static void selectNodesHandler(Request&, | static void selectNodesHandler(Request&, |
| Line 869 static void _selectString(Request& r, Me | Line 865 static void _selectString(Request& r, Me |
| // constructor | // constructor |
| /// @bug one can change const and ruin other's work, we need unchangable VIntConst class | /// @bug one can change const and ruin other's work, we need unchangable VIntConst class |
| MXnode::MXnode(const char* aname, VStateless_class *abase): | MXnode::MXnode(const char* aname): Methoded(aname?aname:"xnode") { |
| Methoded(aname?aname:"xnode", abase) | |
| { | |
| /// DOM1 node | /// DOM1 node |
| // Node insertBefore(in Node newChild,in Node refChild) raises(DOMException); | // Node insertBefore(in Node newChild,in Node refChild) raises(DOMException); |
| Line 960 MXnode::MXnode(const char* aname, VState | Line 954 MXnode::MXnode(const char* aname, VState |
| CONST(NOTATION_NODE); | CONST(NOTATION_NODE); |
| } | } |
| #else | |
| // global variable | |
| DECLARE_CLASS_VAR(xnode, 0, 0); // fictive | |
| #endif | #endif |