my dog learned polymorphism*
The moose likes XML and Related Technologies and the fly likes xml without root element -- JAXB. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xml without root element -- JAXB." Watch "xml without root element -- JAXB." New topic
Author

xml without root element -- JAXB.

Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

I have xsd A and B, A generates classes having annotations "root element" but B doesn't

Questions:

1 - How do I know which xsd will generate classes with "root element" annotations?
2 - and Can I still generate (marshall and unmarshall) without a root element? if yes please guide me to a tutorial...

Thanks a lot in advance!


Time is what we want the most, but what we use the worst. -- William Penn
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
"generate classes"

What tool are you using here? There are many.

Bill
Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

sorry I missed that, its jaxB...

and I found out some things while going through the classes...

Compilation error

@XmlElementRef(name = "readyTime", type = JAXBElement.class, required = false)

Error: The attribute required is undefined for the annotation type XmlElementRef

I dont understand, is this schema a old one or a new one ? : (
Akira Funahashi
Greenhorn

Joined: Nov 12, 2010
Posts: 1
I guess you used JAXB 2.2 to generate the code.
Changing your JAXB from 2.2 to 2.1 might solve this problem.
Hope this helps,
 
 
subject: xml without root element -- JAXB.
 
Similar Threads
Setter method for element with maxOccurs="unbounded"
How to map a xm type to javax.soap.SOAPElement type
JAXB - Named Complex Type is converted to Java content interface
Unable to locate jaxb.properties
root element to wrap all the complexType elements