Hi Lois, This is the expected behavior: in castor 0.9.x AnyNode was introduced to map the XML Schema <any> element as well as types defined as being mapped to java.lang.Object in the mapping file (type="other"). Obviously you don't want to use objects but 'String', 'Integer', 'Boolean', 'Long', etc...what you have to do is to change your mapping file by adding the relevant 'type' value (type='string', type='boolean',...). Please see http://www.castor.org/xml-mapping.html#3.4-The-<field>-element for more information.
I hope that helps, Arnaud > -----Original Message----- > From: Neo Sok Lay [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, May 28, 2002 10:04 AM > To: [EMAIL PROTECTED] > Subject: [castor-dev] Marshalling/UnMarshalling behaviour differences between > Castor 0.8.11 and Castor 0.9.x > > Hi, > > I have been using Castor 0.8.11 for marshalling/unmarshalling java > objects<->xml using a mapping file. > Recently, I tried to run the same program through the new versions of castor > 0.9.x, I find that the marshalling/unmarshalling behavior differs and my > objects are marshalled/unmarshalled incorrectly now. > > I guess that is because I am using type="other" for some fields (because the > type may not necessary be a String). Previously using 0.8.11, the namespace > and the type is written to the marshalled document, but not anymore with > 0.9.x, which ended up giving me the AnyNode object instead when I > unmarshalled the document back to my object. > > Does anyone knows how I can remedy this with the 0.9.x versions of castor? > > Marshalled xml document using 0.8.11: > <?xml version="1.0" encoding="UTF-8"?> > <DataFilter type="default" andOr=""> > <Filter negate="false"> > <ValueFilter> > <FilterField > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" > xsi:type="java:java.lang.String">TEST_FIELD_ID_1</FilterField> > <DomainValue > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" > xsi:type="java:java.lang.String">TEST_FIELD_ID_1</DomainValue> > <DomainValue > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" > xsi:type="java:java.lang.String">TEST_FIELD_ID_2</DomainValue> > <DomainValue > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" > xsi:type="java:java.lang.String">TEST_FIELD_ID_3</DomainValue> > </ValueFilter> > <NextFilter negate="false"> > <ValueFilter> > <FilterField > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" > xsi:type="java:java.lang.String">TEST_FIELD_ID_2</FilterField> > <LowValue > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" > xsi:type="java:java.lang.Integer">1</LowValue> > <HighValue > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" > xsi:type="java:java.lang.Long">999999</HighValue> > </ValueFilter> > <NextFilter negate="true"> > <ValueFilter> > <FilterField > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" > xsi:type="java:java.lang.String">TEST_FIELD_ID_3</FilterField> > <Operator>=</Operator> > <SingleValue > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" > xsi:type="java:java.lang.Boolean">true</SingleValue> > </ValueFilter> > </NextFilter> > <NextConnector>or</NextConnector> > </NextFilter> > <NextConnector>and</NextConnector> > </Filter> > </DataFilter> > > > Marshalled document using 0.9.3: > <?xml version="1.0" encoding="UTF-8"?> > <DataFilter type="default" andOr=""> > <Filter negate="false"> > <ValueFilter> > <FilterField>TEST_FIELD_ID_1</FilterField> > <DomainValue>TEST_FIELD_ID_1</DomainValue> > <DomainValue>TEST_FIELD_ID_2</DomainValue> > <DomainValue>TEST_FIELD_ID_3</DomainValue> > </ValueFilter> > <NextFilter negate="false"> > <ValueFilter> > <FilterField>TEST_FIELD_ID_2</FilterField> > <LowValue>1</LowValue> > <HighValue>999999</HighValue> > </ValueFilter> > <NextFilter negate="true"> > <ValueFilter> > <FilterField>TEST_FIELD_ID_3</FilterField> > <Operator>=</Operator> > <SingleValue>true</SingleValue> > </ValueFilter> > </NextFilter> > <NextConnector>or</NextConnector> > </NextFilter> > <NextConnector>and</NextConnector> > </Filter> > </DataFilter> > > > TIA. > Lois > > ----------------------------------------------------------- > 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
