users@jaxb.java.net

Re: how to specify the customization of these elements

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 13 Mar 2007 09:20:15 -0700

Peizhao Hu wrote:
> Hi,
>
> sorry about my confusing question.
> Firstly, as you can see from the schema, the structure is inputs ->
> inputsType -> _AbstractListType (abstract) -> input. the xjc.sh only
> generate classes as inputs, inputsType, and AbstractListType. A method
> getAny() was generated from xs:Any element as described in
> https://jaxb.dev.java.net/guide/Mapping_of__xs_any___.html
> however, there is no input class for me to generate input objects to
> insert into the abstractListType getAny() list.

You either set DOM elements, or you use classes/JAXBElement that XJC
created for other elements.

> I think the restriction
> in the schema is stating that the _AbstractList takes input element, right?

You mean "AbstractListType"? That takes xs:any, so it takes any elements
, not just <inputs> element (or do you mean 'input element' as a general
noun? I'm still having difficulty parsing your sentence.)

> so to summarise the question:
> Basically, what I want is to let the JAXB schema compiler to generate a
> class as input for me, so that I can create input objects of swe:anyData
> type and insert them into the _AbstractList, getAny() list.

But there's no "swe:anyData" in your fragment you cited. And the
getAny() method requires that you set classes that correspond to XML
elements, not XML types. So if swe:anyData is a complex type or
something, then you can't just set that to the list returned by getAny().

> full schema is available from
> http://vast.uah.edu/SensorML/schema/sensorML_2006-05-09.zip

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com