0% found this document useful (0 votes)
141 views

XML For Software Engineers

This document provides an outline for a tutorial on XML for software engineers. The tutorial will introduce XML, its applications, documents and processors. It will cover document type definitions, XML basics, related technologies like XSL and XML-QL, and how to use XML in software engineering. Participants should have a background in software engineering and knowledge of HTML and/or SGML.

Uploaded by

Sudershan Thaiba
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
141 views

XML For Software Engineers

This document provides an outline for a tutorial on XML for software engineers. The tutorial will introduce XML, its applications, documents and processors. It will cover document type definitions, XML basics, related technologies like XSL and XML-QL, and how to use XML in software engineering. Participants should have a background in software engineering and knowledge of HTML and/or SGML.

Uploaded by

Sudershan Thaiba
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

XML for Software Engineers

Andrea Zisman and Anthony Finkelstein


{a.zisman, a.finkelstein}@cs.ucl.ac.uk
Software Systems Engineering Group
Department of Computer Science
University College London
1

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

1
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

2
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 1996 1997 1998


5
Nov Nov (Jan Aug Dec) Feb

Architectural Dependencies

Instances /
Domains

UXF OSD
UXF OSD CDF
CDF XMI CKML RDF
XMI CKML RDF CML
CML OFX XHTML
OFXXHTML

XML
XML HTML ...
HTML ...

SGML
SGML

3
XML vs. (HTML, SGML)
XML vs. HTML XML vs. SGML

¥ Extensibility ¥ Easier
¥ Structure ¥ Simpler (simplified version)
¥ Validation ¥ Less rigid
¥ Purity: it separates structure & ¥ Provides a small core set of Òeasy-to-
presentation learn-and-useÓ constructs
¥ It allows fine-grained search facilities ¥ It makes tool development simpler
¥ No fixed mark up tags ¥ Useful on the Internet and not just for
large corporate or research applications
¥ It allows integration of data from
diverse sources ¥ It supports easy-to-use sty le sheet
languages 7

The 10 Commandments of XML (Goals)

¥ Be usable over the Internet


¥ Support a wide variety of applications
¥ Be SGML compatible
¥ Be easy to write
¥ Be easy to process by program
¥ Have no optional features (minimum)
¥ Be human-legible and clear
¥ Be designed quickly
¥ Have a formal and concise design
¥ Unambiguous markup
8

4
XML Applications

XML = Grammar
¥ On line banking Applications =Vocabulary

¥ Push publishing Technology

¥ Web automation

¥ Database publishing

¥ Software distribution

¥ Scientific data
¥ Software Engineering
9

Existing XML Applications


¥ Horizontal-industry applications/vocabularies

> Channel Definition Format (CDF)


> Open Software Description (OSD)
> Web Interface Definition Language (WIDL)
> XML Metadata Interchange Format (XMI)

¥Vertical-industry applications/vocabularies

> Chemical Markup Language (CML)


> Mathematical Markup Language (MathML)
> Open Financial Exchange (OFE or OFX)
> UML eXchange Format (UXF)

10

5
Existing XML Applications (Cont.)

¥ Internal applications/vocabularies

> The eXtensible HyperText Markup Language (XHTML)


> Resource Description Framework (RDF)

11

XML

XML instantiation
Specification
Markup
instantiation
Language
Definition
ÒMarked-upÓ
ÒMarked-upÓ
ÒMarked-upÓ
Document
ÒMarked-upÓ
Document
Document
Document
World-Wide
Web
Consortium XML User

12

6
XML Documents

XML instantiation
Specification
Document
instantiation
Type
Definition
ÒMarked-upÓ
ÒMarked-upÓ
ÒMarked-upÓ
Document
XML
Document
Document
Document
World-Wide
Web
Consortium XML User
13

The Big Picture

XML
Document

XML
XML
Application
Processor

XML
Document
Type
Definition

14

7
XML Documents
¥ Well-formed document:

It obeys the rules for creating an XML document. The XML


processor can build a tree structure representing the document. It
does not necessarily have an associated document type definition
(DTD).

¥ 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

8
Example of a Well-Formed-Valid document
XML Declaration <!-- This is a XML document named CreateMeeting_CollDiagram-->

<?xml version=Ò1.0Ó?> Document Type Declaration

1: SELECT CREATE MEETING <!DOCTYPE Model SYSTEM ÒUML.dtdÓ>

<Model> Root
: ORGANISER WINDOW
<TaggedValue>
<Tag>Title<Value>Create Meeting Collaboration Diagram
: MEETING ORGANISER </Value></Tag>
<Tag>Author<Value>Peter John</Value></Tag>
2: NEW MEETING </TaggedValue>
(MEETING DETAILS) <Package NAME=ÒCreate MeetingÓ>
<CollaborationDiagram>
<Collaboration NAME=ÒCreate MeetingÓ>
<Instance CLASS=ÒMeeting OrganiserÓ />
<Instance CLASS=ÒOrganiser WindowÓ />
: MEETING <Instance CLASS=ÒOrganiserÓ />
5: ASSOCIATE ORGANISER
<Instance CLASS=ÒMeetingÓ />
<Instance CLASS=ÒDateÓ />
<Message TYPE=ÒsyncÓ
SENDER=ÒMeeting OrganiserÓ
: ORGANISER RECEIVER=ÒOrganiser WindowÓ>
3: NEW DATE (DATE RANGE) <Label SEQUENCE_EX=Ò1Ó
4: NEW DATE (DATE)
MESSAGE_NAME=Òselect create meetingÓ />
</Message>
...
</Collaboration>
: DATE </CollaborationDiagram>
</Package> 17
</Model>

XML Tree Structure


Model

Create
Meeting TaggedValue Package
CollDiagram
.xml Tag Value

XML CollaborationDiagram

Processor
Collaboration

Instance É Instance Message É Messag e


UML.dtd
Label É Label

18

9
Document Type Definition (DTD)
<!ELEMENT Model (TaggedValue?, Package*)>
UML.dtd <!ELEMENT TaggedValue (Tag*)>
<!ELEMENT Tag (#PCDATA, Value*)>
<!ELEMENT Value (#PCDATA)>
<!ELEMENT Note (#PCDATA)>
<!ELEMENT Package (TaggedValue?,Note*,
Dependency*,ClassDiagram?,
CollaborationDiagram?)>

<!ATTLIST Package NAME CDATA #REQUIRED>

<!ENTITY % ObjectElements "(TaggedValue?,


(Attribute|Operation|
Generalization|Association
|Dependency|Note)* )">
<!ENTITY % ClassDiagram SYSTEM
"class_diagram.dtd">
%ClassDiagram;
<!ENTITY % CollaborationDiagram SYSTEM

"collaboration_diagram.dtd">
%CollaborationDiagram; 19

Document Type Definition (DTD)


CollaborationDiagram.dtd <!ELEMENT CollaborationDiagram (TaggedValue?,
Collaboration*)>
<!ELEMENT Collaboration (TaggedValue?, (Instance
| Interaction | Message | Note)*)>
<!ATTLIST Collaboration
NAME CDATA #REQUIRED
CLASSIFIER CDATA #IMPLIED
OPERATION CDATA #IMPLIED>
<!ELEMENT Instance (Note*)>
<!ATTLIST Instance
NAME CDATA #IMPLIED
CLASS CDATA #REQUIRED
CONSTRAINT CDATA #IMPLIED>
<!ELEMENT Interaction (Message)*>
<!ATTLIST Interaction
NAME CDATA #REQUIRED
CONREXT CDATA #IMPLIED>
<!ELEMENT Message (Label)>
<!ATTLIST Message
NAME CDATA #IMPLIED
TYPE (sync|async|others) ÒsyncÓ
SENDER CDATA #REQUIRED
RECEIVER CDATA #REQUIRED
ACTIVATOR CDATA #IMPLIED
ACTION CDATA #IMPLIED>
<!ELEMENT Label EMPTY>
<!ATTLIST Label
PREDECESSOR CDATA #IMPLIED 20
SEQUENCE_EX CDATA #IMPLIED>

1
Why Create a DTD?

¥ To ensure that your documents conform to a given structure

¥ To provide visual XML editors with information needed to


guide authors

¥ To enable the use of entities

¥ To enable others to make use of the vocabulary you have


created
21

Where to find a DTD?


External DTDs (external DTD subset):
- files with .dtd extension;
- private or public;

Ex.: <?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Ó>

Internal DTDs (internal DTD subset):


- it cannot be used by another XML document;
- it is more convenient for testing;

Ex.: <?xml version=Ò1.0Ó?>


<!DOCTYPE Model
[<!ELEMENT Model (TaggedValue?, Package*)>
<!ELEMENT TaggedValue (Tag)*>
. . . ]> 22

1
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

XML Basics (Cont.)


Attributes:
¥ (attribute, value) pairs associated with elements

Types:
1) String attributes
2) Tokenized attributes
3) Enumerated attributes

<!ATTLIST Message
NAME CDATA #IMPLIED
MESS_IDT ID #REQUIRED
TYPE (sync|async|others) ÒsyncÓ
SENDER CDATA #REQUIRED
LINKED_EL CDATA #FIXED ÒInstanceÓ >
24
Name Type Default value

1
XML Basics (Cont.)
Tokenized Attributes:

- ID: unique identifier for the element within the document;

- IDREF: reference to an element with a specific ID;

- IDREFS: reference to multiple elements with specific IDs;

- ENTITY(IES): points to an external entity;

- NMTOKEN(S): takes a value that is any mixture of letters,


digits, and punctuation characteres.
25

XML Basics (Cont.)


<!ENTITY instance_address SYSTEM Òhttp://www.inst.comÓ>
...
<!ATTLIST Instance
INST_ID ID #REQUIRED
ADDRESS ENTITY #REQUIRED
DATE NMTOKEN #REQUIRED>
...
<!ATTLIST Message
INST_REF IDREFS #REQUIRED>

<Instance
INST_ID=Òinst01Ó
ADDRESS=Òinstance_addressÓ
DATE=Ò11-06-99Ó/>
<Instance
INST_ID=Òinst02Ó
ADDRESS=Òinstance_addressÓ
DATE=Ò12-06-99Ó/>
...
<Message
INST_REF=Òinst01 inst02Ó/> 26

1
XML Basics (Cont.)
Entities:

Internal: The replacement text of the entity is provided with


the declaration;

External: The replacement text of the entity is in another


storage unit; the content portion of the entityÕs
declaration refers to this external storage unit;

Ex.: <!ENTITY % String ÒCDATAÓ>


<!ENTITY % Chapter1 SYSTEM Òchap.dtdÓ>
...
<!ELEMENT Book ANY>
<!ATTLIST Book Title %STRING; #REQUIRED
Chapter_list %Chapter1; #IMPLIED>
27

XML Basics (Cont.)


Parameter: Entities that are used only within the DTD;

General: Entities that can be used anywhere in a document.


This entities are referenced by & (ampersand).

Ex.: É
<!DOCTYPE Model SYSTEM ÒUML.dtdÓ[
<!ENTITY uml ÒClass DiagramÓ>]>

<Model>
&uml;
</Model>

28

1
XML Basics (Cont.)

Other Definitions:

¥ Comments <!-- Attention, this is a comment -->

¥ White Space: space, tab, carriage return, and line feed

¥ CDATA Section: <![CDATA[This text is insulated from


attention of the parser]]>

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.

<?xml version=Ò1.0Ó?>
<! ELEMENT ClassDiagram (Class | Interface)*> <!ENTITY %id ÒID CDATA
<!element Class ((Attribute+, (Operation|Generalization| #REQUIREDÓ>
Association|Dependency)*)> <ClassDiagram>
<!element Interface EMPTY> <Class ID = ÒC1Ó
<!ATTLIST Class NAME = User>
%id; </Class>
NAME CDATA #REQUIRED <Class ID = ÒC1Ó
ABSTRACT (true|false) ÒfalseÓ NAME = Participant>
VISIBILITY (public|private) #REQUIRED </Class>
ACTIVE CDATA #FIXED> <Interface> OrganiserWindow
<!ELEMENT Attribute ANY> </Interface>
.. . ...
</ClassDiagram>

30

1
Solution
3 9 7 2
<! ELEMENT ClassDiagram (Class | Interface)*>
<!element Class ((Attribute+, (Operation|Generalization| 1
Association|Dependency)*)>
<!element Interface EMPTY> <?xml version=Ò1.0Ó?>
<!ATTLIST Class <!ENTITY %id ÒID CDATA
%id; #REQUIREDÓ>
NAME CDATA #REQUIRED <ClassDiagram>
ABSTRACT (true|false) ÒfalseÓ <Class ID = ÒC1Ó 5
VISIBILITY (public|private) #REQUIRED NAME = User>
ACTIVE CDATA #FIXED> </Class>
<!ELEMENT Attribute ANY> <Class ID = ÒC1Ó
.. . NAME = Participant>
</Class> 6
<Interface> OrganiserWindow
8 </Interface>
...
4 </ClassDiagram>

31

Solution
<!ENTITY %id ÒID CDATA #REQUIREDÓ>
<!ELEMENT ClassDiagram (Class | Interface)*> <?xml version=Ò1.0Ó?>
<!ELEMENT Class ((Attribute+, (Operation|Generalization| <!DOCTYPE ClassDiagram
Association|Dependency)*)>
SYSTEM Ócldig.dtd">
<!ELEMENT Interface EMPTY> <ClassDiagram>
<!ATTLIST Class <Class ID = ÒC1Ó
%id; NAME = ÒUserÓ
NAME CDATA #REQUIRED VISIBILITY = ÒpublicÓ>
ABSTRACT (true|false) ÒfalseÓ <Attribute>Password</Attribute>
VISIBILITY (public|private) #REQUIRED </Class>
ACTIVE CDATA #FIXED ÒtrueÓ> <Class ID = ÒC2Ó
<!ELEMENT Attribute ANY> NAME = ÒParticipantÓ
.. . VISIBILITY = ÒpublicÓ>
<Attribute>Address</Attribute>
</Class>
<Interface> </Interface>
...
</ClassDiagram>

32

1
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:

Input or data source/ Data Flow Static/Stored data


Function or process
Output or data destination

configure configuration
Control request configure data configuration information
Panel system Control
interact with Panel Display
user commands configuration
user data configuration
and data start stop display inf.
data
active/deact.
password
system a/d msg Alarm
process valid id msg
password display msgs
& status alarm type
sensor inf.
Sensor monitor Telephone
sensors Line
sensor status
telephone number tones

33

Solution (DTD)
<!ELEMENT DFD (TaggedValue?, Level*)> LABEL CDATA #REQUIRED
<!ELEMENT TaggedValue (Tag*)> RECEIVER CDATA #REQUIRED
<!ELEMENT Tag (#PCDATA, Value*)> SENDER CDATA #REQUIRED>
<!ELEMENT Value (#PCDATA)> <!ELEMENT StoredData (DataFlow*)>
<!ELEMENT Level (Level0?, Level1?, Level2?)> <!ATTLIST StoredData
<!ELEMENT Level1 (TaggedValue?,(DataSource NAME CDATA #REQUIRED>
|DataDestination| DataFlow <!ELEMENT Function (DataFlow*)>
|StoredData| Function) *) <!ATTLIST Func tion
<!ATTLIST Level 1 NAME CDATA #REQUIRED>
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
34

1
Solution (XML)
<?xml version=Ò1.0Ó?> RECEIVER=ÒControl Panel DisplayÓ
<!DOCTYPE DFD System ÒDFD.dtdÓ> SENDER=Òdisplay msgs & statusÓ/>
<DFD> </DataDestination>
<TaggedValue> <DataDestination NAME=ÒAlarmÓ>
<Tag>Title<Value>Alarm System</Value></Tag> <DataFlow LABEL=Òalarm typeÓ
<Tag>Author<Value>R.Pressman</Value></Tag> RECEIVER=ÒAlarmÓ
</TaggedValue> SENDER=Òmonitor sensorsÓ/>
<Level> </DataDestination>
<Level1 NAME=ÒSafeHomeÓ> <DataDestination NAME=ÒTelephone LineÓ>
<DataSource NAME=ÒControl PanelÓ> <DataFlow LABEL=Òtelephone number tonesÓ
<DataFlow LABEL=Òuser commands and dataÓ RECEIVER=ÒTelephone LineÓ
RECEIVER=Òinteract with userÓ SENDER=Òmonitor sensorsÓ/>
SENDER=Òcontrol panelÓ/> </DataDestination>
</DataSource> <StoredData NAME=Òconfiguration inf.Ó>
<DataSource NAME=ÒSensorsÓ> <DataFlow LABEL=Òconfiguration dataÓ
<DataFlow LABEL=Òsensor statusÓ RECEIVER=Òconfiguration inf.Ó
RECEIVER=Òmonitor sensorsÓ SENDER=Òconfigure systemÓ/>
SENDER=ÒSensorsÓ/> <DataFlow LABEL=Òconfiguration dataÓ
</DataSource> RECEIVER=Òdisplay msgs & statusÓ
<DataDestination NAME=ÒControl Panel DisplayÓ> SENDER=Òconfiguration infÓ/>
<DataFlow LABEL=Òdisplay informationÓ> <DataFlow LABEL=Òa/d msgÓ
35

Solution (XML)
RECEIVER=Òmonitor sensorsÓ
</Function>
SENDER=Òconfiguration inf.Ó/>
<Function NAME=Òprocess passwordÓ>
</StoredData>
<DataFlow LABEL=ÒpasswordÓ
<Function NAME=Òinteract with userÓ>
RECEIVER=Òinteract with userÓ
<DataFlow LABEL=ÒpasswordÓ
SENDER=Òprocess passwordÓ/>
RECEIVER=Òprocess passwordÓ
</Function>
SENDER=Òinteract with userÓ/>
<Function NAME=Òactivate/deac. systemÓ>
<DataFlow LABEL=Òstart stopÓ
<DataFlow LABEL=Òstart stopÓ
RECEIVER=Òactivate/deac. systemÓ
RECEIVER=Òactivate/deac. systemÓ
SENDER=Òinteract with userÓ/>
SENDER=Òinteract with userÓ/>
<DataFlow LABEL=Òconfigure requestÓ
<DataFlow LABEL=Òa/d msgÓ
RECEIVER=Òconfigure systemÓ
RECEIVER=Òdisplay msgs and statusÓ
SENDER=Òinteract with userÓ/>
SENDER=Òactivate/deac. systemÓ/>
</Function>
</Function>
<Function NAME=Òconfigure systemÓ>
...
<DataFlow LABEL=Òconfigure requestÓ
</Level1>
RECEIVER=Òconfigure systemÓ
</Level>
SENDER=Òinteract with userÓ/>
</DFD>
<DataFlow LABEL=Òconfiguration dataÓ
RECEIVER=Òconfiguration inf.Ó
SENDER=Òconfigure systemÓ/>
36

1
XML and Related Technologies

XPointer
XLink
XSL

XML
XML-QL DOM

XML-Data Namespace

37

Linking with XML

Link: is an explicit relationship between two or more


data objects or portions of data objects.

Address: is the description of how to find the two


objects being linked
Development Timeline
XML-LINK XLink & XPointer
W3C Work. Draft
XLL
XLink
XLink Requirements

XLink W3C
Working Draft

XLink 1998 1999 1999


XPointer
Mar Feb Jul
38

1
XLink
Characteristics:

1) It provides a mechanism for signaling the presence of a


link (recognition)

2) It defines, partially, the intended behavior of the link

3) It extends the types of hypertext links that can be used


beyond the simple hypertext model of HTML

39

XLink Terminology
¥ Linking element: An XML element that asserts the existence
and describes the characteristics of a link.

¥ Resource: The addressable unit of information; anything that


you can point at on the Web (e.g. file, document,
program, image, query results, sound file).

¥ Locator: Character string associated with a link which


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

2
XLink Terminology (Cont.)
¥ Inline Link: A link that serves as one of its own resources. In
an inline link the content of the linking element
acts as a resource.

¥ Out-of-line Link: A link whose content does not serve as one


of the resources of the link.

¥Multidirectional Link: A link that can be traversed from more


than one of its resources. A link that
points the user in more than one
direction. It gives the ability to move
up, down, left, right, or backward.
41

XLink vs. HTML


¥ Any element can be a link ¥ Only A and IMG as link elements
element
¥ Control link behavior ¥ One behavior for A and one for
IMG
¥ Multi-directional links ¥ One-way links
¥ Multiple destinations ¥ One link destination
¥ Indirect links via link files ¥ Link destination ÒlivesÓ in source
¥ Links to specific unit of ¥ Links to the entire document
information

<A xlink:type=ÒSIMPLEÓ
xlink:href=Òwww.html#root()/id(ÒexpÓ)Ó <A HREF=Òwww.html#exampleÓ>
...> W3C </A>
W3C <\A> 42

2
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 human-readable and human-writeable

¥ 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

2
XLink vs. XPointer
XLink: Is the syntax used to assert link existence and to
describe link characteristics
XPointer: Is a language that supports addressing into the
internal structures of XML documents. It points to
subparts of XML resources (fragment identifier)
origin( )/child::*[position( )=2]
<?xml version=Ò1.0Ó?> root( )
... Model
<beg in> <Model>
... .
.
<!-- link to XML document--> .
<D xlink:type=ÒSIMPLEÓ <\Model>
TaggedValue Package
. . . > <\D>
...
<!-- link to GIF g raphic--> Tag Value
<G xlink:type=ÒSIMPLEÓ
. . .> <\G> CollaborationDiagram
...
<\beg in>
Collaboration ... 45

Simple Link
<!ELEMENT xlink:simple ANY>
<!ATTLIST xlink:simple
href CDATA #REQUIRED
role CDATA #IMPLIED
title CDATA #IMPLIED
show (new|parsed|replace) ÒreplaceÓ
actuate (user|auto) ÒuserÓ>

<!ELEMENT Simple-Link ANY>


<!ATTLIST Simple-Link
xmlns:xlink CDATA #FIXED Òhttp://www.w3...Ó
xlink:type (simple|extended|locator|arc) #FIXED ÒsimpleÓ
xlink:role CDATA #IMPLIED
xlink:href CDATA #REQUIRED
xlink:title CDATA #IMPLIED
xlink:show (new|parsed|replace) ÒreplaceÓ
xlink:actuate (user|auto) ÒuserÓ>
46

2
Simple Link (Example)
<xlink:simple
Descr.xml
href=Òhttp://www.uml.com/descr.xmlÓ
title=ÒDescription of UML elementsÓ
role=Òmeeting descriptionÓ
show=Ònew Ó>Meeting
Instance: Meeting
</xlink:simple>
This is an instance of the collaboration
diagram named Create_Meeting. It
has messages 2, 3, 4, and 5 associated
to it ...
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

2
Extended Link (Cont.)
<!ELEMENT xlink:arc ANY>
<!ELEMENT xlink:locator ANY> <!ATTLIST xlink:arc
<!ATTLIST xlink:locator from IDREF #REQUIRED
id ID #REQUIRED to IDREF #REQUIRED
href CDATA #REQUIRED show (new|parsed|replace) ÒreplacedÓ
role CDATA #IMPLIED actuate (user|auto) ÒuserÓ >
title CDATA #IMPLIED >

<!ELEMENT generic_arc ANY>


<!ELEMENT Reference ANY> <!ATTLIST generic_arc
<!ATTLIST Reference xmlns:xlink CDATA #FIXED
xmlns:xlink CDATA #FIXED Òhttp://www.w3.org...Ó
Òhttp://www.w3.org...Ó xlink:type (arc) #FIXED ÒarcÓ
xlink:type (locator) #FIXED ÒlocatorÓ xlink:from IDREF #REQUIRED
id ID #REQUIRED xlink:to IDREF #REQUIRED
xlink:href CDATA #REQUIRED xlink:show (new|parsed|replace)
xlink:role CDATA #IMPLIED ÒreplacedÓ
xlink:title CDATA #IMPLIED > xlink:actuate (user|auto) ÒuserÓ >
49

Extended Link (Example)


Descrorg.xml
<xlink:extended
showdefault=ÒreplaceÓ
actuatedefault=ÒuserÓ>
<xlink:locator id=Òinst1Ó
Instance: Organiser
href=Òhttp://www.uml.com/Descrmorg.htm/
title=ÒMeeting OrganiserÓ >
<xlink:locator id=Òinst2Ó This is an instance of the collaboration
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Ó />
<xlink:arc from=Òinst1Ó
Instance: Meeting Descrmeet.xml
to=Òinst2Ó show=ÒnewÓ/>
Organiser
</xlink:extended>
...

Instance: Meeting
... 50

2
Extended Link Group
<!ELEMENT xlink:group (xlink:document*)>
<!ATTLIST xlink:group
steps CDATA #IMPLIED>

<!ELEMENT xlink:document EMPTY>


<!ATTLIST xlink:document
href CDATA #REQUIRED>

Hub
Document

51

Extended Link Group (Example)


descr1.xml
<xlink:group
step = 1 > descr2.
xml
<xlink:document
href=Òhttp://www.uml.com/descr2.xmlÓ/>
<xlink:document
href=Òhttp://www.uml.com/descr3.xmlÓ/> descr3.
<xlink:document xml
href=Òhttp://www.uml.com/descr4.xmlÓ/>

</xlink:group>
descr4.
xml

52

2
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)

- Based on XPath - XML Path Language


(W3C working draft - http://www.w3.org/1999/07/WD-xpath-19990709)

basis
LocationPath: axis-name :: node-test[predicate]*
(/ axis-name :: node-test[predicate]*)*

54

2
XPointer (Location Path - Cont.)
Absolute axes: Relative axes:

a) root( ) - / a) ancestor
b) origin( ) b) ancestor-or-self
c) id( ) c) attribute
d) here( ) d) child
e) unique( ) e) descendant
f) descendant-or-self
g) following
h) following-sibling
i) parent
j) preceding
k) preceding-sibling
l) self
55

XPointer (Location Path - Cont.)


Node Tests: Predicates:

a) * a) position ( ) = integer
b) node( ) (<, >, !=, >=, <=)
c) text( ) b) position( ) = last( )
d) comment( ) c) Count(Location Path)
e) processing-instruction( ) d) attribute::attr_name

56

2
Examples
<?xml version=Ò1.0Ó?>
<!DOCTYPE Model SYSTEM ÒUML.dtdÓ>

<Model> root( )
<TaggedValue>
<Tag>Title<Value>Create Meeting Collaboration Diagram
</Value></Tag>
<Tag>Author<Value>Peter John</Value></Tag>
</TaggedValue> child::TaggedValue/child::Tag[positi
<Package NAME=ÒCreate MeetingÓ>
<CollaborationDiagram> on( )=2]/child::Value[position( )=1]
<Collaboration NAME=ÒCreate MeetingÓ>
<Instance CLASS=ÒMeeting OrganiserÓ />
<Instance CLASS=ÒOrganiser WindowÓ />
<Instance CLASS=ÒOrganiserÓ />
<Instance CLASS=ÒMeetingÓ /> descendant::Instance[position( )=3]
<Instance CLASS=ÒDateÓ />
<Message TYPE=ÒsyncÓ
SENDER=ÒMeeting OrganiserÓ
RECEIVER=ÒOrganiser WindowÓ>
<Label SEQUENCE_EX=Ò1Ó descendant::Message[attribute::
MESSAGE_NAME=Òselect create me etingÓ/> SENDER=ÒMeeting OrganiserÓ]
</Meesage>
...
</Collaboration>
</CollaborationDiagram> origin( )/parent::*
</Package>
</Model>
57

XPointer (Cont.)
Axes:

a) range :: LocationPath , LocationPath

ex.: range::/descendant::Instance[position( )=1],


/descendant::Instance[position( )=last( )]

b) string :: 2,ÒMeeting OrganiserÓ, 5

(selects the position before the letter ÒiÓ in the second occurrence of
the string ÒMeeting OrganiserÓ)

58

2
Goals of XPointer

¥ Be usable over the Internet


¥ Address into XML documents
¥ Be usable in URIs
¥ Be feasible to implement
¥ Be optimized for usability
¥ Be human-readable and reasonably compact
¥ Be designed quickly
¥ Be prepared quickly
¥ Have a formal and concise design
59

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 a) root( );
Diagram</Value></Tag> b) origin( )/child::Package/
<Tag>Date<Value>10/09/99</Value></Tag> child::ClassDiagram/
</TaggedValue>
child::Class[position()=1]/
<Package NAME=ÒBusinessEntitiesÓ>
<ClassDiagram>
child::Attribute[position()=2);
<Class NAME=ÒMeetingÓ> c) id(Òattribute7Ó);
<Attribute NAME="status" d) origin( )/parent::*;
ID="attribute6" e) range::/descendant::Attribute
TYPE="String"> </Attribute> [position( )=1],/descendant::
<Attribute NAME="name" Attribute[position( )=2];
ID="attribute7" f) /descendant::Value[position( )=2];
TYPE="String"> </Attribute>
</Class></ClassDiagram> </Package></Model>

60

3
Solution

<Model>
<TaggedValue>
<Tag>Title<Value>Business Entities Class
Diagram</Value></Tag> a) root( );
<Tag>Date<Value>10/09/99</Value></Tag> b) origin( )/child::Package/
</TaggedValue> child::ClassDiagram/
<Package NAME=ÒBusinessEntitiesÓ> child::Class[position()=1]/
<ClassDiagram> child::Attribute[position()=2);
<Class NAME=ÒMeetingÓ> c) id(Òattribute7Ó);
<Attribute NAME="status"
d) origin( )/parent::*;
ID="attribute6"
TYPE="String"> </Attribute>
e) range::/descendant::Attribute
<Attribute NAME="name" [position( )=1],/descendant::
ID="attribute7" Attribute[position( )=2];
TYPE="String"> </Attribute> f) /descendant::Value[position()=2];
</Class></ClassDiagram> </Package></Model>

61

XSL
XSL - eXtensible Style Language Development Timeline
W3C XSL
Working Draft
Based on ISO/IEC 10179 Document
Style Semantics and Specification W3C XSL
Version 1.0
Language (DSSSL)
W3C XSL
Proposal
Based on W3CÕs Cascading Style
Sheet (CSS) Language 1997 1998 1999
. Aug Aug Apr

¥ XSL is a language for expressing stylesheets;

¥ XSL allows authors to transform the structure of an XML source tree


into an XML result tree (XSLT);

¥ XSL allows authors to apply formatting and presentation operations to


62
XML elements (formatting objects vocabulary);

3
XSL Processor

XSL
XML Stylesheet
Processor

Presentation
Document
Tree Formatter
Transform. Form.
XSL XSLT Objects
stylesheet

63

XSL (Cont)

Source Tree XSL Result Tree


(XML) Stylesheet

Rule
Pattern

Template

XML Document Construction rules Presentation


Tree Document Tree
64

3
XSL (Cont.)
Tree Construction Rules (Template Rules)

¥ Pattern: identifies the element from the XML source document


tree to which the construction rule applies
(<xsl:template>).

¥ Template: it is instantiated to create the result tree.

¥ Formatting Objects: the typographic units from which a


presentation is constructed.
65

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Ó
<fo:block font-size=Ò18ptÓ color=ÒgreenÓ> xmlns:fo=Òhttp://ÉFormat/1.0Ó>Author Peter
<xsl:apply-templates/> John</fo:block>
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

3
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 (HTML)


<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Ó>
<xsl:apply-templates/> Author Peter John </DIV>
</DIV> <DIV sty le=Òcolor:redÓ>
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:
<xsl:stylesheet
<ClassDiagram><Class>Meeting xmlns:xsl=Òhttp://www.w3.org/XSL/Transform/1.0Ó>
<Attribute>status</Attribute> <xsl:template match=ÒClassDiagramÓ>
<Attribute>name</Attribute> <DIV style=Òfont-weight:bold; color:blueÓ>
<Method>add</Method> <xsl:apply-templates select=ÒMethodÓ/>
<Method>remove</Method> </DIV>
</Class></ClassDiagram> </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

3
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> <Message TYPE=ÒsyncÓ


<Tag>Title<Value>Create Meeting SENDER=ÒMeeting OrganiserÓ
Collaboration Diagram</Value></Tag> RECEIVER=ÒOrganiser WindowÓ>
<Tag>Author<Value>Peter John</Value> <Label SEQUENCE_EX=Ò1Ó
<Model> </Tag> MESSAGE_NAME=Òselect create meetingÓ />
</TaggedValue> </Message>
<CollaborationDiagram> ...
<Collaboration NAME=ÒCreate MeetingÓ> </Collaboration>
<Instance>Meeting Organiser</Instance> </CollaborationDiagram>
<Instance>Organiser Window</Instance> </Package>
<Instance>Organiser</Instance> </Model>
<Instance>Meeting</Instance>
<Instance>Date</Instance>
69

Solution
a)
<xsl:template match=ÒTaggedValueÓ>
<DIV style=Òfont-weight:bold; color:redÓ>
<xsl:apply-templates/>
</DIV>
</xsl:template>

b) d)
<xsl:template match=ÒInstanceÓ> <xsl:template match=ÒMessageÓ>
<xsl:apply-templates select=ÒInstanceÓ> <DIV style=Òcolor:yellowÓ>
<xsl:sort select=ÒInstanceÓ/> <xsl:apply-templates select=ÒLabelÓ>
< /xsl:apply-templates> </DIV>
</xsl:template> </xsl:template>

c)
<xsl:template match=ÒMessageÓ>
<DIV style=Òfont-size:20pt; color:greenÓ>
<xsl:apply-templates/>
</DIV>
</xsl:template> 70

3
Document Object Model (DOM)
¥ DOM is an application programming interface (API) for
documents, i.e. HTML and XML documents.

¥ DOM is a way to describe an XML document to another


application or programming language in an effort to manipulate
the information the way it is wanted.

¥ DOM defines the logical structure of documents and the way a


document is accessed and manipulated.

¥ DOM allows programmers to build documents, navigate their


structures, and add, modify, or delete elements and contents.

71

DOM (Cont.)
DOM Level2 Development Timeline
W3C Working Draft
DOM Level1
W3C Recommen.

Oct Mar & Jul


1998 1999
DOM identifies:

. (a) the interfaces and objects used to represent and manipulate


a document;

(b) the semantics of these interfaces and objects (behavior and


attributes);

(c) the relationships and collaborations among these interfaces


72
and objects.

3
DOM (Cont.)

DOM representation (logical structure)


Model

<Model> CollaborationDiagram
<CollaborationDiagram>
<Instance>
Parser
<Name>Org aniser</Name> Instance Instance
<Message>Sent</Message>
</Instance>
Name Message Name Message
<Instance>
<Name>Meeting </Name>
<Message>Receive</Messag e>
</Instance> Sent Meeting Receiver
Organiser
</CollaborationDiagram>
</Model>
DOM Objects

The nodes in the tree represent objects and not data structure.
73

DOM (Cont.)
¥ Level 1: Methods to represent and manipulate document
structure and content.

> Core: interfaces for accessing and manipulating XML contents

> XML: interfaces for accessing and manipulating XML DTDs

> HTML: interfaces for accessing and manipulating HTML


contents

74

3
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
It is a collection of names, identified
Recommend. by a URI, which are used in XML
W3C documents for qualifying names used
Working Draft as element types and attribute names.

Sept Jan
1998 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

3
Namespace (Cont.)
Declaring and Using Namespaces:

<?xml version=Ò1.0Ó?>
<uml:diagram xmlns:uml=Ôhttp://uml.orgÕ>
<uml:class_diagram>This is a universally unique element
</uml:class_diagram>
</uml:diagram>

<?xml version=Ò1.0Ó?>
<uml:diagram xmlns:uml=Ôhttp://uml.orgÕ
xmlns:web=Ôhttp://web.orgÕ>
<uml:class_diagram
web:address=Òwww.classdiagram.com />
</uml:diagram>
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

Schemas describe the rules of an


XML document, such as element XML-Data
W3C Note
names, elements ordering, available
attributes. Jan
78
1998

3
XML-Data (Example)
UML.xml

<?xml version=Ò1.0Ó?>
<?xml:namespace name=Òhttp://data.org/Ó
UML.dtd as=ÒdtÓ/?>
<!ELEMENT Model (Package+)>
<dt:schema>
<!ELEMENT Package (#PCDATA)>
<elementType id=ÒPackageÓ>
<string/>
</elementType>
<elementType id=ÒModelÓ>
UML.xml <element type=Ò#PackageÓ
occurs=ÒONEORMOREÓ/>
<?xml version=Ò1.0Ó?> </elementType>
<!DOCTYPE Model SYSTEM UML.dtd> </dt:schema>
<Model>
<Package>Collaboration Diagram</Package> <Model>
<Package>Class Diagram</Package> <Package>Collaboration Diagram</Package>
<Package>StateChart Diagram</Packag e> <Package>Class Diagram</Package>
</Model> <Package>StateChart Diagram</Package>
</Model>
79

XML-QL
Development Timeline
Who?
XML-QL W3C AT&T Labs
Working Draft
University of Pensilvania

1998
Aug

¥ How can data be extracted from large XML documents?


¥ How can XML data be exchanged between user communities
using different ontologies?
¥ How can XML data from multiple sources be integrated?

Data extraction
Data transformation XML-QL
Data integration 80

4
XML-QL (Cont.)

¥ XML-QL can express queries which can extract pieces of data


from XML documents.

¥ XML-QL can express transformations


. which can map XML
data between DTDs and can integrate XML data from different
sources.

¥ XML-QL supports joins and aggregates.

81

XML-QL (Examples)
<!ELEMENT book (author+, title, publisher)>
<!ATTLIST book year CDATA>
<result>
<!ELEMENT article (author+, title, year?,
<author><lastname>Date</lastname></author>
(short|long))>
<title>An Introduction to DB Syst</title>
<!ATTLIST article type CDATA)> WHERE <book>
<!ELEMENT publisher</result>
(name, address)> <publisher> <name>ÓAddison-WesleyÓ
<result>
<!ELEMENT author (firstname?, lastname)> </name></publisher>
<author><lastname>Date</lastname></author>
<title> $t </title>
<bib> <title>Foundation for Object/Relational
<author> Dbs: The
$a </author>
<book year=Ò1995Ó> Third Manifesto</title> </book> in Òbib.xmlÓ
<title>An Introduction to DB Syst</title>
</result> . CONSTRUCT <result> <author> $a </>
<author> <lastname>Date</lastname></author> <title> $t </> </result>
<result>
<publisher><name>Addison-Wesley</name>
<author><lastname>Darwen</lastname></author>
</publisher></book>
<book year=Ò1998Ó> <title>Foundation for Object/Relational Dbs:The
Third Manifesto</title>
<title>Foundation for Object/Relational Dbs:
</result>
The Third Manifesto</title>
<author><lastname>Date</lastname></author>
<author><lastname>Darwen</lastanme></author>
<publisher><name>Addison-Wesley</name>
</publisher>
</book> </bib> 82

4
XML-QL (Examples)
<!ELEMENT book (author+, title, publisher)> <!ELEMENT person (lastname, firstname, address?,
<!ATTLIST book year CDATA> phone?, publicationtitle*)
<!ELEMENT article (author+, title, year?,
(short|long))>
<!ATTLIST article type CDATA)>
<!ELEMENT publisher (name, address)>
<!ELEMENT author (firstname?, lastname)>

Transforming XML Data

WHERE <$> <author><firstname> $fn</>


<lastname> $ln</></>
<title> $t </>
</> in Òbib.xmlÓ
CONSTRUCT <person ID=PersonID($fn,$ln)>
<firstname> $fn</>
<lastname> $ln</>
<publicationtitle> $t</>
</person>

83

Software Engineering Applications


¥ Structured information on the Web (repositories)

¥ Information interchange

¥ Consistency Management

¥ Generation of specialised mark-up languages

¥ Document templates

¥ Multiple document views & Graphical views

¥ Validation of semi-structured documents


84

4
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 XML

Documents Translated
Documents
Translated
86

4
Generation of Specialised Mark-up Lgs.

- Mark-up language for UML Model (XMI, UXF);

- Mark-up language for Z specification (ZIF);

- Mark-up language for Data Flow Diagrams;

- Mark-up language for other design methods;

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

4
Multiple Document Views

XSL

Document XSL

XSL

89

Graphical View

UML
Model IE 5

Unisys
exporter

XMI BOX VML Netscape

90

4
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

4
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

You might also like