Encode elements with xs:nil='true' when they are nullable, but minOccurs=1

This tentative patch tries make sure we encode valid XML for cases in which the schema says a certain element has minOccurs=1, it's nillable, and the attribute in question is null in the data we're encoding.
Basically, we cannot omit the element, but we need to encode an empty one with xs:nil="true" as the attribute.

One thing I'm not sure how to handle is adding the http://www.w3.org/2001/XMLSchema namespace if the  caller did not add it, right now it's hard coded, but it's not right, e.g., geoserver code forces the presence of it using the xsi prefix instead, and we end up with two prefix declarations.