Can XmlSerializer deserialize into a Nullable?

I think you need to prefix the nil=”true” with a namespace in order for XmlSerializer to deserialise to null. MSDN on xsi:nil <?xml version=”1.0″ encoding=”UTF-8″?> <entities xmlns:xsi=”” xsi:type=”array”> <entity> <id xsi:type=”integer”>1</id> <name>Foo</name> <parent-id xsi:type=”integer” xsi:nil=”true”/>

Is it possible to customize the namespace prefix that JAXB uses when marshalling to a String? This shows how to do it. Another: Key bits in case that link dies too: the NamespacePrefixMapper class, found in the com.sun.xml.bind.marshaller package. The abstract class has one method to implement: public abstract String getPreferredPrefix( String namespaceUri, String suggestion, boolean requirePrefix); then Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.setProperty(”com.sun.xml.bind.namespacePrefixMapper”, new MyNamespacePrefixMapper()); If you’re also using … Read more