This is a good workaround. Thanks. -----Original Message----- From: Frank Budinsky [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 14, 2007 10:18 AM To: [email protected] Subject: Re: XSD2JavaGenerator
Hi Murtaza, This is a known generator bug. See https://issues.apache.org/jira/browse/TUSCANY-1505 The problem only occurs if you have two factories with the same name. The factory name, by default, is created using the last part of the package name, so since in your case both your packages end with ".dto" you have two factories named "DtoFactory", which then invokes the bug in the generator. One workaround would be to explicitly override one or both of the factory prefixes in your namespaceInfo.properties file: urn:mycompany.com/base;com.mycompany.base.dto;Base urn:mycompany.com/concrete;com.mycompany.concrete.dto;Concrete This will name the factories BaseFactory and ConcreteFactory, instead of both being named DtoFactory (which I think is preferable anyway), and will then avoid the above generator bug. Frank "Murtaza Goga" <[EMAIL PROTECTED]> wrote on 08/14/2007 09:35:56 AM: > We are attempting to migrate to the current release (1.0 incubating) and > we are running into an issue with the static code generator. The init > operation in the factory implementation does not compile, the generated > code uses the fully qualified package name as a variable name. > > > > The options going into the generator: > > -schemaNamespace all -namespaceInfo.properties Concrete_Schema.xsd > > > > The relevant files: > > > > namespaceInfo.properties > > urn:mycompany.com/base;com.mycompany.base.dto > > urn:mycompany.com/concrete;com.mycompany.concrete.dto > > > > > > Base_Schema.xsd > > <?xml version="1.0" encoding="UTF-8"?> > > <xsd:schema > > targetNamespace="urn:mycompany.com/base" > > elementFormDefault="qualified" > > attributeFormDefault="unqualified" > > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > > xmlns:base="urn:mycompany.com/base"> > > > > <xsd:element > > name="letters" > > type="base:FormLetter" /> > > > > <xsd:complexType > > name="FormLetter" > > mixed="true"> > > <xsd:sequence> > > <xsd:element > > name="date" > > minOccurs="0" > > type="xsd:string" /> > > </xsd:sequence> > > </xsd:complexType> > > > > </xsd:schema> > > > > Concrete_Schema.xsd > > <?xml version="1.0" encoding="UTF-8"?> > > <xsd:schema > > targetNamespace="urn:mycompany.com/concrete" > > elementFormDefault="qualified" > > attributeFormDefault="unqualified" > > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > > xmlns:base="urn:mycompany.com/base" > > xmlns:concrete="urn:mycompany.com/concrete"> > > > > <xsd:import > > namespace="urn:mycompany.com/base" > > schemaLocation="Base_Schema.xsd" /> > > > > <xsd:complexType name="ExtendedFormLetter"> > > <xsd:complexContent> > > <xsd:extension base="base:FormLetter"> > > <xsd:sequence> > > <xsd:element > > name="contents" > > type="xsd:string"> > > </xsd:element> > > </xsd:sequence> > > </xsd:extension> > > </xsd:complexContent> > > </xsd:complexType> > > > > </xsd:schema> > > > > The generatae > > public static DtoFactoryImpl init() > > { > > ... > > // Initialize dependent packages > > Compile error below: > > com.mycompany.base.dto.DtoFactory > com.mycompany.base.dto.DtoFactoryInstance = > com.mycompany.base.dto.DtoFactory.INSTANCE; > > ... > > } > > > > > > Any workarounds would be greatly appreciated. > > Thanks, > > Murtaza. > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
