XML Schemas

The Information School at the University of Washington
LIS 549 U/TU: Intro to Content Management
Fall 2003 * Bob Boiko * MSIM Associate Chair
XML Schemas
The Information School at the University of Washington
Instance documents
• Are they too much?
– Why would I bother to do all that work just to
create a Web page that I could have typed
in?
• Are they enough? How about:
–
–
–
–
–
Making new instances
Keeping control over the tags and their and use
Making sure others know how to create the instance
Using parts of other people’s instances
Adding format to the XML
LIS 549 U/TU: Intro to Content Management * Fall 2004 * Bob Boiko * MSIM Associate Chair
The Information School at the University of Washington
Enter Schemas
• The schema contains all the rules
– What elements are allowed
– What elements within what elements
– What attributes
– What attribute values
• Well formed vs. valid
• Namespaces
• Document Type Definitions (DTD)
LIS 549 U/TU: Intro to Content Management * Fall 2004 * Bob Boiko * MSIM Associate Chair
The Information School at the University of Washington
What are Schemas?
• They are XML!
• They are rules and regulations
• They are MODELS
LIS 549 U/TU: Intro to Content Management * Fall 2004 * Bob Boiko * MSIM Associate Chair
The Information School at the University of Washington
What are the Major Players?
1.
2.
3.
4.
5.
Text or a visual design environment
Elements
Attributes
Nesting
Reuse
LIS 549 U/TU: Intro to Content Management * Fall 2004 * Bob Boiko * MSIM Associate Chair
The Information School at the University of Washington
Schema overview
• Elements
–
–
–
–
Required vs. Optional
Bounded vs. unbounded
Mixed (allows text) vs. elements only
Reference vs. locally defined
• Attributes
– Required vs. Optional
– Type
– Allowed values
• Nesting
– Sequence
– Choice
• Reuse
– Element Groups
• Block elements (my term)
• Inline elements (my term)
LIS 549 U/TU: Intro to Content Management * Fall 2004 * Bob Boiko * MSIM Associate Chair
The Information School at the University of Washington
Navigator
The Spy visual environment Element properties
Element Hierarchy
LIS 549 U/TU: Intro to Content Management * Fall 2004 * Bob Boiko * MSIM Associate Chair
Attribute properties
The Information School at the University of Washington
A quick look at schema text
LIS 549 U/TU: Intro to Content Management * Fall 2004 * Bob Boiko * MSIM Associate Chair
Mixed (allows text) vs. elements only
Required vs. Optional
Bounded vs. unbounded
The Information School at the University of Washington
Elements
Reference vs. locally defined
LIS 549 U/TU: Intro to Content Management * Fall 2004 * Bob Boiko * MSIM Associate Chair
The Information School at the University of Washington
Text in Elements
Only Text Allowed
Text and Elements Allowed
Only Elements Allowed
LIS 549 U/TU: Intro to Content Management * Fall 2004 * Bob Boiko * MSIM Associate Chair
The Information School at the University of Washington
Allowed number (Cardinality)
LIS 549 U/TU: Intro to Content Management * Fall 2004 * Bob Boiko * MSIM Associate Chair
The Information School at the University of Washington
Attributes
Allowed values
Required vs. Optional
ID and IDREF
Group
Type
•An ID is a unique value (starting
with a character)
•An IDREF is a reference to the
ID of an other element
•You use them for the same
reason you always use Id’s
LIS 549 U/TU: Intro to Content Management * Fall 2004 * Bob Boiko * MSIM Associate Chair
The Information School at the University of Washington
Nesting
Choice (optional, unbounded)
Sequence (required)
LIS 549 U/TU: Intro to Content Management * Fall 2004 * Bob Boiko * MSIM Associate Chair
The Information School at the University of Washington
My block and inline model
Group name
LIS 549 U/TU: Intro to Content Management * Fall 2004 * Bob Boiko * MSIM Associate Chair
The Information School at the University of Washington
Back to content modeling
What do you have to figure out?
• What is it called?
• What does it contain?
• How many?
How do you encode it?
• Root element
• Child elements
• Child attributes
LIS 549 U/TU: Intro to Content Management * Fall 2004 * Bob Boiko * MSIM Associate Chair
The Information School at the University of Washington
Forward from a content model
• Figure out what parts of your information
need to be named
• Figure out what metadata you need to
attach to your information
– Descriptive
– Management
– Access
• Build a system that lets you gather, tag
and distribute your information
LIS 549 U/TU: Intro to Content Management * Fall 2004 * Bob Boiko * MSIM Associate Chair