<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 6/12/2012 11:55, Ulrik Dickow wrote:<br>
</div>
<blockquote cite="mid:4FD703E6.20002@gmail.com" type="cite">
<pre wrap="">Patch 2 of 2 from <a class="moz-txt-link-freetext" href="http://bugs.winehq.org/show_bug.cgi?id=26226">http://bugs.winehq.org/show_bug.cgi?id=26226</a> .
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">
</pre>
</blockquote>
<br>
<blockquote type="cite">
<pre wrap="">+ /* Emit appropriate fixme or warning in case of unsupported or invalid namespace.
+ * The W3C spec would like us to exit earlier for attempts to redefine the namespace for
+ * the reserved "xmlns" attribute or prefix (<a class="moz-txt-link-freetext" href="http://www.w3.org/TR/xml-names/#ns-decl">http://www.w3.org/TR/xml-names/#ns-decl</a>),
+ * like <a class="moz-txt-link-freetext" href="http://gdome2.cs.unibo.it/gtk-doc/gdome2-gdomeelement.html#GDOME-EL-SETATTRIBUTENS">http://gdome2.cs.unibo.it/gtk-doc/gdome2-gdomeelement.html#GDOME-EL-SETATTRIBUTENS</a>,
+ * but since native msxml3 accepts anything here, it's safest to just continue with warning.
+ */</pre>
</blockquote>
The question is more like what libxml2 thinks about that. If it
follows w3c here which is likely the question will be - won't it
break somewhere internally in libxml2 code if we hack it that way?<br>
<blockquote type="cite">
<pre wrap="">
+ if(namespaceURI && namespaceURI[0] && node_type != NODE_ELEMENT)
+ {
+ if(node_type == NODE_ATTRIBUTE)
+ switch((!strcmpW(name, xmlnsW) ||
+ !strncmpW(name, xmlnscW, sizeof(xmlnscW)/sizeof(WCHAR))) +
+ !strcmpW(namespaceURI, w3xmlns))</pre>
</blockquote>
Could you please simplify that, it's a bit hard to read.<br>
<blockquote type="cite">
<pre wrap="">+ * Note: We would be more in line with the native msxml if we only detected a
+ * redundancy/conflict for prefixes existing on the element itself (in element->ns
+ * or in the linked list element->nsDef). But as long as our *_get_xml() doesn't
+ * eliminate redundant namespace definitions in children, this behaviour may be
+ * an advantage in some cases. As disadvantage is that we incorrectly regard the
+ * redefinition in element 'b' in '<a xmlns="x"><b xmlns="y"/></a>' as a conflict.
+ * Libxml2 currently doesn't have a function or option to only search for namespaces
+ * on the current node; but it would be easy to make a reduced version of xmlSearchNs
+ * (currently defined in <a class="moz-txt-link-freetext" href="http://git.gnome.org/browse/libxml2/tree/tree.c#n5871">http://git.gnome.org/browse/libxml2/tree/tree.c#n5871</a>).
+ * However, most apps probably set the ns to y on node b creation, so no conflict here.
+ *</pre>
</blockquote>
I don't think it's better to potentially break one thing while
fixing the other. And I guess I like a thought on making xmlSearchNs
version that will do what we want from it. Just to clarify - is that
right that libxml2 problem here is a lack of some checks<br>
that lead to duplication and conflicts later? (that are visible in
doc dumps too)<br>
<blockquote type="cite">
<pre wrap="">+/* Convenient helper function for creating an attribute node in a given namespace.
+ * Note: CHECK_HR() should not be here, but in caller, to give optimal line number info.
+ */</pre>
</blockquote>
You mean EXPECT_HR here I guess.<br>
<blockquote type="cite">
<pre wrap="">
+static HRESULT create_attribute_ns(
+ IXMLDOMDocument *doc,
+ const char *attr_name,
+ const char *nsURI,
+ IXMLDOMAttribute **attr_ptr)
+{
+ HRESULT hr;
+ VARIANT var;
+ IXMLDOMNode *node;
+
+ V_VT(&var) = VT_I1;
+ V_I1(&var) = NODE_ATTRIBUTE;
+
+ hr = IXMLDOMDocument_createNode(doc, var, <span class="moz-txt-underscore"><span class="moz-txt-tag">_</span>bstr<span class="moz-txt-tag">_</span></span>(attr_name), <span class="moz-txt-underscore"><span class="moz-txt-tag">_</span>bstr<span class="moz-txt-tag">_</span></span>(nsURI), &node);
+ if (hr == S_OK)
+ {
+ IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMAttribute, (void**) attr_ptr);
+ IXMLDOMNode_Release(node);
+ }
+ return hr;
+}</pre>
</blockquote>
Please null out pointer in case of failure, or better always before
createNode().<br>
<br>
<br>
</body>
</html>