Results 1 to 2 of 2
- 01-30-2011, 05:28 PM #1
Member
- Join Date
- Jan 2011
- Posts
- 6
- Rep Power
- 0
xsd && jaxb: how to read optional fixed attribute?
Hi,
I would like to ask you for help. Suppose I've got here some xml, which xsd define attribute on some element to be OPTIONAL, but if present, then it has to have FIXED value. So let's look at xsd fragment (please do not consider xml design problems, I cannot correct them anyway).
<xs:element name="ret">
<xs:complexType>
<xs:all>
<xs:element name="description" type="xs:string" minOccurs="0" />
</xs:all>
<xs:attribute name="ok" type="xs:string" fixed="yes"/>
</xs:complexType>
</xs:element>
when I run xjc I got generated following code for "ok" parameter
public String getOk() {
if (ok == null) {
return "yes";
} else {
return ok;
}
}
which means, that when I access the "ok" parameter to check it's presence (it's optional) it always be there even if it was not specified in xml file.
What can I do to correct it?
- 03-02-2012, 05:40 PM #2
Member
- Join Date
- Mar 2012
- Posts
- 1
- Rep Power
- 0
Similar Threads
-
Fixed location
By Dipke in forum New To JavaReplies: 4Last Post: 08-13-2010, 10:25 AM -
How to read a fixed number of bytes in a DataInputStream
By Michailangelo in forum NetworkingReplies: 4Last Post: 06-29-2010, 02:13 AM -
how to read an attribute of an xml tag in jsp.
By himacherla in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 07-21-2009, 06:27 AM -
Error FIxed type attribute not equal
By phoenix_yadu in forum Advanced JavaReplies: 2Last Post: 04-23-2009, 04:36 PM -
regex problem - allowing optional space
By Norm in forum Advanced JavaReplies: 26Last Post: 10-06-2008, 04:38 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks