Can you add additional properties to .NET serialized NULL values?
Asked Answered
E

1

0

In .NET, you can serialize a nullable element using XmlElement( IsNullable = true ), which results in this:

<SomeElement xsi:nil="true" />.

However, I need to be able to add xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance after any field that is being nulled out.

Example:

<SomeElement xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>

Is this possible?

Epagoge answered 9/3, 2012 at 18:42 Comment(0)
E
0

I figured it out. Here is the answer:

[XmlElement(IsNullable = true, Namespace = "http://www.w3.org/2001/XMLSchema-instance")]
Epagoge answered 11/3, 2012 at 1:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.