Home

 

Source view

Finally we tidy up the XML source code that has been created. Select the Source tab, right-click anywhere in the source code, and select Source Æ Format to format the XSD file so that it has a tidy layout.

Save and close the file. The generated Accounts.xsd file is listed in...

Example 10-1 Accounts.xsd file

<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://itso.rad75.xml.com"
	elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema"
	xmlns:itso="http://itso.rad75.xml.com">
	<complexType name="Account">
		<sequence>
			<element name="accountID">
				<simpleType>
					<restriction base="string">
						<pattern value="[0-9]{6,8}"></pattern>
					</restriction>
				</simpleType>
			</element>
			<element name="accountType">
				<simpleType>
					<restriction base="string">
						<enumeration value="Savings"></enumeration>
						<enumeration value="Loan"></enumeration>
						<enumeration value="Fixed"></enumeration>
					</restriction>
				</simpleType>
			</element>
			<element name="balance" type="decimal"></element>
			<element name="interest">
				<simpleType>
					<restriction base="decimal">
						<minExclusive value="0"></minExclusive>
						<maxExclusive value="100"></maxExclusive>
					</restriction>
				</simpleType>
			</element>
			<element name="customerInfo">
				<complexType>
					<sequence>
						<element name="firstName" type="string"></element>
						<element name="lastName" type="string"></element>
						<element name="phoneNumber">
							<simpleType>
								<restriction base="string">
									<pattern value="\([0-9]{3}\) [0-9]{3}-[0-9]{4}">
									</pattern>
								</restriction>
							</simpleType>
						</element>
					</sequence>
				</complexType>
			</element>
		</sequence>
	</complexType>
	<element name="accounts">
		<complexType>
			<sequence>
				<element name="account" type="itso:Account" minOccurs="1"
					maxOccurs="unbounded"></element>
			</sequence>
		</complexType>
	</element>
</schema>

ibm.com/redbooks