[2/2] msxml3: Support xmlns[:*] attribute nodes intelligently.

Ulrik Dickow udickow at gmail.com
Sun Jun 24 16:55:12 CDT 2012


Hello again Nikolay and others,

I'm back online.  The first attachment is try 2 of the second patch,
i.e. the one discussed in this thread.  I hope it meets all of your
concerns.  I adjusted my plan slightly at this point:

Den 12-06-2012 13:55, Ulrik Dickow skrev:
> Den 12-06-2012 13:21, Nikolay Sivov skrev:
>> On 6/12/2012 11:55, Ulrik Dickow wrote:
>>> Patch 2 of 2 from http://bugs.winehq.org/show_bug.cgi?id=26226 .
>>> [...]
>>> +    /* Emit appropriate fixme or warning in case of unsupported or invalid namespace.
>>> [...]
>> 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?
> [...]
> But maybe you are right that it is safer to return E_INVALIDARG, as I
> did in an earlier version, to guard against future increased
> intelligence in libxml2.  Both of the applications in bug 26226 use the
> correct W3C namespace, so they don't care.  I'll change it back.

The new patch returns E_NOTIMPL instead.  That seems more appropriate to
me, knowing that native msxml3 returns S_OK (like the first version of
my patch) and that we will have to change it back if it turns out to
break a real-life application.  Evil apps that try to break us
intentionally don't count :).

The new patch gives exactly the same output for the
tst-msxml_make_soap.c program as the old one.  Consistent with this
test, it also still succesfully fixes bug 26226 for BridgeCentral:
BridgeCentral's SOAP requests again succeed perfectly.

The new patch changes the output of the tst-msxml_xmlns_simple.c
program.  The new E_NOTIMPL behaviour actually made the original program
crash because I failed to do proper error checking (see second
attachment if you like, patch relative to the C attached to bugzilla).

The new output of the fixed tst-msxml_xmlns_simple.c is in the third
attachment.  The differences to the old wine patch are in test 03 (only
the FIXME text changed) and in test 04 (FAILures instead of ok, and now
quite detailed FIXME texts instead of more general, invisible warnings).

Of course, only the first attachment will be sent to wine-patches, and
only if no objections appear here to prevent it.

- Ulrik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-msxml3-Support-xmlns-attribute-nodes-intelligently.patch
Type: text/x-patch
Size: 22102 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20120624/04093a29/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-xmlns_simple-Avoid-crashing-on-undefined-or-null-att.patch
Type: text/x-patch
Size: 1095 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20120624/04093a29/attachment-0003.bin>
-------------- next part --------------
TST_MSXML_1_1-1-g855eaf4
søn jun 24 22:03:26 CEST 2012
CoInitialize successful!
ok    <-- CoCreateInstance (...DOMDocument...)
================================ Test 01 ======================================
ok    <-- createNode (type = NODE_ELEMENT, name = "elem1", nsURI = "urn:ns1")
ok    <-- createNode (type = NODE_ELEMENT, name = "elem2", nsURI = "urn:ns1")
ok    <-- appendChild (elem1, elem2, NULL)
dbgstr(elem1) = L"<elem1 xmlns=\"urn:ns1\">\r\n\t<elem2 xmlns=\"urn:ns1\"/>\r\n</elem1>"
dbgstr(elem2) = L"<elem2 xmlns=\"urn:ns1\"/>"
================================ Test 02 ======================================
ok    <-- createNode (type = NODE_ELEMENT, name = "pre:foo", nsURI = "urn:ns1")
ok    <-- createNode (type = NODE_ELEMENT, name = "pre:bar", nsURI = "urn:ns2")
ok    <-- appendChild (pre:foo, pre:bar, NULL)
dbgstr(pre:foo) = L"<pre:foo xmlns:pre=\"urn:ns1\">\r\n\t<pre:bar xmlns:pre=\"urn:ns2\"/>\r\n</pre:foo>"
ok    <-- createElement (name = "pre:baz")
ok    <-- appendChild (pre:foo, pre:baz, NULL)
FAIL  <--   setAttribute (attr = "xmlns:pre", value = "urn:ns3"
dbgstr(pre:foo) = L"<pre:foo xmlns:pre=\"urn:ns1\">\r\n\t<pre:bar xmlns:pre=\"urn:ns2\"/>\r\n\t<pre:baz/>\r\n</pre:foo>"
================================ Test 03 ======================================
ok    <-- createNode (type = NODE_ELEMENT, name = "parent", nsURI = "")
False <--   get_namespaceURI (parent, returned (null))
ok    <--   createNode (type = NODE_ATTRIBUTE, attr = "xmlns", nsURI = "http://www.w3.org/2000/xmlns/")
ok    <--     put_nodeValue (value = "urn:ns4")
fixme:msxml:domelem_setAttributeNode (0x131870)->(0x1302b4 0x32fd8c): semi-stub
ok    <--     setAttributeNode
False <--   get_namespaceURI (parent, returned (null))
ok    <-- createNode (type = NODE_ELEMENT, name = "child", nsURI = "urn:ns4")
ok    <--   get_namespaceURI (child, returned L"urn:ns4")
ok    <-- appendChild (parent, child, NULL)
dbgstr(parent) = L"<parent xmlns=\"urn:ns4\">\r\n\t<child xmlns=\"urn:ns4\"/>\r\n</parent>"
dbgstr(child)  = L"<child xmlns=\"urn:ns4\"/>"
            -------------------------------------------------------------------
ok    <--   createNode (type = NODE_ATTRIBUTE, attr = "xmlns", nsURI = "http://www.w3.org/2000/xmlns/")
ok    <--     put_nodeValue (value = "urn:ns5")
fixme:msxml:domelem_setAttributeNode (0x12fd70)->(0x12fef4 0x32fd8c): semi-stub
fixme:msxml:is_skippable_xlmns_attribute refuses to add xmlns="urn:ns5" when element already has default namespace "urn:ns4"
FAIL  <--     setAttributeNode
dbgstr(parent)  = L"<parent xmlns=\"urn:ns4\">\r\n\t<child xmlns=\"urn:ns4\"/>\r\n</parent>"
dbgstr(child)  = L"<child xmlns=\"urn:ns4\"/>"
ok    <--   get_namespaceURI (child, returned L"urn:ns4")
ok    <--   createNode (type = NODE_ATTRIBUTE, attr = "xmlns", nsURI = "http://www.w3.org/2000/xmlns/")
ok    <--     put_nodeValue (value = "urn:ns4")
fixme:msxml:domelem_setAttributeNode (0x12fd70)->(0x13208c 0x32fd8c): semi-stub
ok    <--     setAttributeNode
dbgstr(parent)  = L"<parent xmlns=\"urn:ns4\">\r\n\t<child xmlns=\"urn:ns4\"/>\r\n</parent>"
================================ Test 04 ======================================
ok    <--   createNode (type = NODE_ATTRIBUTE, attr = "xmlns", nsURI = "http://www.w3.org/2000/xmlns/")
ok    <--   createNode (type = NODE_ATTRIBUTE, attr = "xmlns:foo", nsURI = "http://www.w3.org/2000/xmlns/")
fixme:msxml:domdoc_createNode refuses to bind prefix "xmlns" to URI L"http://www.w3.org/2000/xmlns" instead of L"http://www.w3.org/2000/xmlns/"
FAIL  <--   createNode (type = NODE_ATTRIBUTE, attr = "xmlns", nsURI = "http://www.w3.org/2000/xmlns")
fixme:msxml:domdoc_createNode refuses to bind prefix "xmlns" to URI L"http://www.w3.org/2000/xmlns" instead of L"http://www.w3.org/2000/xmlns/"
FAIL  <--   createNode (type = NODE_ATTRIBUTE, attr = "xmlns:foo", nsURI = "http://www.w3.org/2000/xmlns")
fixme:msxml:domdoc_createNode refuses to bind prefix "xmlns" to URI L"http://www.winehq.org/" instead of L"http://www.w3.org/2000/xmlns/"
FAIL  <--   createNode (type = NODE_ATTRIBUTE, attr = "xmlns", nsURI = "http://www.winehq.org/")
fixme:msxml:domdoc_createNode refuses to bind prefix "xmlns" to URI L"http://www.winehq.org/" instead of L"http://www.w3.org/2000/xmlns/"
FAIL  <--   createNode (type = NODE_ATTRIBUTE, attr = "xmlns:foo", nsURI = "http://www.winehq.org/")
fixme:msxml:domdoc_createNode won't allow URI L"http://www.w3.org/2000/xmlns/" for attribute L"myprefix" -- reserved for prefix "xmlns".
FAIL  <--   createNode (type = NODE_ATTRIBUTE, attr = "myprefix", nsURI = "http://www.w3.org/2000/xmlns/")
fixme:msxml:domdoc_createNode won't allow URI L"http://www.w3.org/2000/xmlns/" for attribute L"gnus:gnats" -- reserved for prefix "xmlns".
FAIL  <--   createNode (type = NODE_ATTRIBUTE, attr = "gnus:gnats", nsURI = "http://www.w3.org/2000/xmlns/")
fixme:msxml:domdoc_createNode attribute nodes with namespaces not yet fully supported.
ok    <--   createNode (type = NODE_ATTRIBUTE, attr = "myprefix", nsURI = "http://www.w3.org/2000/xmlns")
fixme:msxml:domdoc_createNode attribute nodes with namespaces not yet fully supported.
ok    <--   createNode (type = NODE_ATTRIBUTE, attr = "gnus:gnats", nsURI = "http://www.w3.org/2000/xmlns")
søn jun 24 22:03:26 CEST 2012
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 554 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20120624/04093a29/attachment-0001.pgp>


More information about the wine-devel mailing list