facebook twitter
Webucator's Free XML Schema Tutorial

Lesson: Tying It All Together: XML Schema

Welcome to our free XML Schema tutorial. This tutorial is based on Webucator's Introduction to XML Schema course.

Lesson Goals

  • To apply the concepts you have learned thus far.

Tying it all Together

Tying It All Together

Duration: 60 to 120 minutes.

In this exercise, you will write a schema for one of the two documents shown below. You will then give your schema to another student, who will mark up the document as a valid XML instance of your schema. Likewise, you will mark up the document according to someone else's schema. Save both documents in the TyingItTogetherXsd folder. Validate your document. If there are errors, make necessary changes until it is valid.

Business Letter

If you are likely to be working with document-centric content (e.g, books, manuals, or product documentation), you should build a schema for the business letter shown below.

Code Sample:

September 8, 2008

Joshua Lockwood
Lockwood & Lockwood
291 Broadway Ave.
New York, NY 10007
United States

Dear Mr. Lockwood:

Along with this letter, I have enclosed the following items:

	- two original, execution copies of the Webucator Master Services Agreement
	- two original, execution copies of the Webucator Premier Support for Developers Services Description between Lockwood & Lockwood and Webucator, Inc.
Please sign and return all four original, execution copies to me at your earliest convenience.  Upon receipt of the executed copies, we will immediately return a fully executed, original copy of both agreements to you.

Please send all four original, execution copies to my attention as follows:

	Webucator, Inc.
	4933 Jamesville Rd.
	Jamesville, NY 13078  USA
	Attn: Bill Smith
If you have any questions, feel free to call me at 800-555-1000 x123 or e-mail me at bsmith@webucator.com.

Best regards,

Bill Smith
VP, Operations

Transaction Log

If you are likely to be working with data-centric content (e.g, more structured data that maps to a database), you should build a schema for the transaction log described below.


A networking website has a feature that allows people to make connections through other connections they have made in the past. A member can search the member list and on finding someone with whom (s)he would like to connect, (s)he can ask a mutual connection to pass on a message to that person.

Colby Germond is a member of this website. Colby is looking for a new sales manager and, in searching the networking website, finds a woman named Liza Millet who seems to fit the bill. Seeing that Liza is connected with Ted Ferris, an associate of his, Colby writes a message to Liza and a separate message to Ted asking him to forward the message to Liza.

The system keeps a log of this transaction and stores it in an XML format.

Your job is to create a schema to represent this data. A person or computer program reading an XML instance of your schema should be able to figure out the flow of the messages and the role of each individual involved.


Separate the schema definition into multiple files. For example, place all type definitions in a Types.xsd file and import that into your main schema.

Code Sample:

Colby Germond's contact information
Colby H. Germond
Atlanta Sales Corp
210 Peachtree Street NW
Atlanta, GA 30303

Ted Ferris' contact information
Ted Allen Ferris
Farout Ferris Wheels
1333 Eastern Ave
Takoma Park, MD 20912

Liza Millet's contact information
Elizabeth Millet
Vice President, Sales
Saving Sinking Ships, Inc.
2207 7th Ave
New York, NY 10027
(212) 555-3331

MESSAGE 1: Colby's Message to Liza
Dear Ms. Millet,

I found your resume on this site and I would be interested in speaking with you about a possible job opening. Please visit our website at www.atlantasalescorp.com and let me know if you would be interested in speaking.

Please do not use this system to contact me as I rarely check it. Rather email me at cgermond@atlantasalescorp.com.



MESSAGE 2: Colby's Message to Ted
Hi Ted,

Hope all is well with you! Would you mind passing this message along to Liza Millet.

She looks like she'd make a great salesperson to replace Freddy!

Take care!