|
|
| version 1.29, 2002/01/21 16:44:48 | version 1.32, 2002/01/24 14:10:08 |
|---|---|
| Line 396 static void _selectX(Request& r, const S | Line 396 static void _selectX(Request& r, const S |
| GdomeException exc; | GdomeException exc; |
| GdomeNode *dome_node=vnode.get_node(&method_name); | GdomeNode *dome_node=vnode.get_node(&method_name); |
| GdomeDocument *dome_document=gdome_n_ownerDocument(dome_node, &exc); | GdomeDocument *dome_document=gdome_n_ownerDocument(dome_node, &exc); |
| if(!dome_document) | if(!dome_document) // document does not own itself, so ownerDocument = 0 |
| dome_document=GDOME_DOC(dome_node); | dome_document=GDOME_DOC(dome_node); // and we need downcast |
| xmlDoc *xml_document=((_Gdome_xml_Document *)dome_document)->n; | xmlDoc *xml_document=((_Gdome_xml_Document *)dome_document)->n; |
| xmlXPathContext_auto_ptr ctxt(xmlXPathNewContext(xml_document)); | xmlXPathContext_auto_ptr ctxt(xmlXPathNewContext(xml_document)); |
| ctxt->node=xmlDocGetRootElement(xml_document); | ctxt->node=gdome_xml_n_get_xmlNode(dome_node); |
| /*error to stderr for now*/ | /*error to stderr for now*/ |
| xmlXPathObject_auto_ptr res( | xmlXPathObject_auto_ptr res( |
| xmlXPathEvalExpression(BAD_CAST pool.transcode(expression)->str, ctxt.get())); | xmlXPathEvalExpression(BAD_CAST pool.transcode(expression)->str, ctxt.get())); |
| Line 425 static void selectNodesHandler(Pool& poo | Line 425 static void selectNodesHandler(Pool& poo |
| const String& expression, | const String& expression, |
| xmlXPathObject_auto_ptr res, | xmlXPathObject_auto_ptr res, |
| Value *& result) { | Value *& result) { |
| VHash *vhash=new(pool) VHash(pool); result=vhash; | |
| switch(res->type) { | switch(res->type) { |
| case XPATH_UNDEFINED: | case XPATH_UNDEFINED: |
| break; | break; |
| case XPATH_NODESET: | case XPATH_NODESET: |
| if(int size=res->nodesetval->nodeNr) { | if(int size=res->nodesetval->nodeNr) { |
| VHash *vhash=new(pool) VHash(pool); | |
| Hash& hash=vhash->hash(0); | Hash& hash=vhash->hash(0); |
| for(int i=0; i<size; i++) { | for(int i=0; i<size; i++) { |
| String& skey=*new(pool) String(pool); | String& skey=*new(pool) String(pool); |
| Line 441 static void selectNodesHandler(Pool& poo | Line 441 static void selectNodesHandler(Pool& poo |
| } | } |
| hash.put(skey, new(pool) VXnode(pool, | hash.put(skey, new(pool) VXnode(pool, |
| gdome_xml_n_mkref(res->nodesetval->nodeTab[0]))); | gdome_xml_n_mkref(res->nodesetval->nodeTab[i]))); |
| } | } |
| result=vhash; | |
| } | } |
| break; | break; |
| default: | default: |