Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EqualToXml does not detect difference on certain XML documents if Xalan is on classpath #2641

Open
thake opened this issue Mar 15, 2024 · 1 comment
Labels

Comments

@thake
Copy link

thake commented Mar 15, 2024

Proposal

The EqualToXml matcher does not detect differences on certain XML documents if Xalan is on the classpath.
The documents need to use the same namespace URI twice with a different namespace prefix. Example:

<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
   expected
</S:Envelope>

Xalan itself does not seem to be the problem because one can use XmlUnit to correctly detect differences in such XML documents.

Reproduction steps

I've created a demo project with Unit tests that demonstrate the bug and the different behavior of XmlUnit and EqualToXml: https://github.com/thake/wiremock-bug/blob/main/src/test/java/com/example/XmlUnitTest.java

References

No response

@thake thake added the bug label Mar 15, 2024
@thake
Copy link
Author

thake commented Mar 15, 2024

The error disappears if SkipResolvingEntitiesDocumentBuilderFactory.newDocumentBuilder() no longer returns a cached DocumentBuilder but a fresh one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant