Chap1. XML 11th August 2009
Chap1. XML 11th August 2009
XML
• Different goals:
XML was designed to describe data and to focus on what data is.
HTML was designed to display data and to focus on how data
looks.
• HTML—display-oriented, SGML-based
scheme for making Web pages
Syntax & allowed elements (semantics) are fixed
• Inline Reusabiliy
Can be composed from separate entities
Modularize your documents without resorting to links
• Easily Processed
Regular and consistent notation
Vendor-neutral standard
*XML only specify the first three, the fourth is specified by DTD
• XPointer, XLink
Defines a standard way to represent links between resources
• XSL
Defines the standard stylesheet language for XML
• Web services
Facilitating machine-to-machine communications
via XML
Simple Object Access Protocol (SOAP)
XML Protocol Working Group
• Semantic Web
Abstract representation of data on the Web
• XML and Databases
XML
Dr. Mbale J.
34
Elements
Elements are markup that enclose content
• <element_name>…</element_name>
or <element_name />
• Content models
Parsed Character Data Only
Child Elements Only
Mixed
<author>Cole, T</author>
• Attribute
Name-value pairs that occur inside start-tags after
element name, like: <element attribute=“value”>
http://lcweb.loc.gov/marc/specifications/specchartables.
html
• New in XML
Uses XML syntax
Supports datatyping
Richer and more complex
<book xsi:noNamespaceSchemaLocation='HTTP://…'>
<xsd:element name='Book'>
<xsd:complexType>
<xsd:sequence>
<xsd:element name='Front' minOccurs='1'
maxOccurs='1'
type='frontType'/>…
• XPath
Allows addressing of parts of an XML document
Used in XSLT, XPointer, and XQuery
/document/front/author/@number
• XPointer (working draft)
Used as a fragment id in an XML URI reference
http://.../some.xml#xpointer(/document/front/author)
• XLink
Creates and describes extended or simple links between resources
Used for HTML-style hrefs or imgs, tables of contents, etc.
account 332 DB
<telephone number=“332”>
R&D 567 <dept>account</b>
<person>Peter</person>
Peter 332 <person>Jim</person>
</telephone>
332
Jim 332
account
Sue 912 peter,Jim
RDB 567
R&D
Parser
XSL Processor
DOM API
DOM
Tree
DTD HTML
Browser
Benefits:
Changes in the underlying data will not require any changes
to your HTML
Benefits:
• Reduce the complexity of interpreting data
• Easier to expand and upgrade a system
Benefits:
Accessible to more applications