Re: JAXB substitutionGroups

2008-04-04 Thread Daniel Kulp

This is covered in the jaxb spec. (section 6.7.5, see example 6-14)   In 
sort, there isn't a way.   The main reason is that the subclasses of 
AbstractFeatureType may not (actually, per spec, they WON'T) have 
XmlRootElement declarations on them so the runtime would have idea what 
the qname of the elements to write out will be.  

According to spec, you should use the ObjectFactory methods to create the 
JAXBElement objects with the correct qnames+values.

From the jaxb spec example, the factory should have methods like:
// Element Instance Factories
JAXBElementAutoType createAuto(AutoType value);
JAXBElementPlaneType createPlane(PlaneType value);
JAXBElementTransportType createTrain(TransportType value);



Dan


On Thursday 03 April 2008, Shaw, Richard A wrote:
 Does anybody know why XSD substitutionGroups cause JAXB to create code
 like the following -

 ListJAXBElement? Extends AbstractFeatureType  features;

 Why isn't it simply -

 ListAbstractFeatureType features;

 Is there any way to change it ? I searched the web and couldn't find
 anything.

 Richard Shaw

 ¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤

 Richard Shaw
 Technical Design Authority - Information Solutions Consultancy
 Intelligent Transport Systems

 Atkins Highways and Transportation
 Woodcote Grove, Ashley Road, Epsom, Surrey, KT18 5BW

 Tel: +44 (0) 1372 756407
 Fax: +44 (0) 1372 740055
 Mob: 07740 817586
 E-mail: [EMAIL PROTECTED]

 www.atkinsglobal.com/its



 This email and any attached files are confidential and copyright
 protected. If you are not the addressee, any dissemination of this
 communication is strictly prohibited. Unless otherwise expressly
 agreed in writing, nothing stated in this communication shall be
 legally binding.

 The ultimate parent company of the Atkins Group is WS Atkins plc. 
 Registered in England No. 1885586.  Registered Office Woodcote Grove,
 Ashley Road, Epsom, Surrey KT18 5BW. A list of wholly owned Atkins
 Group companies registered in the United Kingdom can be found at
 http://www.atkinsglobal.com/terms_and_conditions/index.aspx

 Consider the environment. Please don't print this e-mail unless you
 really need to.



-- 
J. Daniel Kulp
Principal Engineer, IONA
[EMAIL PROTECTED]
http://www.dankulp.com/blog


JAXB substitutionGroups

2008-04-03 Thread Shaw, Richard A
Does anybody know why XSD substitutionGroups cause JAXB to create code like the 
following - 

ListJAXBElement? Extends AbstractFeatureType  features;

Why isn't it simply -

ListAbstractFeatureType features;

Is there any way to change it ? I searched the web and couldn't find anything.

Richard Shaw

¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤

Richard Shaw  
Technical Design Authority - Information Solutions Consultancy  
Intelligent Transport Systems 

Atkins Highways and Transportation 
Woodcote Grove, Ashley Road, Epsom, Surrey, KT18 5BW

Tel: +44 (0) 1372 756407 
Fax: +44 (0) 1372 740055
Mob: 07740 817586 
E-mail: [EMAIL PROTECTED]

www.atkinsglobal.com/its



This email and any attached files are confidential and copyright protected. If 
you are not the addressee, any dissemination of this communication is strictly 
prohibited. Unless otherwise expressly agreed in writing, nothing stated in 
this communication shall be legally binding.

The ultimate parent company of the Atkins Group is WS Atkins plc.  Registered 
in England No. 1885586.  Registered Office Woodcote Grove, Ashley Road, Epsom, 
Surrey KT18 5BW. A list of wholly owned Atkins Group companies registered in 
the United Kingdom can be found at 
http://www.atkinsglobal.com/terms_and_conditions/index.aspx

Consider the environment. Please don't print this e-mail unless you really need 
to.