开发者

How to generate meaningful list names in JAX-WS web services

开发者 https://www.devze.com 2022-12-19 02:20 出处:网络
I have a schema w开发者_如何转开发ith something along the lines of <xs:element ref=\"Item\" minOccurs=\"0\" maxOccurs=\"unbounded\" />

I have a schema w开发者_如何转开发ith something along the lines of

<xs:element ref="Item" minOccurs="0" maxOccurs="unbounded" />

and it is referenced in my wsdl. When I use wsimport to create java code, the class gets a field called

List<Item> item;

Is there a way to get it to name the field something more standard like items or itemList?

I don't want to name the xs:element Items because then I would get a class called Items which is as bad.


Ok, this seemed to solve it:

Instead of

<xs:element ref="Item" minOccurs="0" maxOccurs="unbounded" />

I used

<xs:complexType name="Item">...</xs:complexType>
<xs:element name="ItemList" type="Item" minOccurs="0" maxOccurs="unbounded" />

which resulted in the code:

List<Item> itemList;
0

精彩评论

暂无评论...
验证码 换一张
取 消