|
|
| version 1.82, 2009/04/10 11:31:06 | version 1.85, 2011/05/25 04:00:40 |
|---|---|
| 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 330 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(*new VBool(node.children!=0)); | r.write_no_lang(VBool::get(node.children!=0)); |
| } | } |
| // Node cloneNode(in boolean deep); | // Node cloneNode(in boolean deep); |
| Line 558 static void _hasAttribute(Request& r, Me | Line 583 static void _hasAttribute(Request& r, Me |
| // @todo: when name="xmlns" | // @todo: when name="xmlns" |
| // write out result | // write out result |
| r.write_no_lang(*new VBool(xmlHasProp(&element, name)!=0)); | r.write_no_lang(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 570 static void _hasAttributeNS(Request& r, | Line 595 static void _hasAttributeNS(Request& r, |
| const xmlChar* localName=as_xmlchar(r, params, 1, LOCALNAME_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(*new VBool(xmlHasNsProp(&element, localName, namespaceURI)!=0)); | r.write_no_lang(VBool::get(xmlHasNsProp(&element, localName, namespaceURI)!=0)); |
| } | } |
| // boolean hasAttributes | // boolean hasAttributes |
| Line 579 static void _hasAttributes(Request& r, M | Line 604 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(*new VBool(element.properties!=0)); | r.write_no_lang(VBool::get(element.properties!=0)); |
| } | } |
| static void _getElementsByTagNameNS(Request& r, MethodParams& params) { | static void _getElementsByTagNameNS(Request& r, MethodParams& params) { |
| Line 715 static void selectNodeHandler(Request& r | Line 740 static void selectNodeHandler(Request& r |
| } | } |
| break; | break; |
| case XPATH_BOOLEAN: | case XPATH_BOOLEAN: |
| result=new VBool(res->boolval!=0); | result=&VBool::get(res->boolval!=0); |
| break; | break; |
| case XPATH_NUMBER: | case XPATH_NUMBER: |
| result=new VDouble(res->floatval); | result=new VDouble(res->floatval); |
| Line 737 static void selectBoolHandler(Request&, | Line 762 static void selectBoolHandler(Request&, |
| Value*& result) { | Value*& result) { |
| switch(res->type) { | switch(res->type) { |
| case XPATH_BOOLEAN: | case XPATH_BOOLEAN: |
| result=new VBool(res->boolval!=0); | result=&VBool::get(res->boolval!=0); |
| break; | break; |
| case XPATH_NODESET: | case XPATH_NODESET: |
| if(!(res->nodesetval && res->nodesetval->nodeNr)) | if(!(res->nodesetval && res->nodesetval->nodeNr)) |