Blank string gets converted to <element/> but I need it to be <element></element>

Jason Bodnar <[email protected]> Mon, 29 Nov 2010 18:23:05 -0600
Newsgroups gmane.text.xml.xmlbeans.user
Message-ID <1291076585.11120.24.camel@jbodnar>
If I have the following schema fragment:

<xsd:complexType name="addressBookContact">
 <xsd:sequence>
  <xsd:element name="firstName" type="xsd:string" nillable="true" />
  <xsd:element name="lastName" type="xsd:string" nillable="true" />
  <xsd:element name="email" type="xsd:string" />
 </xsd:sequence>
</xsd:complexType>

and do the following in my Java code:

String firstName = "";
contact.setFirstName(firstName);

The resulting XML is <firstName/>. 

This is fine except org.json.XML converts that to firstName:{} and
<firstName></firstName> to firstName:"". Not sure if that's correct or
not but the easiest fix for me is to have xmlbeans convert a blank
string to <element></element>. 

Is there some way to do this?

Thanks,


-- 
Jason Bodnar
[email protected]