Bookmark and Share

Front Back
Why we need XML
we need this due to webpages are

Not Self describing

Not designed for programmatic access
What is an XML document
XML is a markup language for describing structured data data content not presentation
Three basic features of XML document
  • The Body: elements attributes and character data
  • The Prologue: declarations (entities and external refs)
  • other objects: comments, proccessing instructions
The role of three main features
  • The Body: structured data being stored
  • The prologue: describes features of the body
  • Other objects: facillitates understanding or processing
Basic rules for syntax
  • Single root element
  • Matching opening and closeing tags
  • quoted attributes
  • element and attribute names
  • Repeated elements allowed
  • Unique attribute names on sam element not allowed
  • emplty elements
If a document is said to be well formed
A well formend document obeys syntax rules above.
An XML Document is a tree
each element/attribute/text node belongs to a single element

the root element is where the tree is at the top
Modelling Data
There is no ideal format unlike ERM
the choice is between:
Elements : Flexible, allow for repetition, but clog up doc and slows down proccessing

Attributes are Simple, Not good for complex info, may be easier to find and process
Why we need documeny models
The specify thetype or class of a document

the provide an agreed way of structuring information

provide specification of what data is an is not allowed in the document
Document Type Definition will doo all that a document model needs.

but is in a non-XML notation
Defines the content model of an element in (...) after elemnet name

eg < !ELMENT telegram (to, from) >

< !ELEMENT to (#PCDATA) > this element will be parsed to character data no child elements
x of y cards