|
|
| version 1.56, 2003/07/24 11:31:20 | version 1.59, 2003/09/25 09:15:02 |
|---|---|
| Line 327 static void _getElementsByTagName(Reques | Line 327 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 Exception( |
| Line 338 static void _getElementsByTagName(Reques | Line 338 static void _getElementsByTagName(Reques |
| r.write_no_lang(result); | r.write_no_lang(result); |
| } | } |
| // DOM 2 | |
| // DOMString getAttributeNS(in DOMString namespaceURI, in DOMString localName); | |
| static void _getAttributeNS(Request& r, MethodParams& params) { | |
| GdomeElement* element=get_self_element(r); | |
| const String& namespaceURI=params.as_string(0, "namespaceURI must be string"); | |
| const String& localName=params.as_string(0, "localName must be string"); | |
| GdomeException exc; | |
| GdomeDOMString *attribute_value= | |
| gdome_el_getAttributeNS(element, | |
| r.transcode(namespaceURI).use(), | |
| r.transcode(localName).use(), &exc); | |
| // write out result | |
| r.write_no_lang(r.transcode(attribute_value)); | |
| } | |
| // void setAttributeNS(in DOMString namespaceURI, in DOMString qualifiedName, in DOMString value) raises(DOMException); | |
| static void _setAttributeNS(Request& r, MethodParams& params) { | |
| GdomeElement* element=get_self_element(r); | |
| const String& namespaceURI=params.as_string(0, "namespaceURI must be string"); | |
| const String& qualifiedName=params.as_string(1, "qualifiedName must be string"); | |
| const String& attribute_value=params.as_string(2, "value must be string"); | |
| GdomeException exc; | |
| gdome_el_setAttributeNS(element, | |
| r.transcode(namespaceURI).use(), | |
| r.transcode(qualifiedName).use(), | |
| r.transcode(attribute_value).use(), | |
| &exc); | |
| if(exc) | |
| throw Exception(0, exc); | |
| } | |
| // void removeAttributeNS(in DOMString namespaceURI, in DOMString localName) raises(DOMException); | |
| static void _removeAttributeNS(Request& r, MethodParams& params) { | |
| GdomeElement* element=get_self_element(r); | |
| const String& namespaceURI=params.as_string(0, "namespaceURI must be string"); | |
| const String& localName=params.as_string(1, "localName must be string"); | |
| GdomeException exc; | |
| gdome_el_removeAttributeNS(element, | |
| r.transcode(namespaceURI).use(), | |
| r.transcode(localName).use(), | |
| &exc); | |
| if(exc) | |
| throw Exception(0, exc); | |
| } | |
| // Attr getAttributeNodeNS(in DOMString namespaceURI, in DOMString localName); | |
| static void _getAttributeNodeNS(Request& r, MethodParams& params) { | |
| GdomeElement* element=get_self_element(r); | |
| const String& namespaceURI=params.as_string(0, "namespaceURI must be string"); | |
| const String& name=params.as_string(1, "name must be string"); | |
| GdomeException exc; | |
| if(GdomeAttr *attr=gdome_el_getAttributeNodeNS(element, | |
| r.transcode(namespaceURI).use(), r.transcode(name).use(), &exc)) { | |
| // write out result | |
| r.write_no_lang(*new VXnode(&r.charsets, (GdomeNode* )attr)); | |
| } else if(exc) | |
| throw Exception( | |
| 0, | |
| exc); | |
| } | |
| // Attr setAttributeNodeNS(in Attr newAttr) raises(DOMException); | |
| static void _setAttributeNodeNS(Request& r, MethodParams& params) { | |
| GdomeElement* element=get_self_element(r); | |
| GdomeAttr * newAttr=as_attr(params, 0, "newAttr must be ATTRIBUTE node"); | |
| GdomeException exc; | |
| if(GdomeAttr *returnAttr=gdome_el_setAttributeNodeNS(element, newAttr, &exc)) { | |
| // write out result | |
| r.write_no_lang(*new VXnode(&r.charsets, (GdomeNode* )returnAttr)); | |
| } else | |
| throw Exception( | |
| 0, | |
| exc); | |
| } | |
| // boolean hasAttribute(in DOMString name) raises(DOMException); | |
| static void _hasAttribute(Request& r, MethodParams& params) { | |
| GdomeElement* element=get_self_element(r); | |
| const String& name=params.as_string(0, "name must be string"); | |
| GdomeException exc; | |
| // write out result | |
| bool result=gdome_el_hasAttribute(element, | |
| r.transcode(name).use(), | |
| &exc)!=0; | |
| r.write_no_lang(*new VBool(result)); | |
| } | |
| // boolean hasAttributeNS(n DOMString namespaceURI, in DOMString localName) raises(DOMException); | |
| static void _hasAttributeNS(Request& r, MethodParams& params) { | |
| GdomeElement* element=get_self_element(r); | |
| const String& namespaceURI=params.as_string(0, "namespaceURI must be string"); | |
| const String& localName=params.as_string(1, "localName must be string"); | |
| GdomeException exc; | |
| // write out result | |
| bool result=gdome_el_hasAttributeNS(element, | |
| r.transcode(namespaceURI).use(), | |
| r.transcode(localName).use(), | |
| &exc)!=0; | |
| r.write_no_lang(*new VBool(result)); | |
| } | |
| static void _getElementsByTagNameNS(Request& r, MethodParams& params) { | static void _getElementsByTagNameNS(Request& r, MethodParams& params) { |
| GdomeElement* element=get_self_element(r); | GdomeElement* element=get_self_element(r); |
| Line 356 static void _getElementsByTagNameNS(Requ | Line 468 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 425 static void selectNodesHandler(Request& | Line 537 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 605 MXnode::MXnode(const char* aname, VState | Line 717 MXnode::MXnode(const char* aname, VState |
| // void normalize(); | // void normalize(); |
| add_native_method("normalize", Method::CT_DYNAMIC, _normalize, 0, 0); | add_native_method("normalize", Method::CT_DYNAMIC, _normalize, 0, 0); |
| /// DOM2 element | |
| // DOMString getAttributeNS(in DOMString namespaceURI, in DOMString localName); | |
| add_native_method("getAttributeNS", Method::CT_DYNAMIC, _getAttributeNS, 2, 2); | |
| // void setAttributeNS(in DOMString namespaceURI, in DOMString qualifiedName, in DOMString value) raises(DOMException); | |
| add_native_method("setAttributeNS", Method::CT_DYNAMIC, _setAttributeNS, 3, 3); | |
| // void removeAttributeNS(in DOMString namespaceURI, in DOMString localName) raises(DOMException); | |
| add_native_method("removeAttributeNS", Method::CT_DYNAMIC, _removeAttributeNS, 2, 2); | |
| // Attr getAttributeNodeNS(in DOMString namespaceURI, in DOMString localName); | |
| add_native_method("getAttributeNodeNS", Method::CT_DYNAMIC, _getAttributeNodeNS, 2, 2); | |
| // Attr setAttributeNodeNS(in Attr newAttr) raises(DOMException); | |
| add_native_method("setAttributeNodeNS", Method::CT_DYNAMIC, _setAttributeNodeNS, 1, 1); | |
| // boolean hasAttribute(in DOMString name) raises(DOMException); | |
| add_native_method("hasAttribute", Method::CT_DYNAMIC, _hasAttribute, 1, 1); | |
| // boolean hasAttributeNS(in DOMString namespaceURI, in DOMString localName) raises(DOMException); | |
| add_native_method("hasAttributeNS", Method::CT_DYNAMIC, _hasAttributeNS, 2, 2); | |
| /// parser | /// parser |
| // ^node.select[/some/xpath/query] = hash $.#[dnode] | // ^node.select[/some/xpath/query] = hash $.#[dnode] |
| add_native_method("select", Method::CT_DYNAMIC, _select, 1, 1); | add_native_method("select", Method::CT_DYNAMIC, _select, 1, 1); |
| Line 621 MXnode::MXnode(const char* aname, VState | Line 750 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); |