I'm looking to write an XSD which will be used to generate some Java classes via JAXB. I'd like the resulting XML to look like this:
<Appointment>
<Patient ref="12345">Bob Smith</Patient>
<Type>Some Appointment Type</Type>
<Date>2010-02-17</Date>
....
</Appointment>
So, given this schema I'm wanting it to generate a class where I can just do something like this:
Patient p = loadPatientFromDB();
Appointment a = new Appointment();
a.setPatient(p);
a.setType("Some Appointment Type");
I think what I am looking to do involves having an element which has an IDREF as an attribute and then a string as the contents of the element.
Can someone give me a hand with some of the XSD?
Thanks!
EDIT
This question could likely also be asked in the following manner.
Can a simpleType have an attribute, or must it be a complexType.
So, can you have
<element id="foo">bar</element>
or must you have
<element id="foo"><name>bar</name></element>