ID & IDREF Schema Confusion

Good Morning All,

I'm a little confused on how to properly relate an entity to another in XML
Schema.  For example, I have would like to relate an entity I called
"BORROWER" to the "PARTY" element.  Below is an example.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:element name="LENDING_TRANSACTION">
		<xs:annotation>
			<xs:documentation>Comment describing your root element</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element name="PARTY" maxOccurs="unbounded">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="BORROWER" maxOccurs="unbounded">
								<xs:complexType>
									<xs:attribute ref="Party_ID"/>
									<xs:attribute name="Borrower_Name" type="xs:string"/>
								</xs:complexType>
							</xs:element>
						</xs:sequence>
						<xs:attribute name="Party_ID" type="xs:IDREF" use="required"/>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
			<xs:attribute name="Party_ID" type="xs:ID" use="required"/>
			<xs:attribute name="Name" type="xs:string" use="optional"/>
		</xs:complexType>
	</xs:element>
</xs:schema>

Basically, I am trying to covert a datamodel into an XML Schema.  Therefore,
it's imperative that I understand how to relate an entity to another for
reference purposes.

Does this looks like I'm referencing these element's correctly?

Thanks!

Andy

Received on Monday, 25 March 2002 10:28:51 UTC