Hello,
Does xmlunit have any known issues with namespaces? I try to do a doc compare on 2 docs which should fit the 'similar' category, but they always fail. The only difference I see is that the namespace vars are different, but they should resolve to the same element.
Here is the original doc:
<?xml version="1.0" encoding="UTF-8"?>
<samlp:Request xmlns="urn:oasis:names:tc:SAML:1.0:protocol" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" RequestID="MyRequestID" MajorVersion="1" MinorVersion="0" IssueInstant="2001-12-17T09:30:47-05:00">
<samlp:AttributeQuery>
<saml:Subject>
<saml:NameIdentifier>someNameIdentifier</saml:NameIdentifier>
</saml:Subject>
</samlp:AttributeQuery>
</samlp:Request>
Here is the doc to compare against:
<?xml version="1.0" encoding="UTF-8"?>
<ns1:Request RequestID="MyRequestID" MajorVersion="1" MinorVersion="0" IssueInstant="2001-12-17T06:30:47.000-08:00" xmlns:ns1="urn:oasis:names:tc:SAML:1.0:protocol">
<ns1:AttributeQuery>
<ns2:Subject xmlns:ns2="urn:oasis:names:tc:SAML:1.0:assertion">
<ns2:NameIdentifier>someNameIdentifier</ns2:NameIdentifier>
</ns2:Subject>
</ns1:AttributeQuery>
</ns1:Request>
This is the error message: 1) testSAML_003(saml.samlProcessor.marshalTests.samlReqTest)junit.framework.AssertionFailedError: org.custommonkey.xmlun
it.Diff[different]
Expected element tag name samlp:Request but was ns1:Request: comparing <samlp:Request...> to <ns1:Request...> expected:
<true> but was:<false>
Any ideas?
Thanks,
Danny
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
Does xmlunit have any known issues with namespaces? I try to do a doc compare on 2 docs which should fit the 'similar' category, but they always fail. The only difference I see is that the namespace vars are different, but they should resolve to the same element.
Here is the original doc:
<?xml version="1.0" encoding="UTF-8"?>
<samlp:Request xmlns="urn:oasis:names:tc:SAML:1.0:protocol" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" RequestID="MyRequestID" MajorVersion="1" MinorVersion="0" IssueInstant="2001-12-17T09:30:47-05:00">
<samlp:AttributeQuery>
<saml:Subject>
<saml:NameIdentifier>someNameIdentifier</saml:NameIdentifier>
</saml:Subject>
</samlp:AttributeQuery>
</samlp:Request>
Here is the doc to compare against:
<?xml version="1.0" encoding="UTF-8"?>
<ns1:Request RequestID="MyRequestID" MajorVersion="1" MinorVersion="0" IssueInstant="2001-12-17T06:30:47.000-08:00" xmlns:ns1="urn:oasis:names:tc:SAML:1.0:protocol">
<ns1:AttributeQuery>
<ns2:Subject xmlns:ns2="urn:oasis:names:tc:SAML:1.0:assertion">
<ns2:NameIdentifier>someNameIdentifier</ns2:NameIdentifier>
</ns2:Subject>
</ns1:AttributeQuery>
</ns1:Request>
This is the error message: 1) testSAML_003(saml.samlProcessor.marshalTests.samlReqTest)junit.framework.AssertionFailedError: org.custommonkey.xmlun
it.Diff[different]
Expected element tag name samlp:Request but was ns1:Request: comparing <samlp:Request...> to <ns1:Request...> expected:
<true> but was:<false>
Any ideas?
Thanks,
Danny
Many apologies, you are correct :-(
I will post a fix ASAP - the issue is with the use of Element.getTagName() as opposed to Node.getLocalName() in DifferenceEngine.compareElement()
Humble rgds,
Tim
The fixes have been released in the 0.6 distribution,
Tim