Solved

How to create schema suitable for JAXB?

Posted on 2003-11-13
2
297 Views
Last Modified: 2013-11-19
I have Java objects containing data, that I want to Marshal/Unmarshal, to and from XML files using JAXB.  How would I go about creating schema(s) so I can then generate the "binding" classes from the schema?  My knowledge of XML and schema is very limited.

Note the JAXB tutorial says: "Representing XML content as Java objects involves two kinds of mappings: binding XML names to Java identifiers, and representing XML schemas as sets of Java classes."  Then it also says: "XML schema languages use XML names to label schema components, however this set of strings is much larger than the set of valid Java class, method, and constant identifiers. " 
Therefore, How does one know how to write proper schema in the first place???  

Are there any tools for generating proper schemas for the JAXB???
0
Comment
Question by:Taurus
2 Comments
 
LVL 15

Accepted Solution

by:
dualsoul earned 75 total points
ID: 9745205
hm...i can suggest you to use some tool, that automaticly generates XMLSchema from xml file:
 
1) XMLSpy (www.xmlspy.com ) - i think the best one for XMLEditing
2) some java IDE could do it, SunONE studio for instance
and so on :) you can easily findit through google

download one of then, generate Schema from your xml and use it with JAXB.
0
 
LVL 1

Assisted Solution

by:FesterWim
FesterWim earned 75 total points
ID: 9745875
XMLSpy is very handy. You can write a sample xml file and generate a XML Schema out of it. If you then tweak that generated schema a bit, you'll be on good way. That is how I did it when I started with JAXB. I didn't know anything about XML Schema either.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
get weblogic logged in user in java 2 58
eclipse java  build path 6 45
map related example 6 36
servlet filter example 37 44
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This video teaches viewers about errors in exception handling.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now