If i generate all the files from these two schemas in one directory... I am able to obtain the LearningDesign like the following Grp_any grp_any = organizations.getGrp_any(); Grp_any grp_any2 = getOrganizationsGrp_any(grp_any); Object object = grp_any2.getAnyObject(0); if (object instanceof LearningDesign) { ld = (LearningDesign) object; Since we may have to support different version of the schemas the generation of schemas in a single directory seems not to be a good solution.
The problem i have to solve is mapping of AnyNode which contains raw XML to LearningDesign. Which in this case was found in the same directory and processed. I dont know how to map this AnyNode to LearningDesign castor generated file which is in another directory. Regards, Wasim Wasim wrote: > > Hi, > I am using castor-1.0.5. I am not using any mapping file. I generate java > classes from Schemas in their respective packages. Which are > > imscp_v1p1 > imsld_v1p0 > > The xml file's root element is from CP, which is manifest. It contains > Organizations (imscp_v1p1). Organitations contains Grp_any. Which contains > Learning-Design which is part of imsld_v1p0(another package). I am getting > AnyNode as its not able to process this node which is part of another > package. > > If i unmarschal it as following > > StringReader reader = new StringReader(anyObject.toString()); > object = unmarshaller.unmarshal(reader); > > I will get null Items objects which are part of imsld_v1p0 but are > Identifierref to elements of imscp_v1p1. As I processed just AnyObject, > which contains just one node. > > Regards, > Amir > > > Werner Guttmann wrote: >> >> Hi, >> >> can you please be a bit more specific, describing what does not work ? >> Does Castor throw exceptions, does it unmarshal without problems (but are >> the object instances incorrectly populated, etc) ? >> >> In addition, it would be helpful to know whether you are using a mapping >> file, or whether you have generated Java code from the (root) XML schema >> ? And what version of Castor are you looking at ? >> >> Regards >> Werner >> >> -------- Original-Nachricht -------- >> Datum: Mon, 4 Dec 2006 05:06:54 -0800 (PST) >> Von: Wasim <[EMAIL PROTECTED]> >> An: dev@castor.codehaus.org >> Betreff: [castor-dev] Castor unmarschal >> >>> >>> Hi, >>> I am new to Castor, i started programming using it 2 months ago. I need >>> to >>> unmarshal some XML documents to JAVA Code. The xml file uses 3 schemas >>> which >>> can have different version. The problem is a schema is used inside >>> another >>> schema and Castor is unable to unmarshal it. If i unmarshal it manually >>> by >>> getting xml chunk of that particular nod, then the elements of the node >>> may >>> be referring to some elements of other nodes which are not part of the >>> element processed. Please let me know how to handle this problem. >>> Here is an example >>> >>> <?xml version="1.0" encoding="UTF-8"?> >>> <!-- edited with XMLSPY v5 rel. 4 U (http://www.xmlspy.com) by Colin >>> Tattersall (Open University of the Netherlands) --> >>> <manifest xmlns="http://www.imsglobal.org/xsd/imscp_v1p1" >>> xmlns:imscp="http://www.imsglobal.org/xsd/imscp_v1p1" >>> xmlns:imsld="http://www.imsglobal.org/xsd/imsld_v1p0" >>> xmlns:imsmd="http://www.imsglobal.org/xsd/imsmd_v1p2" >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >>> xsi:schemaLocation="http://www.imsglobal.org/xsd/imscp_v1p1 >>> http://www.imsglobal.org/xsd/imscp_v1p1p3.xsd >>> http://www.imsglobal.org/xsd/imsld_v1p0 >>> http://www.imsglobal.org/xsd/IMS_LD_Level_A.xsd >>> http://www.imsglobal.org/xsd/imsmd_v1p2 >>> http://www.imsglobal.org/xsd/imsmd_v1p2p2.xsd" >>> identifier="Hello-World-Manifest"> >>> <organizations> >>> <imsld:learning-design identifier="Hello-World" uri="" >>> level="A"> >>> <imsld:title>Hello LD World</imsld:title> >>> <imsld:components> >>> <imsld:roles> >>> <imsld:learner identifier="student"> >>> >>> <imsld:title>student</imsld:title> >>> </imsld:learner> >>> </imsld:roles> >>> <imsld:activities> >>> <imsld:learning-activity >>> isvisible="true" identifier="hw-1"> >>> <imsld:title>hello ld >>> world</imsld:title> >>> <imsld:activity-description> >>> <imsld:title>hello ld >>> world</imsld:title> >>> <imsld:item >>> isvisible="true" identifierref="A"/> >>> </imsld:activity-description> >>> </imsld:learning-activity> >>> </imsld:activities> >>> </imsld:components> >>> <imsld:method> >>> <imsld:play >>> identifier="cta-hello-new-world-play" isvisible="true"> >>> <imsld:act >>> identifier="cta-hello-new-world-act-1"> >>> <imsld:role-part >>> identifier="cta-hello-new-world-rolepart-1"> >>> <imsld:role-ref >>> ref="student"/> >>> >>> <imsld:learning-activity-ref ref="hw-1"/> >>> </imsld:role-part> >>> </imsld:act> >>> </imsld:play> >>> </imsld:method> >>> </imsld:learning-design> >>> </organizations> >>> <resources> >>> <resource identifier="A" type="webcontent" >>> href="hw-item-1.html"> >>> <file href="hw-item-1.html"/> >>> </resource> >>> </resources> >>> </manifest> >>> >>> >>> The learning.design node is the one which is another schema. It may >>> refer >>> to >>> some elements of manifest resources. >>> >>> Looking forward for reply, >>> Amir >>> -- >>> View this message in context: >>> http://www.nabble.com/Castor-unmarschal-tf2751940.html#a7676457 >>> Sent from the Castor - Dev mailing list archive at Nabble.com. >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe from this list please visit: >>> >>> http://xircles.codehaus.org/manage_email >> >> -- >> Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! >> Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer >> >> --------------------------------------------------------------------- >> To unsubscribe from this list please visit: >> >> http://xircles.codehaus.org/manage_email >> >> >> > > -- View this message in context: http://www.nabble.com/Castor-unmarschal-tf2751940.html#a7697280 Sent from the Castor - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email