I have following XSD file:-
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="emp" targetNamespace="emp"
elementFormDefault="qualified">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="Case_Detail" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Case_Detail">
<xs:complexType>
<xs:sequence>
<xs:element ref="Central_Case_ID"/>
<xs:element ref="Agency_Case_ID"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Central_Case_ID">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Agency_Case_ID">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:schema>
I have generated JAXB classes and trying to marshal into XML file. In generated XML file, I can for each elements in XML file, attributes are coming if it is null like :- For e.g. :-
<Central_Case_ID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
My requirement is to have elements without these attributes at all even if some element has null values in the enitre XML file. For this I have tried alot, I made lot of changes in XSD like updated elementFormDefault="unqualified" and arguementFormDefault to unqalified but it didn't work. Then I made changes in @annotations in JAXB classes and also tried to set some properties in marshalling object like No_Namespace_schema_location but nothing worked.
Kindly suggest.