I have an XML schema:
<xsd:element name="Person">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" type="xsd:string" />
<xsd:element name="lat" type="xsd:double" minOccurs="0"/>
<xsd:element name="lon" type="xsd:double" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
And I have an XML message:
<Person>
<name>Fred</name>
</Person>
I use JAXB to automatically generate my classes (e.g. Person.java, etc.).
So, at runtime, I use JAXB to untie the above XML message and get an instance of the Person object. When I do p.getLat()or p.getLon(), the return values ββare 0.0, although the source XML does not contain <lat>or elements <lon>.
What's even worse is that 0.0, 0.0 is the actual latitude and longitude. It is rare for a person to be located there, but it is close to the point!
IBM XML- , , . .
<xsd:element name="hasLat" type="xsd:boolean"/>
<xsd:element name="hasLon" type="xsd:boolean"/>
, XML- :
<Person>
<name>Fred</name>
<hasLat>false</hasLat>
<hasLon>false</hasLon>
</Person>
. JAXB , , getLat(), getLon()?