Click here to Skip to main content
15,886,963 members
Articles / Programming Languages / XML

Simplifying Serialization and De-serialization Processes With XSD.EXE

Rate me:
Please Sign up or sign in to vote.
2.13/5 (11 votes)
30 Jan 20062 min read 129.2K   978   31  
XSD.EXE is an XML Schema Definition tool that generates XML schema or common language runtime classes from XDR, XML, and XSD files, or from classes in a runtime assembly.
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<xsd:complexType name="EmployeeType">
		<xsd:sequence>
			<xsd:element name="EmployeerID" type="xsd:int" />
			<xsd:element name="Name" type="NameType" />
			<xsd:element name="SSN" type="xsd:string" minOccurs="0" />
			<xsd:element name="CurrentAddress" type="AddressType" />
			<xsd:element name="PreviousAddress" type="AddressType" minOccurs="0" maxOccurs="2" />
			<xsd:element name="DriverLicense" type="xsd:string" minOccurs="0" />
			<xsd:element name="Phone" type="PhoneType" minOccurs="0" maxOccurs="3" />
			<xsd:element name="DOB" type="xsd:string" minOccurs="0" />
			<xsd:element name="YOB" type="xsd:string" minOccurs="0" />
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="NameType">
		<xsd:annotation>
			<xsd:documentation />
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element name="Surname">
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:maxLength value="65" />
						<xsd:pattern value="[A-Za-z]+([A-Za-z\-'\s]*)" />
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>
			<xsd:element name="First">
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:maxLength value="32" />
						<xsd:pattern value="[A-Za-z]+([A-Za-z\s]*)" />
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>
			<xsd:element name="Middle" minOccurs="0">
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:maxLength value="32" />
						<xsd:pattern value="[A-Za-z\s]*" />
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>
			<xsd:element name="Gen" minOccurs="0">
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:maxLength value="3" />
						<xsd:pattern value="[A-Za-z0-9\.]*" />
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="AddressType">
		<xsd:sequence>
			<xsd:element name="StreetNumber" minOccurs="0" type="xsd:int"></xsd:element>
			<xsd:element name="StreetName" type="xsd:string"></xsd:element>
			<xsd:element name="City" type="xsd:string"></xsd:element>
			<xsd:element name="State" type="xsd:string"></xsd:element>
			<xsd:element name="Zip" type="xsd:string"></xsd:element>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="PhoneType">
		<xsd:sequence>
			<xsd:element name="Type" minOccurs="0" type="xsd:string"></xsd:element>
			<xsd:element name="Number" type="xsd:string" />
		</xsd:sequence>
	</xsd:complexType>
	<xsd:element name="EmpType" type="EmployeeType"></xsd:element>
</xsd:schema>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
Mr.Y.M.Gopala Krishna Reddy is working as Associate in a leading MNC.His area's of intrest are ReverseEngineering,WebServices and Developing applications using DotNet.

Comments and Discussions