7 May
2021
7 May
'21
6:06 a.m.
On 4/27/21 12:27 PM, Dmitry Timoshkov wrote:
+ /* xmlSetProp/xmlSetNsProp accept only nodes of type XML_ELEMENT_NODE, + * so we have to create and assign attributes to a node by hand. + */ + + if (version) + { + attr = xmlSetNsProp(NULL, NULL, (const xmlChar *)"version", version); + if (attr) + { + attr->doc = node->doc; + set_prop(node, attr); + } + else hr = E_OUTOFMEMORY; + } This is abusing libxml2 tree structure, because 'properties' is expected only for XML_ELEMENT_NODE nodes. I don't think we should break that assumption.