Solved

How to create schema suitable for JAXB?

Posted on 2003-11-13
2
317 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Fulfillment API php code sample 1 95
Facing this issue for maven proxy setting 2 45
Is there a simpler dropbox system? 10 53
Java program running SQL query 5 66
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.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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…
Suggested Courses

751 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