Hi When I compile the following xml schema with sourcegen, I get the error below:
(main schema) <?xml version="1.0" encoding="UTF-8"?> <xs:schema targetNamespace="http://www.coface.com/2002/bdt/core" xmlns:core="http://www.coface.com/2002/bdt/core" xmlns:cct="CoreComponentTypes.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:import namespace="CoreComponentTypes.xsd" schemaLocation="import.xsd"/> <xs:complexType name="TextTypeLocal"> <xs:simpleContent> <xs:extension base="xs:string"/> </xs:simpleContent> </xs:complexType> <xs:complexType name="CityNameBDTLocal"> <xs:simpleContent> <xs:extension base="core:TextTypeLocal"/> </xs:simpleContent> </xs:complexType> <xs:complexType name="CityNameBDT"> <xs:simpleContent> <xs:extension base="cct:TextType"/> </xs:simpleContent> </xs:complexType> </xs:schema> (imported schema) <?xml version="1.0" encoding="UTF-8"?> <xs:schema targetNamespace="CoreComponentTypes.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cct="CoreComponentTypes.xsd" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:complexType name="TextType"> <xs:simpleContent> <xs:extension base="xs:string"/> </xs:simpleContent> </xs:complexType> </xs:schema> P:\XIDE\bin>sourceGen.bat -f -i p:\xide\src\CofaceBase\schema\test.xsd -package com.coface.corp.base.ubl.castor -dest p: \xide\src\CofaceBase java.lang.IllegalArgumentException: getSimpleType: the simple type 'TextType' is not a built-in type as defined in XML Schema specification. at org.exolab.castor.xml.schema.Schema.getSimpleType(Unknown Source) at org.exolab.castor.xml.schema.Schema.getSimpleType(Unknown Source) at org.exolab.castor.xml.schema.Schema.getType(Unknown Source) at org.exolab.castor.xml.schema.reader.ExtensionUnmarshaller.<init>(Unknown Source) at org.exolab.castor.xml.schema.reader.SimpleContentUnmarshaller.startElement(Unknown Source) at org.exolab.castor.xml.schema.reader.ComplexTypeUnmarshaller.startElement(Unknown Source) at org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.startElement(Unknown Source) at org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java:1340) at org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:1197) at org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1862) at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1238) at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381) at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1035) at org.exolab.castor.builder.SourceGenerator.generateSource(Unknown Source) at org.exolab.castor.builder.SourceGenerator.generateSource(Unknown Source) at org.exolab.castor.builder.SourceGenerator.main(Unknown Source) As you can see above, TextType is not a simple type... I had a look in the code and arrived at the conclusion that sourcegen confuses the namespace of the imported schema with the standard xml namespace. ?!? After a couple of hours trying different things, we just removed the following line in the imported schema: xmlns="http://www.w3.org/2001/XMLSchema" i.e. no more default namespace in the imported schema and it started to work! Is this a bug (a manifestation of the wellknown "default namespace crisis") ? Olivier -------------------------------------------------------------------------- Pour s�curiser le commerce inter-entreprises, traditionnel ou sur le web, le Groupe Coface propose @rating, premier syst�me mondial de notation d'entreprises accessible sur Internet au http://www.cofacerating.com In order to make e-commerce or traditional business-to-business transactions safe, the Coface Group offers @rating, the first insurable business rating on the web at http://www.cofacerating.com ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
