dcsimg
JAXB and optional elements
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Josh_Rai
Posted On:   Saturday, June 30, 2001 12:06 AM

I'm using the JAXB Early Access v1.0 implementation (the v0.21 spec). Does anyone out there have any experience with it? I have a DTD that contains something like this: <!ELEMENT SomeElement (A, B?, C ... )> (note that B is optional), and my binding schema relies on default behavior. This results in code like this inside SomeElement.validate(Validator v): v.validate(_A); v.validate(_B); v.validate(_C); If I create a SomeElement object and I do not set the 'B' property, I get a NullPointerException during validation, somewhere within the call to v.   More>>

I'm using the JAXB Early Access v1.0 implementation
(the v0.21 spec). Does anyone out there have any
experience with it?



I have a DTD that contains something
like this:



			
<!ELEMENT SomeElement (A, B?, C ... )>





(note that B is optional), and my binding schema relies on
default behavior. This results in code like this inside
SomeElement.validate(Validator v):



			
v.validate(_A);
v.validate(_B);
v.validate(_C);



If I create a SomeElement object and I do not set the 'B'
property, I get a NullPointerException during validation,
somewhere within the call to v.validate(_B). The _B instance
variable is null, but shouldn't that be legal, given the DTD?
How else can I specify that my SomeElement does not
contain a B sub-element?




Thanks.    <<Less
About | Sitemap | Contact