We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Empty namespaces are lost during serialization if parent-element has a non-empty namespace.
var xml = new XElement("{x}a", new XElement("b", "")); var json = JsonConvert.SerializeXNode(xml); Console.WriteLine(json);
{ "a": { "@xmlns": "x", "b": "" } }
xmlns should be present on an element when it differs from its parent, even when it is the global namespace.
{ "a": { "@xmlns": "x", "b": { "@xmlns": "" } } }
No xmlns-attribute on the b-element, even though its namespace differs its parent.
This also means that empty namespaces are dropped in a serialize/deserialize round trip.
var xml = new XElement("{x}a", new XElement("b", "")); Console.WriteLine($"Before: \n:{xml}"); var json = JsonConvert.SerializeXNode(xml); var deserializedXml = JsonConvert.DeserializeXNode(json); Console.WriteLine($"After: \n:{deserializedXml}");
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Empty namespaces are lost during serialization if parent-element has a non-empty namespace.
Source/destination types
Source/destination JSON
Expected behavior
xmlns should be present on an element when it differs from its parent, even when it is the global namespace.
Actual behavior
No xmlns-attribute on the b-element, even though its namespace differs its parent.
This also means that empty namespaces are dropped in a serialize/deserialize round trip.
Steps to reproduce
The text was updated successfully, but these errors were encountered: