summaryrefslogtreecommitdiff
path: root/ext/dom/xpath.c
diff options
context:
space:
mode:
authorRob Richards <rrichards@php.net>2003-10-20 15:50:34 +0000
committerRob Richards <rrichards@php.net>2003-10-20 15:50:34 +0000
commit44164170f3b25f34ae713e3ac34619dd7680bae4 (patch)
tree7169159b30e86483ac3d96df03ec267bcc2c259b /ext/dom/xpath.c
parent5dac05638f4b2256b8e73d12f2a03526de2b6f5b (diff)
downloadphp-git-44164170f3b25f34ae713e3ac34619dd7680bae4.tar.gz
implement namespace nodes
fix getElementsByTagName fixes to attribute namespaces remove safemode stuff as its handled in streams
Diffstat (limited to 'ext/dom/xpath.c')
-rw-r--r--ext/dom/xpath.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c
index e1503c5cff..cc9e8f3600 100644
--- a/ext/dom/xpath.c
+++ b/ext/dom/xpath.c
@@ -214,8 +214,27 @@ PHP_FUNCTION(dom_xpath_query)
for (i = 0; i < nodesetp->nodeNr; i++) {
xmlNodePtr node = nodesetp->nodeTab[i];
zval *child;
- MAKE_STD_ZVAL(child);
+ MAKE_STD_ZVAL(child);
+
+ if (node->type == XML_NAMESPACE_DECL) {
+ xmlNsPtr curns;
+ xmlNodePtr nsparent;
+
+ nsparent = node->_private;
+ curns = xmlNewNs(NULL, node->name, NULL);
+ if (node->children) {
+ curns->prefix = xmlStrdup((char *) node->children);
+ }
+ if (node->children) {
+ node = xmlNewDocNode(docp, NULL, (char *) node->children, node->name);
+ } else {
+ node = xmlNewDocNode(docp, NULL, "xmlns", node->name);
+ }
+ node->type = XML_NAMESPACE_DECL;
+ node->parent = nsparent;
+ node->ns = curns;
+ }
child = php_dom_create_object(node, &ret, NULL, child, intern TSRMLS_CC);
add_next_index_zval(return_value, child);
}