Re: [4/6] msxml3/dom: Properly return node prefix from get_prefix()
Hi Nikolay, On 11/15/11 07:19, Nikolay Sivov wrote:
- if ((ns = xmlGetNsList(This->node->doc, This->node))) + switch (This->node->type) { - if (ns[0]->prefix) *prefix = bstr_from_xmlChar( ns[0]->prefix ); - xmlFree(ns); + case XML_ELEMENT_NODE: + case XML_ATTRIBUTE_NODE: + { + xmlNsPtr ns = This->node->ns; + if (ns&& ns->prefix) + *prefix = bstr_from_xmlChar(ns->prefix); + break; } + default: + FIXME("unsupported type %d\n", This->node->type); + };
The idea behind node inheritance rewrite was to avoid such switches. If other node types should be handled differently, they simply shouldn't use node_get_prefix or the differences should be moved to child objects. Jacek
On 11/15/2011 14:43, Jacek Caban wrote:
Hi Nikolay,
On 11/15/11 07:19, Nikolay Sivov wrote:
- if ((ns = xmlGetNsList(This->node->doc, This->node))) + switch (This->node->type) { - if (ns[0]->prefix) *prefix = bstr_from_xmlChar( ns[0]->prefix ); - xmlFree(ns); + case XML_ELEMENT_NODE: + case XML_ATTRIBUTE_NODE: + { + xmlNsPtr ns = This->node->ns; + if (ns&& ns->prefix) + *prefix = bstr_from_xmlChar(ns->prefix); + break; } + default: + FIXME("unsupported type %d\n", This->node->type); + };
The idea behind node inheritance rewrite was to avoid such switches. If other node types should be handled differently, they simply shouldn't use node_get_prefix or the differences should be moved to child objects.
Jacek You're right. I'll just use node_get_prefix for elements and attributes and add clean E_NOTIMPL case for other nodes.
participants (2)
-
Jacek Caban -
Nikolay Sivov