xmlChar* tagName_to_XPath(const BSTR tagName)
{
xmlChar *query, *tmp;
+ static const xmlChar everything[] = "/descendant::node()";
static const xmlChar mod_pre[] = "*[local-name()='";
static const xmlChar mod_post[] = "']";
static const xmlChar prefix[] = "descendant::";
const WCHAR *tokBegin, *tokEnd;
int len;
+ /* Special case - empty tagname - means select all nodes,
+ except document itself. */
+ if (!*tagName)
+ return xmlStrdup(everything);
+
query = xmlStrdup(prefix);
tokBegin = tagName;
}
xml_name = xmlchar_from_wchar(name);
- /* prevent empty href to be allocated */
+ /* prevent empty href from being allocated */
href = namespaceURI ? xmlchar_from_wchar(namespaceURI) : NULL;
switch(node_type)
xmlnode = xmlNewDocNode(get_doc(This), NULL, local ? local : xml_name, NULL);
- /* allow to create default namespace xmlns= */
+ /* allow creating the default namespace xmlns= */
if (local || (href && *href))
{
xmlNsPtr ns = xmlNewNs(xmlnode, href, prefix);
case 1:
/* Only takes UTF-8 strings.
* NOT NULL-terminated. */
- SafeArrayAccessData(psa, (void**)&str);
+ hr = SafeArrayAccessData(psa, (void**)&str);
+ if (FAILED(hr))
+ {
+ This->error = hr;
+ WARN("failed to access array data, 0x%08x\n", hr);
+ break;
+ }
SafeArrayGetUBound(psa, 1, &len);
if ((xmldoc = doparse(This, str, ++len, XML_CHAR_ENCODING_UTF8)))