-
-
Notifications
You must be signed in to change notification settings - Fork 540
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
Semantic equivalence for XmlNode #354
Comments
That would be awesome. Issue #3 has been discussing this a long time ago, but I never found the time to implement it correctly. |
I'll see if I can make it use an XmlReader internally. That way the logic can be reused to solve #3 too as there is an XNode.CreateReader() method. |
👍 If you would honor the contribution guidelines, it would speed up the merge process. 😏 |
is this issue still open? i have code that i extended based on the work of Eric White (who worked in the xml group on .NET) - https://blogs.msdn.microsoft.com/ericwhite/2009/01/27/equality-semantics-of-linq-to-xml-trees/ All of my work has unit tests |
@udlose The basic functionality is in place, I've apparently had three PRs merged for Xml stuff. But there are still more scenarios that could be added. I don't know if @dennisdoomen has kept this issue open because he wants further functionality added or if the issue simply just didn't get closed. |
@AndersAbel did we use the algorithm from that article? |
@udlose @dennisdoomen No, I wrote my own algorithm. I read the article and the biggest difference is that the code in the article is based on the assumption that there is an xml schema available. My code is based only on the XML contents. With the XML Schema available, the code from the article can do some smart tricks such as treating Using normalization also handles some scenarios as equal that I don't think that my code would do, e.g. If there is a schema available, the normalization approach taken from that code is more powerful. But for the use case I have it wouldn't be usable as I don't have any schema attached and having to bring in a schema for everything would give a lot of extra work. |
Hmm, it looks like the schema is optional. Would be nice to have those additional features for 5.0. |
Any need for this? Anybody fancy working on it? |
The original scope I intended with this issue is in place and merged, so closing the issue. The idea with using the schema-compatible code is really another extension and could be added as a new issue (if anyone wants to spend the time on it). |
I'm working with a lot of Xml generation in a library that uses the classical XmlDocument/XmlElement API rather than XDocument/XElement, so I'm thinking about implementing some comparison helpers.
I'll add a new XmlNodeAssertions class containing BeEquivavelentTo(XmlNode) and BeEquivalentTo(XmlNode, string, params object[]).
The comparison will make a semantical comparison that:
This is somewhat more lax than the canonical XML standard that requires the namespace prefixes to be the same, but to me two XML docs are equivalent even if they use different ways to express the same namespace.
The text was updated successfully, but these errors were encountered: