Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » Generate Java classes from XSD
Generate Java classes from XSD [message #73269] Wed, 31 October 2007 03:39 Go to next message
Eclipse UserFriend
Originally posted by: akfriebel.yahoo.com.au

I am new to tools such as JAXB, so please forgive me if the answer is
simple.

I am trying to generate java classes from an XSD document. I installed a
plugin for JAXB (version 2.1). This generated my classes, but it
generated '@Xml*' code: eg:

@XmlAccessorType
@XmlEnum
@XmlType

etc

These do not work with java 1.6, and I don't want to have to revert back
to java 1.5.

I am essentially trying to find an easier way to deal with xml rather than
using SAX and DOM directly. I don't really want to have to worry about
the underlying XML structure. I wish to just pump my data into the java
objects, and then marshal the java data into the xml file that I require.
With the objects bound using the xsd document, I know this is achievable
(and many out there are probably doing this already).

I have a simple project I am working on so I can get my knowledge up to
speed. Having the right plugin would be helpful. Can somebody please
point me in the right direction.

Thankyou.
Re: Generate Java classes from XSD [message #73287 is a reply to message #73269] Wed, 31 October 2007 12:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------060101070406050506090006
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Andrew,

Comments below.

Andrew wrote:
> I am new to tools such as JAXB, so please forgive me if the answer is
> simple.
>
> I am trying to generate java classes from an XSD document. I
> installed a plugin for JAXB (version 2.1). This generated my classes,
> but it generated '@Xml*' code: eg:
>
> @XmlAccessorType
> @XmlEnum
> @XmlType
>
> etc
>
> These do not work with java 1.6, and I don't want to have to revert
> back to java 1.5.
I can't provide JAXB help since I've never used it
>
> I am essentially trying to find an easier way to deal with xml rather
> than using SAX and DOM directly. I don't really want to have to worry
> about the underlying XML structure. I wish to just pump my data into
> the java objects, and then marshal the java data into the xml file
> that I require. With the objects bound using the xsd document, I know
> this is achievable (and many out there are probably doing this already).
>
> I have a simple project I am working on so I can get my knowledge up
> to speed. Having the right plugin would be helpful. Can somebody
> please point me in the right direction.
I'd suggest trying this tutorial but with your schema as input instead
of the library example.
< http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. emf.doc/tutorials/xlibmod/xlibmod.html>


http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. emf.doc/tutorials/xlibmod/xlibmod.html

If you invoke "Generate Test Code", in the *.tests projects there will
be an XyzExample.java you can start to modify to see how to serialize an
instance you create programmatically.

This article will be useful as well:

Binding XML to Java
< http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava>

>
> Thankyou.
>
>


--------------060101070406050506090006
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Andrew,<br>
<br>
Comments below.<br>
<br>
Andrew wrote:
<blockquote
cite="mid:2b77282391cae1f3639f2a06236b75a5$1@www.eclipse.org"
type="cite">I am new to tools such as JAXB, so please forgive me if
the answer is simple.
<br>
<br>
I am trying to generate java classes from an XSD document.
Re: Generate Java classes from XSD [message #73305 is a reply to message #73287] Thu, 01 November 2007 02:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: akfriebel.yahoo.com.au

Ed,
Re: Generate Java classes from XSD [message #73321 is a reply to message #73287] Thu, 01 November 2007 02:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: akfriebel.yahoo.com.au

Ed,
Sorry about the last post, my typing got ahead of myself.

Thankyou for your response. I will review the links you provided and see
how I go.
Re: Generate Java classes from XSD [message #73339 is a reply to message #73287] Thu, 01 November 2007 03:38 Go to previous message
Eclipse UserFriend
Originally posted by: akfriebel.yahoo.com.au

Ed,
EMF is very powerful. A lot to digest. Thanks for your input. I am
still to read your article on binding - my head is still spinning from
what EMF can do, and what it can be used for. I appreciate your time to
respond.

I did also get to the bottom of my initial problem. It was a lot simpler
than what I thought. I am using the 1.6 JRE, yet my complier compliance
level (Project properties -> Java Compiler) was only set to 1.4. Good on
me - don't I feel like a goose. When I chnage it to 1.5 or 1.6, my errors
that I reported are resolved.

Thought it was useful to post this in case others were watching the
posting.

Regards,
Andrew
Re: Generate Java classes from XSD [message #602689 is a reply to message #73269] Wed, 31 October 2007 12:05 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26289
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060101070406050506090006
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Andrew,

Comments below.

Andrew wrote:
> I am new to tools such as JAXB, so please forgive me if the answer is
> simple.
>
> I am trying to generate java classes from an XSD document. I
> installed a plugin for JAXB (version 2.1). This generated my classes,
> but it generated '@Xml*' code: eg:
>
> @XmlAccessorType
> @XmlEnum
> @XmlType
>
> etc
>
> These do not work with java 1.6, and I don't want to have to revert
> back to java 1.5.
I can't provide JAXB help since I've never used it
>
> I am essentially trying to find an easier way to deal with xml rather
> than using SAX and DOM directly. I don't really want to have to worry
> about the underlying XML structure. I wish to just pump my data into
> the java objects, and then marshal the java data into the xml file
> that I require. With the objects bound using the xsd document, I know
> this is achievable (and many out there are probably doing this already).
>
> I have a simple project I am working on so I can get my knowledge up
> to speed. Having the right plugin would be helpful. Can somebody
> please point me in the right direction.
I'd suggest trying this tutorial but with your schema as input instead
of the library example.
< http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. emf.doc/tutorials/xlibmod/xlibmod.html>


http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. emf.doc/tutorials/xlibmod/xlibmod.html

If you invoke "Generate Test Code", in the *.tests projects there will
be an XyzExample.java you can start to modify to see how to serialize an
instance you create programmatically.

This article will be useful as well:

Binding XML to Java
< http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava>

>
> Thankyou.
>
>


--------------060101070406050506090006
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Andrew,<br>
<br>
Comments below.<br>
<br>
Andrew wrote:
<blockquote
cite="mid:2b77282391cae1f3639f2a06236b75a5$1@www.eclipse.org"
type="cite">I am new to tools such as JAXB, so please forgive me if
the answer is simple.
<br>
<br>
I am trying to generate java classes from an XSD document.
Re: Generate Java classes from XSD [message #602695 is a reply to message #73287] Thu, 01 November 2007 02:44 Go to previous message
Andrew is currently offline AndrewFriend
Messages: 17
Registered: July 2009
Junior Member
Ed,
Re: Generate Java classes from XSD [message #602698 is a reply to message #73287] Thu, 01 November 2007 02:46 Go to previous message
Andrew is currently offline AndrewFriend
Messages: 17
Registered: July 2009
Junior Member
Ed,
Sorry about the last post, my typing got ahead of myself.

Thankyou for your response. I will review the links you provided and see
how I go.
Re: Generate Java classes from XSD [message #602704 is a reply to message #73287] Thu, 01 November 2007 03:38 Go to previous message
Andrew is currently offline AndrewFriend
Messages: 17
Registered: July 2009
Junior Member
Ed,
EMF is very powerful. A lot to digest. Thanks for your input. I am
still to read your article on binding - my head is still spinning from
what EMF can do, and what it can be used for. I appreciate your time to
respond.

I did also get to the bottom of my initial problem. It was a lot simpler
than what I thought. I am using the 1.6 JRE, yet my complier compliance
level (Project properties -> Java Compiler) was only set to 1.4. Good on
me - don't I feel like a goose. When I chnage it to 1.5 or 1.6, my errors
that I reported are resolved.

Thought it was useful to post this in case others were watching the
posting.

Regards,
Andrew
Previous Topic:Generate Java classes from XSD
Next Topic:[Announce] The EclipseCon 2008 Submission Deadline is Rapidly Approaching.
Goto Forum:
  


Current Time: Tue Dec 23 04:34:42 GMT 2014

Powered by FUDForum. Page generated in 0.01931 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software