users@jaxb.java.net

Re: Inherited classes

From: Vity <vitywap_at_seznam.cz>
Date: Mon, 21 Jul 2008 09:46:36 +0200

Is it possible? Anyone?

-Vity

-----Original Message-----
From: Vity [mailto:vitywap_at_seznam.cz]
Sent: Wednesday, July 16, 2008 3:52 PM
To: users_at_jaxb.dev.java.net
Subject: Inherited classes

Hello,
I start with JAXB and I fight with XSD structure.

Consider following simplified XML structure (I can't change it):
<?xml version="1.0" ?>
<root>
   <foo>
      <x>1</x>
      <y>1</y>
      <q>string-value</q>
   </foo>
   <bar>
      <x>1</x>
      <y>1</y>
      <z>string-value</z>
   </bar>
</root>

I want to map same attributes to parent class like this:
public class FooBar { //this class should be generated
   protected int x; //mapped x
   protected int y; //mapped y
   //..getters and setters for x & y

}

public class Foo extends FooBar {
   protected String q;
   //..getter and setter for q
}

public class Bar extends FooBar {
   protected String z;
   //..getter and setter for z
}

I can't figure out how XSD should like. Is it possible to map elements into
classes like that? I use 6u10.

Thanks in advance.

-Vity


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net