Solved

How to create schema suitable for JAXB?

Posted on 2003-11-13
2
308 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Tomcat: Unable to run tomcat service. 2 23
Grunt script for Build Process 1 42
java imports not found 4 19
collection output issue 9 36
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
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…

790 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