tutorial
101 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
101 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

Andreas WombacherLehrstuhl für DienstleistungsinformatikOtto-Hahn-Str. 14, Dortmund http://ls5-www.cs.uni-dortmund.de0††„††„‹†††„‹‹XML Syntax: Ebenenwohlgeformt (well-formedness)Ein Dokument besitzt geordnete syntaktische EigenschaftenZum Beispiel:Klammerung: für jedes Starttag muß ein Endetag existieren.Eindeutige Wurzel: jedes Dokument hat genau ein Wurzel-ElementEindeutige Attribute: jedes Attribut tritt pro Element höchstens einmal auf.gültig (valid)Ein Dokument ist wohlgeformt und folgt einem a priori gegebenen SchemaFormalisiert in einer Dokumenttypdefinition (DTD, XML Schema)Erweiterte Konstruktionen verfügbarphysikalischtransparent zur logischen EbeneFormalisiert in Entitäten (Makros…)1XML Parsing - SchematischExternalDB/Files...DokumentDocGeneralWellformedEntity Doc’CheckExpansionElementGEnt. TreeTokenization(Metasyntax)schema...ParameterValidEntity schema‘CheckInstantiatedExpansionSchemaPEnt.ExternalDB/Files2„„„„„„„Dokumente: Tag und ElementeTags begrenzen ElementeHierarchisch oberstes Element derheißt DokumentelementeigentlicheInhaltNamen für Tags sind [letter][letter0-9.:-_]* Tags sind "case-sensitive"Noch mehr Inhalt,Jedes geöffnete Tag mußebenfalls PCDATAwieder geschlossen werdenTags dürfen nicht überlappenLeere Tags haben besondere Syntax3Beispiel Hamlet: Dokumentinstanz

Informations

Publié par
Nombre de lectures 14
Langue English

Extrait

Andreas Wombacher
Lehrstuhl für Dienstleistungsinformatik
Otto-Hahn-Str. 14, Dortmund
http://ls5-www.cs.uni-dortmund.de
0†












XML Syntax: Ebenen
wohlgeformt (well-formedness)
Ein Dokument besitzt geordnete syntaktische Eigenschaften
Zum Beispiel:
Klammerung: für jedes Starttag <T> muß ein Endetag </T> existieren.
Eindeutige Wurzel: jedes Dokument hat genau ein Wurzel-Element
Eindeutige Attribute: jedes Attribut tritt pro Element höchstens einmal auf.
gültig (valid)
Ein Dokument ist wohlgeformt und folgt einem a priori gegebenen Schema
Formalisiert in einer Dokumenttypdefinition (DTD, XML Schema)
Erweiterte Konstruktionen verfügbar
physikalisch
transparent zur logischen Ebene
Formalisiert in Entitäten (Makros…)
1XML Parsing - Schematisch
External
DB/Files
...
Dokument
Doc
General
Wellformed
Entity Doc’
Check
Expansion
Element
GEnt. Tree
Tokenization
(Metasyntax)
schema
...
Parameter
Valid
Entity schema‘
Check
Instantiated
Expansion
Schema
PEnt.
External
DB/Files
2„






Dokumente: Tag und Elemente
Tags begrenzen Elemente
<erstes>
<zweites>
Hierarchisch oberstes Element
der
heißt Dokumentelement
eigentliche
Inhalt
Namen für Tags sind
</zweites>
[letter][letter0-9.:-_]*
<drittes>
Tags sind "case-sensitive"
<leer/>
Noch mehr Inhalt,
Jedes geöffnete Tag muß
ebenfalls PCDATA
wieder geschlossen werden
</drittes>
</erstes>
Tags dürfen nicht überlappen
Leere Tags haben besondere
Syntax
3Beispiel Hamlet: Dokumentinstanz
<?xml version="1.0"? encoding="ISO-8859-1"?>
<play>
<title>The Tragedy of Hamlet, Prince of Denmark</title>
<fm> <p>SGML markup by Jon Bosak, 1992-1994.</p>
<p>XML version by Jon Bosak, 1996-1997.</p>
<p>This work may be freely copied and distributed worldwide.</p>
</fm>
<personae>
<title>Dramatis Personae</title>
<persona>CLAUDIUS, king of Denmark. </persona>
<persona>HAMLET, son to the late, and nephew to the present king.
</persona>
</personae>
<scndescr>SCENE Denmark.</scndescr>
<playsubt>HAMLET</playsubt>
<act> <title>ACT I</title>
<scene>
<title>SCENE I. Elsinore. A platform before the castle.</title>
<stagedir>FRANCISCO at his post. Enter to him BERNARDO</stagedir>
<speech><speaker>BERNARDO</speaker>
<line>Who's there?</line></speech>
...
4Beispiel Hamlet: Elementbaum
Dokument
Element
play
"act" ist enthalten in "play"...
Element
title fm
personae scenedescr playsubt act
hamlet
The Tragedy of
title
Hamlet,
acttitle scene
Prince of Denmark
Scene Denmark
Pfad
Dramatis
Act I
scenetitle
Persona
persona persona
p . . . p
Scene I stagedir speech
...
FRANCISCO speaker line
SGML markup ...
CLAUDIUS HAMLET
...
...
worldwide
Who's
BERNARDO
there ?
5„


XML Schema Example
Schema are good for data type descriptions
For example, if you want to have the data
<age> 45 </age>
<height> 5.9 </height>
<color> blue </color>
then you would describe the data type using the schema
<element name="age" type="positiveInteger"/>
<element name="height" type="float"/>
<element name="color">
<simpleType base="xsd:string">
<enumeration value="green">
<enumeration value="blue">
</simpleType>
</element>
6„


Komplexe Typen: Sequenz
<xsd:complexType name="Address">
<xsd:element name="name" type="xsd:string"/> name="street" type="xsd:string"/> name="city" type="xsd:string"/> name="state"
<xsd:element name="zip" type="xsd:decimal"/>
<xsd:attribute name="country" type="xsd:NMTOKEN"
use="fixed" value="US"/>
</xsd:complexType>
xsd:complexType: xsd – XML Schema Namespace
<xsd:schema xmlns:xsd=“http://www.w3.org/1999/XMLSchema“>
Schema-Attribut: name
xsd:element
Schema-Attribute: name, type
xsd:attribute
Schema-Attribute: name, type, use, value
7„

Einfache Typen (Simple Types)
Built-In Types: e.g. xsd:decimal, xsd:string, xsd:date
<xsd:element name="state" type="xsd:string"/> name="zip" type="xsd:decimal"/>
Built-In Types mit festem oder Default-Wert
<xsd:attribute name="country" type="xsd:NMTOKEN"
use="fixed" value="US"/>
<xsd:element
fixed="US"/>
<xsd:attribute name="country"
use="default" value="US"/>
89

  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents