XML For Software Engineers: Tutorial Outline
XML For Software Engineers: Tutorial Outline
Tutorial Outline
Introduction
XML Applications
XML Documents & Processor
Document Type Definition (DTD)
XML Basics
XML Related Technologies
. . XLink & XPointer
. . XSL
. . DOM
. . Namespace
. . XML-Data
. . XML-QL
XML & Software Engineering
2
Contract / Pre-requisite
What are you going to get out of this tutorial ?
> Know about XML and its related technologies
> Know how to use XML in Software Engineering
Pre-requisites
> Software Engineering background
> HTML and/or SGML
3
Introduction
XML - eXtensible Markup Language
XML - W3C (World Wide Web Consortium) Architecture
Domain - headed by Dan Connolly
XML - is based on SGML (Standard Generalized Markup
Language - ISO8879:1986)
XML - allows developers to create their own markup languages
XML - brings structured information to the Web and provides
a data standard that can encode the content, semantics &
schemata for a wide variety of cases
4
Development Timeline
XML 1.0
Recommendation
XML 1.0 Proposed
Recommendation
HTML 4.0
Recommendation
XML Working draft
HTML 3.2
Simplified/stripped-down
SGML draft (dubbed XML)
HTML 2.0
SGML
1986
1995
Nov
1996
Nov
(Jan
1997
1998
5
Aug Dec) Feb
Architectural Dependencies
Instances /
Domains
CKML RDF
XHTML
OFXXHTML
UXF OSD
XMI CKML
RDF CML
CML OFX
OSD CDF
CDF XMI
UXF
XML
XML
...
HTML ...
HTML
SGML
SGML
Extensibility
Easier
Structure
Validation
Less rigid
(Goals)
XML Applications
XML = Grammar
Applications =Vocabulary
On line banking
Push publishing Technology
Web automation
Database publishing
Software distribution
Scientific data
Software Engineering
9
Vertical-industry applications/vocabularies
> Chemical Markup Language (CML)
> Mathematical Markup Language (MathML)
> Open Financial Exchange (OFE or OFX)
> UML eXchange Format (UXF)
10
11
XML
XML
Specification
instantiation
Markup
Language
Definition
World-Wide
Web
Consortium
instantiation
Marked-up
Marked-up
Marked-up
Document
Marked-up
Document
Document
Document
XML User
12
XML Documents
XML
Specification
instantiation
Document
Type
Definition
World-Wide
Web
Consortium
instantiation
Marked-up
Marked-up
Marked-up
Document
XML
Document
Document
Document
XML User
13
XML
Document
XML
Processor
XML
Application
XML
Document
Type
Definition
14
XML Documents
Well-formed document:
Valid document:
It has an associated DTD and each element in the document
must conform to the rules that the DTD defines.
15
XML Documents
Rules for Well-formed documents:
1) Use a single root element;
2) Use a valid XML declarative statement;
3) Keep nesting order clear;
4) Do not overlap elements;
5) Match your start and end tags;
6) Close empty elements with the empty-element tag;
7) Attribute values are always in between
If rules for well-formed
documents are violated
then
there is a fatal error !!!
16
: ORGANISER WINDOW
: MEETING ORGANISER
2: NEW MEETING
(MEETING DETAILS)
5: ASSOCIATE ORGANISER
: MEETING
: ORGANISER
3: NEW DATE (DATE RANGE)
4: NEW DATE (DATE)
: DATE
Create
Meeting
CollDiagram
.xml
TaggedValue
Tag
Package
Value
CollaborationDiagram
XML
Processor
Collaboration
Instance Instance
Message Messag e
UML.dtd
Label Label
18
<!ELEMENT
<!ELEMENT
<!ELEMENT
<!ELEMENT
<!ELEMENT
<!ELEMENT
Model
(TaggedValue?, Package*)>
TaggedValue
(Tag*)>
Tag
(#PCDATA, Value*)>
Value
(#PCDATA)>
Note
(#PCDATA)>
Package (TaggedValue?,Note*,
Dependency*,ClassDiagram?,
CollaborationDiagram?)>
19
20
<?xml version=1.0?>
<!DOCTYPE Model SYSTEM UML.dtd>
<?xml version=1.0?>
<!DOCTYPE RED-BOOK PUBLIC -//W3C//DTD HTML 4.0//EN
http://www.rivendell.org/bilbo/red-book.dtd>
<?xml version=1.0?>
<!DOCTYPE Model
[<!ELEMENT Model (TaggedValue?, Package*)>
<!ELEMENT TaggedValue (Tag)*>
. . . ]>
22
XML Basics
Elements:
start tag, body (content), and end tag
<!ELEMENT Collaboration (TaggedValue?, (Instance
| Interaction | Message | Note)*)>
<!ELEMENT Interaction EMPTY>
<!ELEMENT Note ANY>
<!ELEMENT Process (#PCDATA))
<Collaboration> <TaggedValue>Create Meeting</TaggedValue>
</Collaboration>
<Interaction></Interaction>
<Interaction/>
<Note> Here you can write <Anything/> respecting the <well-formed><rules/>
</well-formed></Note>
<Process> Here we can write any text </Process>
23
Type
#IMPLIED
#REQUIRED
sync
#REQUIRED
#FIXED
Instance >
Default value
24
26
Ex.:
<!DOCTYPE Model SYSTEM UML.dtd[
<!ENTITY uml Class Diagram>]>
<Model>
¨
</Model>
28
White Space:
CDATA Section:
29
Exercise
1) In the extract of DTD and XML documents below there are 9 different types
of syntax errors. Identify these errors and write the correct DTD and XML
documents.
<! ELEMENT ClassDiagram (Class | Interface)*>
<!element Class ((Attribute+, (Operation|Generalization|
Association|Dependency)*)>
<!element Interface EMPTY>
<!ATTLIST Class
%id;
NAME
CDATA #REQUIRED
ABSTRACT (true|false) false
VISIBILITY (public|private) #REQUIRED
ACTIVE
CDATA
#FIXED>
<!ELEMENT Attribute ANY>
.. .
<?xml version=1.0?>
<!ENTITY %id ID CDATA
#REQUIRED>
<ClassDiagram>
<Class ID = C1
NAME = User>
</Class>
<Class ID = C1
NAME = Participant>
</Class>
<Interface> OrganiserWindow
</Interface>
...
</ClassDiagram>
30
Solution
3
.. .
8
2
1
<?xml version=1.0?>
<!ENTITY %id ID CDATA
#REQUIRED>
<ClassDiagram>
<Class ID = C1
5
NAME = User>
</Class>
<Class ID = C1
NAME = Participant>
6
</Class>
<Interface> OrganiserWindow
</Interface>
...
4
</ClassDiagram>
31
Solution
<!ENTITY %id ID CDATA #REQUIRED>
<!ELEMENT ClassDiagram (Class | Interface)*>
<!ELEMENT Class ((Attribute+, (Operation|Generalization|
Association|Dependency)*)>
<!ELEMENT Interface EMPTY>
<!ATTLIST Class
%id;
NAME
CDATA #REQUIRED
ABSTRACT (true|false) false
VISIBILITY (public|private) #REQUIRED
ACTIVE
CDATA
#FIXED true>
<!ELEMENT Attribute ANY>
.. .
<?xml version=1.0?>
<!DOCTYPE ClassDiagram
SYSTEM cldig.dtd">
<ClassDiagram>
<Class ID = C1
NAME = User
VISIBILITY = public>
<Attribute>Password</Attribute>
</Class>
<Class ID = C2
NAME = Participant
VISIBILITY = public>
<Attribute>Address</Attribute>
</Class>
<Interface> </Interface>
...
</ClassDiagram>
32
Exercise
2) Consider the DFD level 1 below. Construct a DTD for the DFD level 1 and
the respective XML document for the given example.
H in t:
Static/Stored data
Control
Panel
user commands
and data
interact with
user
configure
system
configuration
data
configuration information
configuration
data
start stop
active/deact.
system
password
process
password
sensor status
monitor
sensors
sensor inf.
Control
Panel Display
configuration
display inf.
data
a/d msg
valid id msg
Sensor
Function or process
display msgs
& status
Alarm
alarm type
Telephone
Line
33
Solution (DTD)
<!ELEMENT DFD (TaggedValue?, Level*)>
<!ELEMENT TaggedValue (Tag*)>
<!ELEMENT Tag (#PCDATA, Value*)>
<!ELEMENT Value (#PCDATA)>
<!ELEMENT Level (Level0?, Level1?, Level2?)>
<!ELEMENT Level1 (TaggedValue?,(DataSource
|DataDestination| DataFlow
|StoredData| Function) *)
<!ATTLIST Level 1
NAME CDATA #REQUIRED
TEAM CDATA #IMPLIED
DATE
CDATA #IMPLIED>
<!ELEMENT DataSource (DataFlow*)>
<!ATTLIST DataSource
NAME CDATA #REQUIRED>
<!ELEMENT DataDestination (DataFlow*)>
<!ATTLIST DataDestination
NAME CDATA #REQUIRED>
<!ELEMENT DataFlow EMPTY>
<!ATTLIST DataFlow
LABEL
CDATA #REQUIRED
RECEIVER CDATA #REQUIRED
SENDER CDATA #REQUIRED>
<!ELEMENT StoredData (DataFlow*)>
<!ATTLIST StoredData
NAME CDATA #REQUIRED>
<!ELEMENT Function (DataFlow*)>
<!ATTLIST Func tion
NAME CDATA #REQUIRED>
34
Solution (XML)
<?xml version=1.0?>
<!DOCTYPE DFD System DFD.dtd>
<DFD>
<TaggedValue>
<Tag>Title<Value>Alarm System</Value></Tag>
<Tag>Author<Value>R.Pressman</Value></Tag>
</TaggedValue>
<Level>
<Level1 NAME=SafeHome>
<DataSource NAME=Control Panel>
<DataFlow LABEL=user commands and data
RECEIVER=interact with user
SENDER=control panel/>
</DataSource>
<DataSource NAME=Sensors>
<DataFlow LABEL=sensor status
RECEIVER=monitor sensors
SENDER=Sensors/>
</DataSource>
<DataDestination NAME=Control Panel Display>
<DataFlow LABEL=display information>
Solution (XML)
RECEIVER=monitor sensors
SENDER=configuration inf./>
</StoredData>
<Function NAME=interact with user>
<DataFlow LABEL=password
RECEIVER=process password
SENDER=interact with user/>
<DataFlow LABEL=start stop
RECEIVER=activate/deac. system
SENDER=interact with user/>
<DataFlow LABEL=configure request
RECEIVER=configure system
SENDER=interact with user/>
</Function>
<Function NAME=configure system>
<DataFlow LABEL=configure request
RECEIVER=configure system
SENDER=interact with user/>
<DataFlow LABEL=configuration data
RECEIVER=configuration inf.
SENDER=configure system/>
</Function>
<Function NAME=process password>
<DataFlow LABEL=password
RECEIVER=interact with user
SENDER=process password/>
</Function>
<Function NAME=activate/deac. system>
<DataFlow LABEL=start stop
RECEIVER=activate/deac. system
SENDER=interact with user/>
<DataFlow LABEL=a/d msg
RECEIVER=display msgs and status
SENDER=activate/deac. system/>
</Function>
...
</Level1>
</Level>
</DFD>
36
XLink
XPointer
XSL
XML
XML-QL
DOM
XML-Data Namespace
37
Development Timeline
XLink & XPointer
W3C Work. Draft
XLink
Requirements
XLink
XLink W3C
Working Draft
XLink
XPointer
1998
Mar
1999
Feb
1999
Jul
38
XLink
Characteristics:
1) It provides a mechanism for signaling the presence of a
link (recognition)
39
XLink Terminology
Linking element: An XML element that asserts the existence
identifies a resource.
Traversal: The action of using a link (accessing a resource).
Arc: A symbolic representation of traversal behavior in links
(direction, context, and timing of traversal)
40
XLink
vs.
HTML
Multi-directional links
One-way links
Multiple destinations
element
<A xlink:type=SIMPLE
xlink:href=www.html#root()/id(exp)
...>
W3C <\A>
<A HREF=www.html#example>
W3C </A>
42
Goals of XLink
Be usable over the Internet
Be usable by a wide variety of link usage domains and classes
of linking application software
Support HTML 4.0 linking constructs
Expression language must be XML
Be feasible to implement
Be informed by knowledge of established hypermedia systems
and standards
43
Goals of Xlink
(Cont.)
Be designed quickly
Have a formal, concise and illustrative design
Reside within or outside the documents in which the
participating resources reside
Represent the abstract structure and significance of links
44
root( )
...
<Model>
.
.
.
<\Model>
Model
TaggedValue
Tag
Package
Value
CollaborationDiagram
Collaboration
...
45
Simple Link
<!ELEMENT xlink:simple ANY>
<!ATTLIST xlink:simple
href
CDATA
role
CDATA
title
CDATA
show (new|parsed|replace)
actuate (user|auto)
#REQUIRED
#IMPLIED
#IMPLIED
replace
user>
#FIXED http://www.w3...
#FIXED simple
#IMPLIED
#REQUIRED
#IMPLIED
replace
user>
46
Create_meeting CollabDiagram
...
Description of UML elements
Meeting
...
47
Extended Link
<!ELEMENT xlink:extended ((xlink:arc | xlink:locator)*)>
<!ATTLIST xlink:extended
role
CDATA
#IMPLIED
title
CDATA
#IMPLIED
showdefault (new|parsed|replace) #IMPLIED
actuatedefault (user|auto)
#IMPLIED >
<!ELEMENT Extended-Link ((xlink:arc | xlink:locator)*)>
<!ATTLIST Extended-Link
xmlns:xlink
CDATA
#FIXED http://...
xlink:type
(simple|extended|locator|arc) #FIXED extended
xlink:role
CDATA
#IMPLIED
xlink:title
CDATA
#IMPLIED
xlink:showdefault (new|parsed|replace)
#IMPLIED
xlink:actuatedefault (user|auto)
#IMPLIED>
48
Descrorg.xml
showdefault=replace
actuatedefault=user>
<xlink:locator id=inst1
Instance: Organiser
href=http://www.uml.com/Descrmorg.htm/
title=Meeting Organiser >
This is an instance of the collaboration
<xlink:locator id=inst2
diagram named Create_Meeting. It
href=http://www.uml.com/Descrmeet.htm/
title=Meeting >
has messages 3, 4, and 5 associated
<xlink:locator id=inst3
to it ...
Descrmorg.xmlhref=http://www.uml.com/Descrorg.htm/
title=Organiser >
<xlink:arc from=inst1 to=inst3 show=new />
Descrmeet.xml
<xlink:arc
from=inst1
to=inst2 show=new/>
Instance: Meeting
Organiser
</xlink:extended>
...
Instance: Meeting
...
50
#IMPLIED>
#REQUIRED>
Hub
Document
51
descr2.
xml
descr3.
xml
</xlink:group>
descr4.
xml
52
XPointer
XPointer allows you to target a given element by number, name, type, or
relation to other elements in the document.
XPointer avoids modifications in the target document; i.e. unlike HTML it is
not necessary to insert a named anchor in the target document.
HREF = url#XPointer
or
HREF = url|XPointer
URL
HREF = http://www.cs.ucl.ac.ul/~Staff/a.zisman/uml.xml#
root()/child::Package[position()=1]/child::ClassDiagram[position()=1]
XPointer
53
XPointer
(Location Path)
basis
LocationPath:
axis-name :: node-test[predicate]*
(/ axis-name :: node-test[predicate]*)*
54
XPointer
Absolute axes:
Relative axes:
a) root( ) - /
b) origin( )
c) id( )
d) here( )
e) unique( )
a) ancestor
b) ancestor-or-self
c) attribute
d) child
e) descendant
f) descendant-or-self
g) following
h) following-sibling
i) parent
j) preceding
k) preceding-sibling
l) self
XPointer
55
Node Tests:
Predicates:
a) *
b) node( )
c) text( )
d) comment( )
e) processing-instruction( )
a) position ( ) = integer
(<, >, !=, >=, <=)
b) position( ) = last( )
c) Count(Location Path)
d) attribute::attr_name
56
Examples
<?xml version=1.0?>
<!DOCTYPE Model SYSTEM UML.dtd>
<Model>
<TaggedValue>
<Tag>Title<Value>Create Meeting Collaboration Diagram
</Value></Tag>
<Tag>Author<Value>Peter John</Value></Tag>
</TaggedValue>
<Package NAME=Create Meeting>
<CollaborationDiagram>
<Collaboration NAME=Create Meeting>
<Instance CLASS=Meeting Organiser />
<Instance CLASS=Organiser Window />
<Instance CLASS=Organiser />
<Instance CLASS=Meeting />
<Instance CLASS=Date />
<Message TYPE=sync
SENDER=Meeting Organiser
RECEIVER=Organiser Window>
<Label SEQUENCE_EX=1
MESSAGE_NAME=select create me eting/>
</Meesage>
...
</Collaboration>
</CollaborationDiagram>
</Package>
</Model>
XPointer
root( )
child::TaggedValue/child::Tag[positi
on( )=2]/child::Value[position( )=1]
descendant::Instance[position( )=3]
descendant::Message[attribute::
SENDER=Meeting Organiser]
origin( )/parent::*
57
(Cont.)
Axes:
a) range :: LocationPath , LocationPath
ex.: range::/descendant::Instance[position( )=1],
/descendant::Instance[position( )=last( )]
58
Goals of XPointer
Be usable over the Internet
Exercise
3) Consider part of an XML document and the XPointer expressions below
and identify the respective elements.
<Model>
<TaggedValue>
<Tag>Title<Value>Business Entities Class
Diagram</Value></Tag>
<Tag>Date<Value>10/09/99</Value></Tag>
</TaggedValue>
<Package NAME=BusinessEntities>
<ClassDiagram>
<Class NAME=Meeting>
<Attribute NAME="status"
ID="attribute6"
TYPE="String"> </Attribute>
<Attribute NAME="name"
ID="attribute7"
TYPE="String"> </Attribute>
</Class></ClassDiagram> </Package></Model>
a) root( );
b) origin( )/child::Package/
child::ClassDiagram/
child::Class[position()=1]/
child::Attribute[position()=2);
c) id(attribute7);
d) origin( )/parent::*;
e) range::/descendant::Attribute
[position( )=1],/descendant::
Attribute[position( )=2];
f) /descendant::Value[position( )=2];
60
Solution
<Model>
<TaggedValue>
<Tag>Title<Value>Business Entities Class
Diagram</Value></Tag>
<Tag>Date<Value>10/09/99</Value></Tag>
</TaggedValue>
<Package NAME=BusinessEntities>
<ClassDiagram>
<Class NAME=Meeting>
<Attribute NAME="status"
ID="attribute6"
TYPE="String"> </Attribute>
<Attribute NAME="name"
ID="attribute7"
TYPE="String"> </Attribute>
</Class></ClassDiagram> </Package></Model>
a) root( );
b) origin( )/child::Package/
child::ClassDiagram/
child::Class[position()=1]/
child::Attribute[position()=2);
c) id(attribute7);
d) origin( )/parent::*;
e) range::/descendant::Attribute
[position( )=1],/descendant::
Attribute[position( )=2];
f) /descendant::Value[position()=2];
61
XSL
XSL - eXtensible Style Language
Based on ISO/IEC 10179 Document
Style Semantics and Specification
Language (DSSSL)
Development Timeline
W3C XSL
Working Draft
W3C XSL
Version 1.0
W3C XSL
Proposal
1997
Aug
1998
Aug
1999
Apr
XSL Processor
XSL
Stylesheet
Processor
XML
XSL
stylesheet
Tree
Transform.
XSLT
Formatter
Form.
Objects
Presentation
Document
63
(Cont)
XSL
Source Tree
(XML)
XSL
Stylesheet
Result Tree
Rule
Pattern
Template
XML Document
Tree
Construction rules
Presentation
Document Tree
64
XSL (Cont.)
Tree Construction Rules (Template Rules)
Pattern: identifies the element from the XML source document
Examples
XML:
<Tag gedValue>
<Tag>Title<Value>Create Meeting Collaboration Diagram</Value></Tag>
<Tag>Author<Value>Peter John</Value></Tag>
</Tag gedValue>
XSL:
Presentation Document
<xsl:stylesheet
<fo:block font-size=18pt c olor=green
xmlns:xsl=http://www.w3.org/XSL/Transform/1.0 xmlns:fo=http://Format/1.0>Title Create
xmlns:fo=http://www.w3.org/XSL/Format/1.0>
Meeting Collaboration Diagram</fo:bloc k>
<xsl:template match=Tag>
<fo:block font-size=18pt c olor=green
xmlns:fo=http://Format/1.0>Author Peter
<fo:block font-size=18pt color=green>
John</fo:block>
<xsl:apply-templates/>
Date: 11-06-99
</fo:block>
</xsl:template>
<xsl:template match=TaggedValue> Title Create Meeting Collaboration Diagram
<xsl:apply-templates/>
Author Peter John
Date: 11-06-99
Date: 11-06-99
</xsl:template>
</xsl:stylesheet>
66
Examples
XML:
<Tag gedValue>
<Tag>Title<Value>Create Meeting Collaboration Diagram</Value></Tag>
<Tag>Author<Value>Peter John</Value></Tag>
</Tag gedValue>
XSL:
<xsl:stylesheet
<DIV sty le=font-weight:bold; color:blue>
xmlns:xsl=http://www.w3.org/XSL/Transform/1.0> Title Create Meeting Collaboration Diag ram
<xsl:template match=Tag>
</DIV>
<DIV style=font-weight:bold; color:blue>
<DIV sty le=font-weight:bold; color:blue>
Author Peter John </DIV>
<xsl:apply-templates/>
<DIV sty le=color:red>
</DIV>
Date: 11-06-99</DIV>
</xsl:template>
<xsl:template match=TaggedValue>
<xsl:apply-templates/>
Title Create Meeting Collaboration Diagram
<DIV style=color:red>
Author Peter John
Date: 11-06-99</DIV>
Date: 11-06-99
</xsl:template>
</xsl:stylesheet>
67
Other Examples
XML:
<ClassDiagram><Class>Meeting
<Attribute>status</Attribute>
<Attribute>name</Attribute>
<Method>add</Method>
<Method>remove</Method>
</Class></ClassDiagram>
<xsl:stylesheet
xmlns:xsl=http://www.w3.org/XSL/Transform/1.0>
<xsl:template match=ClassDiagram>
<DIV style=font-weight:bold; color:blue>
<xsl:apply-templates select=Method/>
</DIV>
</xsl:template>
</xsl:stylesheet>
<xsl:stylesheet
xmlns:xsl=http://www.w3.org/XSL/Transform/1.0>
<xsl:template match=ClassDiagram>
<ul>
<xsl:apply-templates select=Class>
<xsl:sort select=Attribute/>
< /xsl:apply-templates>
</ul>
</xsl:template>
</xsl:stylesheet>
68
Exercise
4) Write XSL tree construction rules for part of the XML document below
a) Element TaggedValue should be bold and red;
b) Organise element Instance in alphabetical order;
c) Element Message should be of size 20pt and green;
d) Element Label should be yellow.
<TaggedValue>
<Tag>Title<Value>Create Meeting
Collaboration Diagram</Value></Tag>
<Tag>Author<Value>Peter John</Value>
<Model>
</Tag>
</TaggedValue>
<CollaborationDiagram>
<Collaboration NAME=Create Meeting>
<Instance>Meeting Organiser</Instance>
<Instance>Organiser Window</Instance>
<Instance>Organiser</Instance>
<Instance>Meeting</Instance>
<Instance>Date</Instance>
<Message TYPE=sync
SENDER=Meeting Organiser
RECEIVER=Organiser Window>
<Label SEQUENCE_EX=1
MESSAGE_NAME=select create meeting />
</Message>
...
</Collaboration>
</CollaborationDiagram>
</Package>
</Model>
69
Solution
a)
<xsl:template match=TaggedValue>
<DIV style=font-weight:bold; color:red>
<xsl:apply-templates/>
</DIV>
</xsl:template>
b)
<xsl:template match=Instance>
<xsl:apply-templates select=Instance>
<xsl:sort select=Instance/>
< /xsl:apply-templates>
</xsl:template>
c)
<xsl:template match=Message>
<DIV style=font-size:20pt; color:green>
<xsl:apply-templates/>
</DIV>
</xsl:template>
d)
<xsl:template match=Message>
<DIV style=color:yellow>
<xsl:apply-templates select=Label>
</DIV>
</xsl:template>
70
DOM
DOM Level2
W3C Working Draft
(Cont.)
Development Timeline
DOM Level1
W3C Recommen.
DOM identifies:
.
Oct
1998
(Cont.)
DOM
CollaborationDiagram
Parser
Instance
Name
Organiser
Message
Sent
Instance
Name
Message
Meeting
Receiver
DOM Objects
The nodes in the tree represent objects and not data structure.
73
DOM
(Cont.)
DOM
(Cont.)
Level 2:
> Stylesheets: interfaces for associating stylesheets with a
document
> Event model: interfaces for the design of an event system which
allows registration of event handlers, describes event
flow and provides contextual information for each event
> Query, Filters, Iterators, TreeWalker: interfaces to allow
traversal of document subtrees, node lists, or query results
> DOM Range: interfaces for accessing and manipulating a range
of content in a document.
75
Namespace
Development Timeline
W3C
Recommend.
W3C
Working Draft
Sept
1998
Jan
1999
Motivation:
Applications where a single XML document contains elements
and attributes that are defined for and used by multiple software
modules.
Documents containing markup from multiple sources pose problems
of recognition and collision.
76
Namespace
(Cont.)
77
XML-Data
XML-Data is an XML vocabulary (syntax) for schemas;
i.e. for describing and documenting object classes.
XML-Data can describe syntax of XML documents and
conceptual relationships.
XML-Data provides developers to further specify particular
elements (a model for extending XML elements).
Development Timeline
XML-Data
W3C Note
Jan
1998
78
XML-Data (Example)
UML.xml
<?xml version=1.0?>
<?xml:namespace name=http://data.org/
as=dt/?>
UML.dtd
<!ELEMENT Model (Package+)>
<!ELEMENT Package (#PCDATA)>
UML.xml
<?xml version=1.0?>
<!DOCTYPE Model SYSTEM UML.dtd>
<Model>
<Package>Collaboration Diagram</Package>
<Package>Class Diagram</Package>
<Package>StateChart Diagram</Packag e>
</Model>
<dt:schema>
<elementType id=Package>
<string/>
</elementType>
<elementType id=Model>
<element type=#Package
occurs=ONEORMORE/>
</elementType>
</dt:schema>
<Model>
<Package>Collaboration Diagram</Package>
<Package>Class Diagram</Package>
<Package>StateChart Diagram</Package>
</Model>
79
XML-QL
Development Timeline
XML-QL W3C
Working Draft
Who?
AT&T Labs
University of Pensilvania
1998
Aug
XML-QL
80
XML-QL
(Cont.)
XML-QL
(Examples)
XML-QL (Examples)
<!ELEMENT book (author+, title, publisher)>
<!ATTLIST book year CDATA>
<!ELEMENT article (author+, title, year?,
(short|long))>
<!ATTLIST article type CDATA)>
<!ELEMENT publisher (name, address)>
<!ELEMENT author (firstname?, lastname)>
Information Interchange
Mapped
Documents
Documents
Tool i
Tool k
XML
XML
XML
Mapped
Documents
Documents
Tool n
Tool j
XML
XML
85
Consistency Management
Consistency Rules
Documents
Documents
Consistency Links
XML
Translated
XML
Translated
Inconsistency
XML
Documents
Translated
XML
Translated
Documents
86
87
Document Templates
- User requirements documents;
- Software Requirements Specification (SRS IEEE);
- Architectural Design Document;
- Detailed Design Document;
- User Manual;
- Software Verification and Validation Plan;
- Software Engineering Standards (PSS-05-0);
88
Document
XSL
XSL
89
Graphical View
UML
Model
IE 5
Unisys
exporter
XMI
BOX
VML
Netscape
90
Exercise/Solution
Other Software Engineering applications ?
91
Final Remarks
XML is a data description language, subset of SGML;
XML is designed to bring structured information to the Web;
XML provides a data standard that can encode the content,
semantics and schemata for a wide variety of cases;
XML allows identification, exchange and processing of distributed
data in a manner that is mutually understood;
XML provides extensibility, structure, and data checking needed
for a large-scale commercial document distribution and publishing.
92
References
Books:
1) The XML Handbook; C.F. Goldfarb & P. Prescod;
1998; Prentice Hall
2) XML by Example, Building E-Commerce Applications;
S. McGrath; 1998; Prentice Hall
3) XML A Primer; S. St. Laurent; 1998
4) XML Black Book; N. Pitts-Moultis & C. Kirk; 1999; Coriolis
5) XML Specification Guide; I.S. Graham & L. Quin;
1999; John Wiley & Sons, Inc.
93
References (Cont.)
URLs:
1) List of Books
http://www.able-consulting.com/books_xml.htm
2) Technical reports, working drafts, recommendations & notes
http://www.w3.org/TR
3) Software
http://www.xmlsoftware.com/
94