[ 
https://jira.codehaus.org/browse/JIBX-470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=287335#comment-287335
 ] 

Don Corley commented on JIBX-470:
---------------------------------

Yes,
You are correct that you can't unmarshal an object that is not the top-level 
schema object.
If you think about it, there is no reference to the top level object that 
contains the namespace, etc. from a lower level object.
You have two ways to solve this problem.
1. Break your schema into smaller schema where any point where you need to 
unmarshal objects is a top-level schema def. JiBX handles references to other 
schema nicely. You may want to take a look at some simple schema and samples in 
the JiBX schema library at:
http://jibx.sourceforge.net/schema-library/site.html#jibx.org
2. Unmarshal your schema to dom and use a Document Fragment to extract and 
transform your model to xml.
Hope this helps!
Don
                
> Supplied root object of class com.mycompany.domain.Currency cannot be 
> marshalled without top-level mapping
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: JIBX-470
>                 URL: https://jira.codehaus.org/browse/JIBX-470
>             Project: JiBX
>          Issue Type: Bug
>    Affects Versions: JiBX 1.2.3
>         Environment: Java7; Solaris 10; maven3
>            Reporter: Harshit
>
> Hi, I have a use-case where I need to generate Java Objects from XSD and then 
> these objects interact with a component which "takes-in" XML and returns back 
> XML (requires marshalling and unmarshalling of domain object)
> I am able to successfully generate domain objects from XSD by using JiBx's 
> maven codegen plugin. Also I then compiled the sources and ran the 
> compile-time binder on these objects (again using the maven plugin). I then 
> packaged these enhanced class-files into jar file.
> Now, when I am trying to marshal one of these domain objects into XML, I am 
> getting the following error:
> -------------------
> Caused by: org.jibx.runtime.JiBXException: Supplied root object of class 
> com.mycompany.domain.Currency cannot be marshalled without top-level mapping
>       at 
> org.jibx.runtime.impl.MarshallingContext.marshalRoot(MarshallingContext.java:1023)
>       at 
> org.jibx.runtime.impl.MarshallingContext.marshalDocument(MarshallingContext.java:1041)
> -------------------
> Being a beginner, I am not able to understand what is the error that JiBx is 
> trying to convey mean and hence not able to fix this.
> Could you please help me know if I am missing something?
> Thanks in advance!

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to