Transcript XML Notes

Working with XML
Markup Languages


Text-based languages based on SGML
SGML = Standard Generalized Markup Language


Features of SGML-derived markup languages





actually a metalanguage…a set of rules for creating
markup languages
Elements (expressed as tags delimited by < >)
Attributes – features of the elements
Documents – composed of elements
Document type definitions (schema definitions) –
provide the meaning for and structure of elements
and their attributes
HTML and XML are both derivations of SGML
What is XML?








EXtensible Markup Language
A markup language much like HTML
More precisely, a markup metalanguage that allows
you to create your own markup language.
XML was designed to describe data
XML tags are not predefined. You must define your
own tags
XML uses a Document Type Definition (DTD) or an
XML Schema to describe the data
XML with a DTD or XML Schema is designed to be
self-descriptive
Whereas an XML document contains data, an
associated XML Schema contains metadata
describing the format and requirements for that data.
XML vs. HTML

Purpose of HTML: display information on a browser


HTML is a language based on the SGML coding conventions
Purpose of XML: provide a structure for the
description of data




XML is a subset of SGML
It is a metalanguage with no preconceived elements or
attributes
You use XML to create your own “language” for describing
data by specifying elements and attributes
NOTE: a major purpose of XML is to serve as a standardized
protocol for transmitting data between two different
applications communicating with each other over the Web
HTML is for B2C, XML is for B2B
Features of Markup Languages


Document
Element




Elements arranged within the document in
hierarchical order (tree structure)
Each element has a name (first word in its begin tag)
and a value (everything between its begin tag and
its end tag)
Syntax: <name> value </name>
Attribute



Each element can include attributes (properties)
An attribute includes a name and a value
Syntax:
name=value
Sample XML Document
(no attributes)
XML representation is hierarchical: a TREE
What is a tree?


Data structure for representing conceptual or data
hierarchies
A type of collection


Characteristics of a Tree







Other collections? array, table (2-d array), stack, queue, linked
list, hash table (also called dictionary),
Nodes
Links
(also called branches)
Parent-child relationships between nodes
Parent can have many children
Child has only one parent
Path = a route from one node to another in the tree (e.g. from
root to a leaf)
Traversal in a tree
  use RECURSION to implement tree traversal
Example XML Documents

From MS Access



From Amazon Web Services (AWS)


Data from a table or query in a .XML
document
Metadata in a .XSD document (XML Schema)
Result of XML book item search request
For Semantic Web

Web Ontology Language (OWL)
XML version of Departments
table of Employee database
(created by MS Access)
XSD (XML Schema Description) defines
the metadata of an XML document.
XSD is also expressed in XML format.
Created by MS Access
RSS (Really Simple Syndication)
is a common XML format.
An RSS feed is composed of
channels which contain items.
Amazon Web Services (AWS)
provides an XML-based
communication protocol for
interacting with applications
over the internet.
OWL (XML-based)
Web Ontology Language
Semantic web may be the next major
AI Web 2.0 breakthrough in the
internet.
Semantic network is a form or
knowledge representation.