Solved

How to create schema suitable for JAXB?

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
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…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

770 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