Closed skinkie closed 6 years ago
We have not intentionally removed the annotation XmlRootElement. It's probably in the nature of XJC and JAXB, as discussed here: http://stackoverflow.com/a/2172942.
We are using the ObjectFactory.createPublicationDelivery
when marshalling. See https://github.com/rutebanken/netex-java-model/blob/ddb06368e76bdba39a066d5ea562e970e59f0f4d/src/main/java/org/rutebanken/netex/client/PublicationDeliveryClient.java#L69
I'm currently using:
File file = new File(fileName);
JAXBContext jaxbContext = JAXBContext.newInstance(PublicationDeliveryStructure.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
JAXBElement<PublicationDeliveryStructure> publicationDeliveryStructureJAXBElement = (JAXBElement<PublicationDeliveryStructure>) jaxbUnmarshaller.unmarshal(file);
PublicationDeliveryStructure publicationDeliveryStructure = publicationDeliveryStructureJAXBElement.getValue();
Do you get any error messages from executing the code above?
(It should also be possible to do JAXBElement<PublicationDeliveryStructure> jaxbElement = jaxbUnmarshaller.unmarshal(new StreamSource(file), PublicationDeliveryStructure.class);
do avoid the cast)
Is there a reason why PublicationDeliveryStructure isn't annotated as XmlRootElement?