Couldn't you refactor XSD, create an AbstractResponseType complex type with Errors element, and then have all these specific responses to extend it?
Regards, Stevo. On Thu, Jan 14, 2010 at 11:19 AM, Paul French <[email protected]>wrote: > I have tried using castor to generate java objects from an XSD, I get the > following warnings. > > > > Warning: A class name generation conflict has occured between element > '/complexType:CancelTaskResponseType/Errors' and element > '/complexType:GetTaskTimeByIdResponseType/Errors'. Please use a Binding file > to solve this problem.Continue anyway [not recommended] (y|n|?)y > > > > > > Warning: A class name generation conflict has occured between element > '/complexType:InsertTaskEventResponseType/Errors' and element > '/complexType:GetTaskTimeByIdResponseType/Errors'. Please use a Binding file > to solve this problem.Continue anyway [not recommended] (y|n|?)y > > > > > > Warning: A class name generation conflict has occured between element > '/complexType:RejectQuoteResponseType/Errors' and element > '/complexType:GetTaskTimeByIdResponseType/Errors'. Please use a Binding file > to solve this problem.Continue anyway [not recommended] (y|n|?)y > > > > > > As it happens the generated source compiles fine since the Errors object > generated is the same anyway as you would expect since the “Errors” element > is based on the same type. Example from XSD > > > > <xsd:complexType name=*"UpdateTaskResponseType"*> > > <xsd:sequence> > > <xsd:element minOccurs=*"0"* name=*"Errors"* nillable=* > "true"* > > type=*"tns:ArrayOfErrorType"* /> > > </xsd:sequence> > > </xsd:complexType> > > <xsd:complexType name=*"CompleteTaskResponseType"*> > > <xsd:sequence> > > <xsd:element minOccurs=*"0"* name=*"Errors"* nillable=* > "true"* > > type=*"tns:ArrayOfErrorType"* /> > > </xsd:sequence> > > </xsd:complexType> > > > > > > Why does Castor try and build a java class for each Errors element? I know > I could use a binding file to solve but I will end up with a different java > class for every Errors element when in fact what Castor has finally produced > is what I require? > > > > I thought I would try the setting….. > > > > org.exolab.castor.builder.automaticConflictResolution=true > > > > in my castorbuilder.properties file. > > > > > > I now get: > > > > 14-Jan-2010 10:03:43 org.exolab.castor.builder.JClassRegistry bind > > INFO: Resolving conflict for local element > /complexType:InsertTaskTimeResponseType/Errors[/complexType:ArrayOfErrorType] > against another local element of the same name. > > > > Warning: A class name generation conflict has occured between element > '/complexType:InsertTaskTimeResponseType/Errors' and element > '/complexType:GetTaskTimeByIdResponseType/Errors'. Please use a Binding file > to solve this problem.Continue anyway [not recommended] (y|n|?)n > > > > 14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind > > INFO: Resolving conflict for local element > /complexType:CancelTaskResponseType/Errors[/complexType:ArrayOfErrorType] > against another local element of the same name. > > 14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind > > INFO: Resolving conflict for local element > /complexType:GetTaskByIdResponseType/Errors[/complexType:ArrayOfErrorType] > against another local element of the same name. > > 14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind > > INFO: Resolving conflict for local element > /complexType:AcceptQuoteResponseType/Errors[/complexType:ArrayOfErrorType] > against another local element of the same name. > > 14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind > > INFO: Resolving conflict for local element > /complexType:CompleteTaskResponseType/Errors[/complexType:ArrayOfErrorType] > against another local element of the same name. > > 14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind > > INFO: Resolving conflict for local element > /complexType:UpdateLevelOfCompletionResponseType/Errors[/complexType:ArrayOfErrorType] > against another local element of the same name. > > 14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind > > INFO: Resolving conflict for local element > /complexType:InsertTaskEventResponseType/Errors[/complexType:ArrayOfErrorType] > against another local element of the same name. > > 14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind > > INFO: Resolving conflict for local element > /complexType:ReissueQuoteResponseType/Errors[/complexType:ArrayOfErrorType] > against another local element of the same name. > > 14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind > > INFO: Resolving conflict for local element > /complexType:UpdateTaskResponseType/Errors[/complexType:ArrayOfErrorType] > against another local element of the same name. > > 14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind > > INFO: Resolving conflict for local element > /complexType:FinishTaskTimeResponseType/Errors[/complexType:ArrayOfErrorType] > against another local element of the same name. > > 14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind > > INFO: Resolving conflict for local element > /complexType:InsertResourceAbsenceResponseType/Errors[/complexType:ArrayOfErrorType] > against another local element of the same name. > > 14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind > > INFO: Resolving conflict for local element > /complexType:InsertTaskResponseType/Errors[/complexType:ArrayOfErrorType] > against another local element of the same name. > > 14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind > > INFO: Resolving conflict for local element > /complexType:RejectQuoteResponseType/Errors[/complexType:ArrayOfErrorType] > against another local element of the same name. > > 14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind > > INFO: Resolving conflict for local element > /complexType:UpdateArrivalTimeResponseType/Errors[/complexType:ArrayOfErrorType] > against another local element of the same name. > > 14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry > printStatistics > > INFO: *** Summary *** > > 14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry > printStatistics > > INFO: Local name conflicts encountered for the following element > definitions > > 14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry > printStatistics > > INFO: <forces> > > </forces> > > > > Please note that I have to answer “N” to the question below to get the > above output. > > > > Warning: A class name generation conflict has occured between element > '/complexType:InsertTaskTimeResponseType/Errors' and element > '/complexType:GetTaskTimeByIdResponseType/Errors'. Please use a Binding file > to solve this problem.Continue anyway [not recommended] (y|n|?)n > > > > If I answer “Y” when prompted I get: > > > > 14-Jan-2010 10:10:16 org.exolab.castor.builder.JClassRegistry bind > > INFO: Resolving conflict for local element > /complexType:InsertTaskTimeResponseType/Errors[/complexType:ArrayOfErrorType] > against another local element of the same name. > > > > Warning: A class name generation conflict has occured between element > '/complexType:InsertTaskTimeResponseType/Errors' and element > '/complexType:GetTaskTimeByIdResponseType/Errors'. Please use a Binding file > to solve this problem.Continue anyway [not recommended] (y|n|?)y > > > > 14-Jan-2010 10:10:31 org.exolab.castor.builder.JClassRegistry bind > > INFO: Resolving conflict for local element > /complexType:UpdateTaskResponseType/Errors[/complexType:ArrayOfErrorType] > against another local element of the same name. > > > > Warning: A class name generation conflict has occured between element > '/complexType:UpdateTaskResponseType/Errors' and element > '/complexType:GetTaskTimeByIdResponseType/Errors'. Please use a Binding file > to solve this problem.Continue anyway [not recommended] (y|n|?)y > > 14-Jan-2010 10:10:35 org.exolab.castor.builder.JClassRegistry bind > > INFO: Resolving conflict for local element > /complexType:InsertResourceAbsenceResponseType/Errors[/complexType:ArrayOfErrorType] > against another local element of the same name. > > > > > > Warning: A class name generation conflict has occured between element > '/complexType:InsertResourceAbsenceResponseType/Errors' and element > '/complexType:GetTaskTimeByIdResponseType/Errors'. Please use a Binding file > to solve this problem.Continue anyway [not recommended] (y|n|?)y > > > > 14-Jan-2010 10:10:36 org.exolab.castor.builder.JClassRegistry bind > > INFO: Resolving conflict for local element > /complexType:InsertTaskResponseType/Errors[/complexType:ArrayOfErrorType] > against another local element of the same name. > > > > Warning: A class name generation conflict has occured between element > '/complexType:InsertTaskResponseType/Errors' and element > '/complexType:GetTaskTimeByIdResponseType/Errors'. Please use a Binding file > to solve this problem.Continue anyway [not recommended] (y|n|?)y > > > > 14-Jan-2010 10:10:36 org.exolab.castor.builder.JClassRegistry bind > > INFO: Resolving conflict for local element > /complexType:CompleteTaskResponseType/Errors[/complexType:ArrayOfErrorType] > against another local element of the same name. > > > > Warning: A class name generation conflict has occured between element > '/complexType:CompleteTaskResponseType/Errors' and element > '/complexType:GetTaskTimeByIdResponseType/Errors'. Please use a Binding file > to solve this problem.Continue anyway [not recommended] (y|n|?)y > > > > 14-Jan-2010 10:10:37 org.exolab.castor.builder.JClassRegistry bind > > INFO: Resolving conflict for local element > /complexType:AcceptQuoteResponseType/Errors[/complexType:ArrayOfErrorType] > against another local element of the same name. > > > > Etc etc….. > > > > The code generated is the same whether I say “Y” or “N” and is the same > whether I set org.exolab.castor.builder.automaticConflictResolution=true or > false. > > > > Any pointers please? > > > > Thanks > > Paul >

