I have looked in the archive for this but I couldn't find anything amongst the hundreds of namespace related messages, but if it's a FAQ my apologies.
I have a schema which looks like this <!-- reduced for clarity --> <xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:tns='urn:com-develop-ejws:orinoco-data' targetNamespace='urn:com-develop-ejws:orinoco-data'> <xsd:complexType name='BookType'> <xsd:sequence> <xsd:element name='isbn' type='xsd:string'/> </xsd:sequence> <xsd:attribute name='title' type='xsd:string' use='required'/> <xsd:attribute name='edition' type='xsd:int' use='optional' default="1"/> </xsd:complexType> <xsd:complexType name='BooksType'> <xsd:sequence> <xsd:element name='book' type="tns:BookType" minOccurs="1" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <xsd:element name='books' type='tns:BooksType'/> </xsd:schema> If I use Castor to build Java classes then create and marshal an instance, the instance looks like this <?xml version="1.0" encoding="UTF-8"?> <books xmlns="urn:com-develop-ejws:orinoco-data"> <book title="Nits are Us" edition="1"> <isbn>111-222</isbn> </book> </books> This instance is not valid according to the schema. Notice that the instance is generated with a default namespace, which means that books, book and isbn are all in that namespace. However in the schema only books is defined as being in the namespace (the default element form is unqualified) I'm using the latest Castor (0.9.4.1). Both .Net (xsd) and JAXB (1.0 beta) handle this correctly (so I know I'm not going mad). .Net does this <books xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:com-develop-ejws:orinoco-data"> <book title="More Nits" xmlns=""> <isbn>111-222</isbn> </book> </books> notice the xmlns="" on the book element Jaxb looks like this <ns1:books xmlns:ns1="urn:com-develop-ejws:orinoco-data"> <book edition="1" title="Nits are Us"> <isbn>111-222</isbn> </book> </ns1:books> so it's just qualifying the first element with a prefix. I've tried setting the prefix/namespace explicitly on the marshaller but that simply propagates the prefix to all of the elements. I've also tries setting elementFormDefault="unqualified" on the schema but that has no effect either. Please tell me I'm doing something stupid, Kevin Jones Developmentor www.develop.com ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
