Hi Andreas, This bug is already listed in bugzilla:
http://bugzilla.exolab.org/show_bug.cgi?id=879 Sorry for the inconvenience, Arnaud > -----Original Message----- > From: Andreas M. Schmidt [mailto:[EMAIL PROTECTED]] > Sent: Sunday, February 02, 2003 4:02 PM > To: [EMAIL PROTECTED] > Subject: [castor-dev] Castor 0.9.4.2 marshal produces malformed xml file with > duplicated attributes > > Hello, > > I have problems with Castor's marshal function, which creates malformed xml > files with duplicated attributes. I'm using Castor Version 0.9.4.2. > > I've created java classes with castors sourcebuilder by using the xml schema > below: > > --- xml schema (test.xsd) begin --- > <?xml version="1.0" encoding="UTF-8"?> > <schema xmlns="http://www.w3.org/2001/XMLSchema" > targetNamespace="http://www.zusy.de/2002/XMLSchema" > xmlns:zusy="http://www.zusy.de/2002/XMLSchema" version="1.0.0" > elementFormDefault="qualified"> > > <element name="ZusyMeldung"> > <complexType> > <sequence> > <element name="Daten"> > <complexType> > <sequence> > <element name="Header" type="zusy:Type1"/> > </sequence> > </complexType> > </element> > </sequence> > </complexType> > </element> > > <complexType name="Type1"> > <complexContent> > <restriction base="zusy:Type2"> > <attribute name="meGd" use="required" fixed="AZ01" > type="zusy:Type5"/> > </restriction> > </complexContent> > </complexType> > > <complexType name="Type2"> > <complexContent> > <extension base="zusy:Type3"> > <attribute name="anOrd" use="optional" type="zusy:Type4"/> > </extension> > </complexContent> > </complexType> > > <complexType name="Type3"> > <attribute name="meGd" use="required" type="zusy:Type5"/> > </complexType> > > <simpleType name="Type4"> > <restriction base="string"> > <maxLength value="35"/> > <minLength value="1"/> > </restriction> > </simpleType> > > <simpleType name="Type5"> > <restriction base="string"></restriction> > </simpleType> > > </schema> > --- xml schema (test.xsd) end --- > > I use the following java sourcecode to initialize the castor classes and to > create a xml output file (c:\out.xml): > > --- java sourcecode begin --- > package castor.test; > > import java.io.*; > import org.exolab.castor.xml.*; > import zusy.zusyaz01.*; > > public class CastorTest { > > public CastorTest() { > > ZusyMeldung zusy = new ZusyMeldung(); > Daten daten = new Daten(); > Header header = new Header(); > > daten.setHeader(header); > header.setMeGd("AZ01"); > > try { > header.validate(); > zusy.setDaten(daten); > > FileWriter writer = new FileWriter("c:\\out.xml"); > Marshaller marshaller = new Marshaller(writer); > > marshaller.marshal(zusy); > System.out.println("Success."); > } catch (IOException e) { > System.out.println("IOException: " + e.getLocalizedMessage()); > } catch (ValidationException e) { > System.out.println("ValidationException: " + > e.getLocalizedMessage()); > } catch (MarshalException e) { > System.out.println("MarshalException: " + > e.getLocalizedMessage()); > } > } > > public static void main(String args[]) { > CastorTest myApp = new CastorTest(); > } > } > --- java sourcecode end --- > > the result of the marshal process was: > > --- out.xml begin --- > <?xml version="1.0" encoding="UTF-8"?> > <ZusyMeldung xmlns="http://www.zusy.de/2002/XMLSchema"> > <Daten> > <Header meGd="AZ01" meGd="AZ01"/> > </Daten> > </ZusyMeldung> > --- out.xml end --- > > As you can see, the attribute meGd="AZ01" was duplicated and produces a > malformed xml file. Is there a way to solve this? I have simplified the xml > schema file to show the problem. Originally the xml schema files we use are > much more complex. > > Thanks > Andreas M. Schmidt > > ----------------------------------------------------------- > If you wish to unsubscribe from this mailing, send mail to > [EMAIL PROTECTED] with a subject of: > unsubscribe castor-dev ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
