I ran into a related problem with casting the result, but below is how I got
around the issue:
JAXBContext jc =
JAXBContext.newInstance("com.mycompany.j2ee.servlet.filters.config",
this.getClass().getClassLoader()); // best
practice to get the proper classloader
Unmarshaller u = jc.createUnmarshaller();
JAXBElement jaxe = (JAXBElement)u.unmarshal(is);
Object tmpObj = jaxe.getValue();
MyFooType conf = (MyFooType) tmpObj;
I'm not sure why I needed the intermediate cast, but it worked...
Hope this helps...
Cheers,
Erik
Denis-51 wrote:
>
> Hi,
>
>
> JAXB maps
>
> <xsd:complexType name="Item">
> <xsd:sequence minOccurs="0" maxOccurs="unbounded">
> <xsd:element name="titel" type="xsd:string" minOccurs="1"/>
> <xsd:element name="isbn" type="xsd:string" minOccurs="1"/>
> </xsd:sequence>
> </xsd:complexType>
>
> to
> public List<JAXBElement<?>> getTitelAndIsbn()
>
>
> but I want to have String getTitel() and String getIsbn() methods. How I
> may
> have it?
>
>
--
View this message in context: http://www.nabble.com/JAXB-mapping-tp12368788p20968326.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.