We're using Castor to generate code for XML structures that contain elements from two schemas. When we configure the marshaller to add namespace prefixes to the marshalled output, it puts the wrong namespace tag on some of the elements. Here is a small example with the two schemas and a fragment of Java code. We are using sourcegen with no arguments to generate Java objects corresponding to the schema.
The problem was found in the CVS version as of Dec. 6/2001. <schema targetNamespace="http://www.namespace_check/schema_one.xsd" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:nsone="http://www.namespace_check/schema_one.xsd"> <element name="OneThing" type="string"/> </schema> <schema targetNamespace="http://www.namespace_check/schema_two.xsd" xmlns:nsone="http://www.namespace_check/schema_one.xsd" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:nstwo="http://www.namespace_check/schema_two.xsd"> <import namespace="http://www.namespace_check/schema_one.xsd" schemaLocation="schema_one.xsd"/> <element name="TwoThing" type="nstwo:TwoThingType"/> <complexType name="TwoThingType"> <sequence> <element ref="nsone:OneThing"/> </sequence> </complexType> </schema> ------------------------ Main Program : ------------------------ java.io.StringWriter sw = new StringWriter(); Marshaller debugM = new Marshaller((java.io.Writer)(sw)); debugM.setNamespaceMapping("nsone", "http://www.namespace_check/schema_one.xsd"); debugM.setNamespaceMapping("nstwo", "http://www.namespace_check/schema_two.xsd"); TwoThing tt = new TwoThing(); tt.setOneThing("one thing"); debugM.marshal(tt); StringBuffer buff = sw.getBuffer(); debug(buff.toString()); -------------------------- Program Output: -------------------------- <?xml version="1.0"?> <nstwo:TwoThing xmlns:nstwo="http://www.namespace_check/schema_two.xsd"><nstwo:OneThing>one thing</nstwo:OneThing></nstwo:TwoThing> Error :: OneThing should belong in namespace 'nsone' Irving Reid Principal Technical Architect, SelectAccess Baltimore Technologies ----------------------------------------------------------------------------------------------------------------- The information contained in this message is confidential and is intended for the addressee(s) only. If you have received this message in error or there are any problems please notify the originator immediately. The unauthorized use, disclosure, copying or alteration of this message is strictly forbidden. Baltimore Technologies plc will not be liable for direct, special, indirect or consequential damages arising from alteration of the contents of this message by a third party or as a result of any virus being passed on. In addition, certain Marketing collateral may be added from time to time to promote Baltimore Technologies products, services, Global e-Security or appearance at trade shows and conferences. This footnote confirms that this email message has been swept by Baltimore MIMEsweeper for Content Security threats, including computer viruses. ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
