Hi, I'm working with a situation where my main schema has a target namespace, and it imports another schema that does not have a namespace. This example is taken directly from the O'Reilly book by Eric van der Vlist called "XML Schema", section 10.9. The main schema file is called library.xsd and it has a namespace. It is importing a schema file called person.xsd that has no namespace. When I try to generate code, the process fails and says that library.xsd is not valid, because the "person" element (imported from person.xsd) is not resolvable.
I followed the syntax from the book exactly, and both files validate fine in XML Spy. Is this a bug or am I doing something wrong? I have the two schema files, the binding file, and the Castor invocation all below. Note that I am trying to generate Java where each namespace (including the no namespace) goes into a different package, but I hit the same error even if I use no binding file and don't try to do this. Both type binding and element binding also lead to the error. I am using the generate imported schemas option. Including rather than importing is not an option for us; we are using the namespaces and the packages in order to avoid naming collisions. Any help here is greatly appreciated!! Thanks! -Noah ------------------------------------------------------------------------ ------------------------------------------------------------------ Schema Files: library.xsd: <xsd:schema targetNamespace="http://dyomedea.com/ns/library" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:lib="http://dyomedea.com/ns/library" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:import schemaLocation="person.xsd"/> <xsd:element name="library"> <xsd:complexType> <xsd:sequence> <xsd:element name="book" type="lib:bookType"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="bookType"> <xsd:sequence> <xsd:element name="title" type="xsd:string"/> <xsd:element name="authors"> <xsd:complexType> <xsd:sequence> <xsd:element ref="person"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> <xsd:attribute name="id" type="xsd:ID" use="required"/> </xsd:complexType> </xsd:schema> person.xsd: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="person" type="personType"/> <xsd:complexType name="personType"> <xsd:sequence> <xsd:element name="name" type="xsd:string"/> </xsd:sequence> <xsd:attribute name="id" type="xsd:ID" use="required"/> </xsd:complexType> </xsd:schema> ------------------------------------------------------------------------ ------------------------------------------------------------------ Binding file: <binding defaultBindingType="type"> <package> <name>test.lib</name> <namespace>http://dyomedea.com/ns/library</namespace> </package> <package> <name>test.person</name> <namespace /> </package> </binding> ------------------------------------------------------------------------ ------------------------------------------------------------------ Castor invocation: java org.exolab.castor.builder.SourceGenerator \ -generateImportedSchemas -f -nomarshall -types j2 -I library.xsd -dest /myjava -binding-file binding.xml ------------------------------------------------------------------------ ------------------------------------------------------------------ ------------------------------------------------------------------------------ This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice.

