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=”http://www.w3.org/2001/XMLSchema-instance” 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?

http://hwellmann.blogspot.com/2011/03/jaxb-marshalling-with-custom-namespace.html This shows how to do it. Another: http://www.systemmobile.com/?p=280 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