Extensible Markup Language XML: MIS 520 - Database Theory Fall 2001 (Day)
Extensible Markup Language XML: MIS 520 - Database Theory Fall 2001 (Day)
XML
MIS 520 – Database Theory
Fall 2001 (Day)
Lecture 14
Types of Databases
• Data is facts and figures
• Database is a related set of data
Kinds of databases
• Unstructured
– Meaning of data interpreted by user
• Semi-Structured
– Structure of data wrapped around data
• Structured
– Fixed structure of data
– Data added to the fixed structure
XML
• XML is a text based markup language that is fast becoming a
standard of data interchange
– An open standard from W3C
– A direct descendant from SGML
Example
<?xml version=“1.0” encoding=“UTF-8” standalone=“yes” ?>
<contact>
<name first=“Sanjay” last=“Goel”></name> Attributes
<address>
<street>56 Della Street</street> Nested Elements
<city>Phoenix</city>
<state>AZ</state>
<zip>15784</zip>
</address>
</contact>
Elements vs. Attributes
• Data should be stored in Elements
• Information about data (meta-data) should be stored
in attributes
When in doubt use elements
• Rules of thumb
– Elements should have information which some one may
want to read.
– Attributes are appropriate for information about document
that has nothing to do with content of document
e.g. URLs, units, references, ids belong to attributes
– What is your meta-data may be some ones data
Comments
• XML comments begin with “<!--”and end with “-->”
– All data between these delimiters is discarded
– <!-- This is a list of names of people -->
• Comments should not come before XML declaration
• Comments can not be placed inside a tag
• Comments may be used to hide and surround tags
<Name>
<first>Sanjay</first>
<!-- <last>Goel</last> --> Last tag is ignored
</Name>
• “--” string may not occur inside a comment except as part of
its opening and closing tag
– <!-- the Red door -- that is the second --> Illegal