
| Key: |
XMLBEANS-220
|
| Type: |
Bug
|
| Status: |
Closed
|
| Resolution: |
Cannot Reproduce
|
| Priority: |
Major
|
| Assignee: |
Unassigned
|
| Reporter: |
James Webster
|
| Votes: |
1
|
| Watchers: |
2
|
|
If you were logged in you would be able to see more operations.
|
|
|
|
Environment:
|
Windows XP, JDK 1.4.2_05
|
|
| Resolution Date: |
26/Oct/09 07:00 PM
|
|
We have defined a type in the schema as...
<xsd:complexType name="MyType">
<xsd:element name="mandatoryElement" type="xsd:string"/>
<xsd:element name="optionalElement" minOccurs="0" type="xsd:string"/>
</xsd:complexType>
According to the XML Schema specification, false is the default value for the optional 'nillable' attribute on xsd:element. So the 'optionalElement' element is nillable='false'.
We instantiate an instance of the MyType class, set the mandatory element and get the value of xmlText()...
MyType type = MyType.Factory.newInstance();
type.setMandatoryElement("someValue");
String xmlText = type.xmlText();
The value of xmlText generated by XMLBeans v2.0 is...
<MyType>
<mandatoryElement>someValue</mandatoryElement>
<optionalElement xsi:nil="true"/>
</MyType>
BUT, we would expect (given that optionalElement is NOT nillable) to see the following...
<MyType>
<mandatoryElement>someValue</mandatoryElement>
</MyType>
Our investigations into the XMLBeans API suggests that it is not possible (via XmlOptions, etc) to suppress the xsi: attributes, so we believe this may be a bug? We are at no point explicitly setting the optionalElement to null.
|
|
Description
|
We have defined a type in the schema as...
<xsd:complexType name="MyType">
<xsd:element name="mandatoryElement" type="xsd:string"/>
<xsd:element name="optionalElement" minOccurs="0" type="xsd:string"/>
</xsd:complexType>
According to the XML Schema specification, false is the default value for the optional 'nillable' attribute on xsd:element. So the 'optionalElement' element is nillable='false'.
We instantiate an instance of the MyType class, set the mandatory element and get the value of xmlText()...
MyType type = MyType.Factory.newInstance();
type.setMandatoryElement("someValue");
String xmlText = type.xmlText();
The value of xmlText generated by XMLBeans v2.0 is...
<MyType>
<mandatoryElement>someValue</mandatoryElement>
<optionalElement xsi:nil="true"/>
</MyType>
BUT, we would expect (given that optionalElement is NOT nillable) to see the following...
<MyType>
<mandatoryElement>someValue</mandatoryElement>
</MyType>
Our investigations into the XMLBeans API suggests that it is not possible (via XmlOptions, etc) to suppress the xsi: attributes, so we believe this may be a bug? We are at no point explicitly setting the optionalElement to null. |
Show » |
made changes - 26/Oct/09 07:00 PM
| Field |
Original Value |
New Value |
|
Resolution
|
|
Cannot Reproduce
[ 5
]
|
|
Status
|
Open
[ 1
]
|
Closed
[ 6
]
|
|