W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2002

ID & IDREF Schema Confusion

From: Andy Del Rio <adelrio@decadesystems.com>
Date: Mon, 25 Mar 2002 10:28:49 -0500
To: <xmlschema-dev@w3.org>
Message-ID: <PJEGLHABDMFKMBPDFGKAGEIECAAA.adelrio@decadesystems.com>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:30 GMT