Schema Flashcards
What is a schema and what is the base language?
A schema can be used to define XML document tree structure (like DTD).
It’s a XML based language - XML used to describe XML!
There is an XML Schema Document which describes the XML schema language.
How do you start a xml schema document?
See attached
![](https://s3.amazonaws.com/brainscape-prod/system/cm/175/237/420/a_image_thumb.jpg?1452357385)
How do you define an element in xsd (schema language)?
Define element called element with attributes name and type.
It uses an empty element
See attached.
![](https://s3.amazonaws.com/brainscape-prod/system/cm/175/237/520/a_image_thumb.jpg?1452357486)
What is occurence constraint similar to in DTD?
Show an example of a occurence constraint.
An occurence constraint is similar to multiple elements in DTD.
Although you can set the max and min occurrences:
minOccurs = "numeric" maxOccurs = "numeric" | "unbounded"
![](https://s3.amazonaws.com/brainscape-prod/system/cm/175/237/588/a_image_thumb.jpg?1452358678)
How do you show structure and multiple choices in xsd?
Using xsd:sequence and xsd:choice
See attached for example.
![](https://s3.amazonaws.com/brainscape-prod/system/cm/175/238/967/a_image_thumb.jpg?1452358845)
Types like xsd:string, xsd:integer etc are Simple Types.
Describe and give an example of a Complex Type.
Complex types allows you to define new types.
Any element with child elements as content can be defined using a complex type.
See attached example.
![](https://s3.amazonaws.com/brainscape-prod/system/cm/175/239/517/a_image_thumb.jpg?1452359043)
How do you define attributes in xsd?
xsd:attribute name =”foo” type=”xsd:string” use=”required” fixed=”4” default=”3”
- *use:** - required | optional | prohibited
- *fixed:** - takes any constant
- *default:** - takes any constant