It's not a secret anymore!
The moose likes XML and Related Technologies and the fly likes Handling of elements inside choice by JAXB Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "Handling of elements inside choice by JAXB" Watch "Handling of elements inside choice by JAXB" New topic
Author

Handling of elements inside choice by JAXB

Balamurugan Balasubramanian
Greenhorn

Joined: Jun 07, 2006
Posts: 2
I have an element whose definition is like this.
<!ELEMENT JMXNode (NodeName, JMXServiceURL?, (JMXNode | MBean)*)>

When I generated JAXB classes using XJC compiler for this,
the JMXNode.java file generated for this element has only one list for all the child elements, irrespective of whether it is mandatory, optional, or choice.
This is creating issues when I tried to unmarshall this element. This also allows me to validate an invalid XML.

I am using JAXB version 1.0. Any thoughts on this issue ???
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
Originally posted by Balamurugan Balasubramanian:
I have an element whose definition is like this.
<!ELEMENT JMXNode (NodeName, JMXServiceURL?, (JMXNode | MBean)*)>

I am using JAXB version 1.0. Any thoughts on this issue ???



JAXB 1.0 consumes XML Schema not DTD.

Java Architecture for XML Binding (JAXB) FAQs

Q. What happened to the JAXB implementation that supported DTD schema?[

The early access release that implemented working draft v0.21 in the JAXB specification is no longer available for download. The expert group for JAXB has taken the specification in a very different direction then the old version and it is not backwards compatible. Consequently, we discontinued distribution of the old version. As a result, the best option for those who used the old version would be to move their code base to the latest version of the JAXB reference implementation.

We realize that this is an inconvenience. However, one of the great strengths of the Java Community Process is the excellent compatibility that it affords. In order to maintain that compatibility we put very strict terms on EA technologies. Once a technology has completed the JCP you can have confidence that the final version will be supported and will be compatible.


"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Handling of elements inside choice by JAXB
 
Similar Threads
JAXB 1.0.2 Unmarshal error, 'unexpected root element'
MessageDrivenBean - JAXB
JAXB - Ordering of elements in generated XML
jaxb xml parsing, null pointer for IDRef element
Identifying elements inside choice by JAXB