Anton, I will try to provide more detailed answers, but let me comment upon on thing now.
Anton Brass wrote: > Hey Werner, > > so for answering the questions: > > 1) Are those classes by any chance part of a class hierarchy ? > > Yes they are in a class hirarchie, it can be found in the zip file of the > last email. > > 2) Why would you want that just at this very location ? Why not let Castor > decide if it's needed ? Again, a short example might be helpful. > > I want them in this very locations, because i must fit an european standard > for exchange of health information. The XSD can be found here: > http://pangea.upv.es/linkehr/wp-content/uploads/2009/09/en13606.zip > > Maybe I should generate the code out of it? Yes, most definitely. If you happen to have a set of XML schemas available, code generation is your friend. > > 3) More specific example. > > So here we go. > > I just take 6 classes (included in the first email) which I want to combine: > > - RecordComponent with the attributes: > - meaning : CV > - name : SimpleText > > - Composition extends RecordComponent and no needed attributes for the example > > - DataValue with no attributes > > - CD extends DataValue with attributes: > - codedText : String > - codingSchemeName: String > > - Text extends DataValue with the attribute: > - originalText : String > > - SimpleText with no attribute, just specification > > Now I want a Composition with the attributes meaning and name set. After > Marshalling it with my xml mapping (included in the first email) I get this > transformation: > > <COMPOSITION> > <meaning> > <codingSchemeName>AntonBrass</codingSchemeName> > <codeValue>anton</codeValue> > </meaning> > <name xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:type="SIMPLETEXT"> > <originalText>anton</originalText> > </name> > </COMPOSITION> > > > The attribute name behaves like I want it to, setting the xsi:type I defined > in the mapping as map-to, meaning is not. > I want instead it like this: > > <COMPOSITION> > <meaning xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CV"> > <codingSchemeName>AntonBrass</codingSchemeName> > <codeValue>anton</codeValue> > </meaning> > <name xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:type="SIMPLETEXT"> > <originalText>anton</originalText> > </name> > </COMPOSITION> > > Is this possible anyhow? I played with the different settings of the > marshaller, but with no success. The reference guide doesn't help me, because > I have entirely the same mapping and do not want a auto-naming that is > derived by the class. > > If you want I can create a dummy project with the example. > > Feel free to ask further questions! > > Thank you a lot! > > Best regards > > Anton Brass > > > > > > ----- Original Message ----- > From: "Werner Guttmann" <[email protected]> > To: <[email protected]> > Sent: Tuesday, September 22, 2009 2:00 PM > Subject: Re: [castor-user] [XML] XSI:TYPE behavior > > >> Hi Anton, >> >> let me ask you a few questions ..... >> >> Anton Brass wrote: >>> Hey there, >>> >>> I want to use castor for simply mapping existing java objects to xml. >>> >>> >>> But my problem is, that some objects are adding xsi:type >>> automatically and others not. With others I do not mean the simple >>> types directly supported by castor, but own classes, which are not >>> much different to the classes, which are working correctly. >> Are those classes by any chance part of a class hierarchy ? >> >>> I don't really understand how I can switch on/off the xsi:type or can >>> impact the output for this attribute, even after reading the >>> ReferenceGuide chapter many times. >> Well, your options are limited in some way, but there are options. >> >> a) Turn it off completely (option on the Marshaller). >> b) Read >> >> http://castor.org/reference/html/XML%20data%20binding.html#xml.mapping.mappingfile.xsitype >> >> again, and try to play with the options defined (and explained) therein. >> >> c) Showcase a small (self-sufficient) problem that allows us to answer >> your questions more specifically. >> >>> I want that every element which is a field of a class A and type of >>> class B adds my defined map-to type in form of the xsi:type >>> attribute. >> Why would you want that just at this very location ? Why not let Castor >> decide if it's needed ? Again, a short example might be helpful. >> >>> I added all my classes and the mapping files I use as attachment in >>> this E-Mail. The class and its extensions that are not working the >>> same way like the others is called "es.ehrflex.core.en13606.text.CD". >> Sorry, but you will have to break down things so that your questions are >> a bit moire specific. >> >>> I'm using Castor 1.3rc1 (and others tested), JDK 1.6, Apache Tomcat >>> 6.0.0.20, Maven 2 and GWT 1.6.4. >> Why not switch to 1.3 final ? >> >>> Thank you a lot for any helpful suggestions. >>> >>> Best regards >>> >>> Anton Brass >>> >>> >>> ------------------------------------------------------------------------ >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe from this list, please visit: >>> >>> http://xircles.codehaus.org/manage_email >> --------------------------------------------------------------------- >> To unsubscribe from this list, please visit: >> >> http://xircles.codehaus.org/manage_email >> --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

