I deployed one by chance the day before yesterday, but I do not think that that should make a difference at all (as nothing relevant to your area has changed).
Regards Werner Reinhard Weiss wrote: > > i see, thanks. > is there a chance to get a recent [EMAIL PROTECTED] > > regards, reinhard! > > > -----Ursprüngliche Nachricht----- > Von: Werner Guttmann [mailto:[EMAIL PROTECTED] > Gesendet: Mo 28.07.2008 13:18 > An: [email protected] > Betreff: Re: [castor-user] unmarshalling equally named/xpath differing > elements fails with classcastexception > > Reinhard, > > just ran your code (more or less without any modifications) against SVN > trunk, and I am *not* getting any exceptions. In other words, the tests > completes without any exceptions. > > Werner > > Reinhard Weiss wrote: >> hi, >> >> i have an top level (document) element 'A' bound to java class 'TopLevelA'. >> further there is a nested element named 'A' as well, which is bound to >> 'NestedA'. >> (yes, the model is stupid, but i can't change...) >> >> on unmarshalling i get a 'NestedA' object instead of the expected >> 'TopLevelA'. >> >> i am using the 1.2.1-20080723.084025 snapshot available for download. >> >> >> >> in xsd that is: >> >> <?xml version="1.0" encoding="UTF-8"?> >> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >> xmlns:xyz="http://www.xyz.com/" targetNamespace="http://www.xyz.com/" >> elementFormDefault="qualified" attributeFormDefault="unqualified"> >> <xsd:element name="A" type="xyz:SomeType"/> >> <xsd:complexType name="AnotherType"> >> <xsd:simpleContent> >> <xsd:extension base="xsd:string"> >> </xsd:extension> >> </xsd:simpleContent> >> </xsd:complexType> >> <xsd:complexType name="SomeType"> >> <xsd:sequence> >> <xsd:element name="A" type="xyz:AnotherType" >> minOccurs="0" maxOccurs="unbounded"/> >> </xsd:sequence> >> </xsd:complexType> >> </xsd:schema> >> >> >> >> the xml could be >> >> <?xml version="1.0" encoding="UTF-8"?> >> <xyz:A xsi:schemaLocation="http://www.xyz.com/ A.xsd" >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> xmlns:xyz="http://www.xyz.com/"> >> <xyz:A>hello world</xyz:A> >> </xyz:A> >> >> >> >> the corresponding castor binding, which i wrote is: >> >> <?xml version="1.0" encoding="UTF-8"?> >> <binding xmlns="http://www.castor.org/SourceGenerator/Binding" >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> xsi:schemaLocation="http://www.castor.org/SourceGenerator/Binding >> http://castor.org/binding.xsd" defaultBindingType="element"> >> <package> >> <name>com.xyz.model</name> >> <namespace>http://www.xyz/</namespace> >> </package> >> <elementBinding name="/A"> >> <java-class name="TopLevelA"/> >> </elementBinding> >> <elementBinding name="/complexType:SomeType/A"> >> <java-class name="NestedA"/> >> </elementBinding> >> </binding> >> >> >> >> the test fails: >> >> URL castrCdrUrl = >> getClass().getClassLoader().getResource("com/xyz/model/.castor.cdr"); >> assertNotNull(castrCdrUrl); >> assertTrue(castrCdrUrl.toString().contains("classes")); >> assertTrue(new File(castrCdrUrl.toURI()).exists()); >> >> XMLContext context = new XMLContext(); >> context.addPackage("com.xyz.model"); >> Unmarshaller unmarshaller = context.createUnmarshaller(); >> >> InputStream xmlStream = >> getClass().getClassLoader().getResourceAsStream("A.xml"); >> assertNotNull(xmlStream); >> >> DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); >> DocumentBuilder builder = factory.newDocumentBuilder(); >> InputSource is = new InputSource(xmlStream); >> Document xmlDocument = builder.parse(is); >> >> TopLevelA topLevelA = (TopLevelA) unmarshaller.unmarshal(xmlDocument); >> // <- classcastexception >> >> assertNotNull(topLevelA); >> assertNotNull(topLevelA.getNestedA(0)); >> assertEquals("hello world", topLevelA.getNestedA(0).getContent()); >> >> >> >> is this an issue to be reported via jira? >> >> regards, >> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> >> DI Reinhard Weiss >> >> ANECON Software Design und Beratung G.m.b.H. >> >> Web: http://www.anecon.com >> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> >> Zusätzliche Pflichtangaben von Kapitalgesellschaften gem. § 14 UGB: >> FN166941b | Handelsgericht Wien | Firmensitz Wien >> >> >> >> >> --------------------------------------------------------------------- >> 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 --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

