I am looking to write an XSD that will be used to create some Java classes through JAXB. I want 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 diagram, I want it to create 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 that what I want to do is to have an element that has 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?
Thank!
EDIT
This question can also be asked as follows.
Can simpleType have an attribute or should it be complexType.
So can you
<element id="foo">bar</element>
or do you have
<element id="foo"><name>bar</name></element>
source
share