-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathreadme.html
181 lines (173 loc) · 10.7 KB
/
readme.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Christina Lau, Gerhard Schwärzler">
<meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]">
<title>readme</title>
<style type="text/css">
td, p {
font-family: Arial;
font-size: 80%;
}
h3 {
font-family: Arial;
font-size: 120%;
font-weight: normal;
}
</style>
</head>
<body bgcolor="#FFFFFF">
<center>
<h2>
<font face="Arial"><font color="#6633CC">Editing and Validating XML Document
Example Readme</font></font></h2></center>
<font face="Arial"><font size=-1>
<p>This is a collection of examples that
illustrate how you can use some of the guided editing features in the XML
Editor to edit and validate XML files.</p>
<p>I have extended the collection for my lecture "Datamanagment with XML" held at FH Vorarlberg.
Additionally, example "CarRental" illustrates XSLT processing. - Dr. Gerhard Schwärzler</p>
</font></font><br>
<center><table BORDER >
<tr>
<td ALIGN=CENTER WIDTH="93" BGCOLOR="#CCCCCC"><b><font face="Arial"><font color="#003399"><font size=-1>Example</font></font></font></b></td>
<td ALIGN=CENTER BGCOLOR="#CCCCCC" width="552"><b><font face="Arial"><font color="#003399"><font size=-1>Description</font></font></font></b></td>
</tr>
<TR>
<TD width="93" height="33"><FONT face="Arial"><FONT face="Arial"><FONT
face="Arial"><FONT size="-1"><A href="#Invoice">Invoice</A></FONT></FONT></FONT></FONT></TD>
<TD height="33" width="552"><FONT face="Arial"><FONT face="Arial"><FONT
face="Arial"><FONT size="-1">Shows how a DTD file (Invoice.dtd) can
be used to provide editing assistance when editing an XML file
(Invoice.xml).</FONT></FONT></FONT></FONT><BR>
</TD>
</TR>
<TR>
<TD width="93" height="33"><FONT face="Arial"><FONT face="Arial"><FONT
size="-1"><A href="#Invoice"></A></FONT></FONT><FONT size="-1"><A
href="#Invoice"></A></FONT><FONT face="Arial"><FONT size="-1"><A
href="anyElement/readme.html#any"></A></FONT></FONT><FONT size="-1"><A
href="#substitutionGroup">PublicationCatalogue</A></FONT></FONT></TD>
<TD height="33" width="552"><FONT face="Arial"><FONT face="Arial"><FONT
size="-1"></FONT></FONT><FONT size="-1"></FONT><FONT face="Arial"><FONT
size="-1">This example shows how to define <U>substitutionGroup</U>
in an XML schema file and then use the substitution in the XML
instance document.</FONT></FONT></FONT><BR>
</TD>
</TR>
<TR>
<TD width="93" height="33"><FONT face="Arial"><FONT face="Arial"><FONT
face="Arial"><FONT size="-1"><A href="#GolfCountryClub">GolfCountryClub</A></FONT></FONT></FONT></FONT></TD>
<TD height="33" width="552"><FONT face="Arial"><FONT face="Arial"><FONT
face="Arial"><FONT size="-1">This example defines an XML schema of a Golf Country Club. It demonstrates
the use of enumerations, local types, choices, and extensions to extend complex types (inheritance).
</FONT></FONT></FONT></FONT><BR>
</TD>
</TR>
<tr>
<td><a href="#addressbook">Addressbook</a></td>
<td>Shows how a DTD (addresses.dtd) is used to validate a XML document (addresses.xml). </td>
</tr>
</table></center>
<p>
<hr WIDTH="100%">
<p><a NAME="Invoice"></a><font face="Arial,Helvetica"><font color="#000000"><font size=+1>Editing
Invoice.xml</font></font></font>
<p><font face="Arial,Helvetica"><font color="#000000"><font size=-1>The
Invoice.dtd file provides the rules for defining the content of the Invoice.xml
file. It is associated with the Invoice.xml through the <b>DOCTYPE</b>
declaration.</font></font></font>
<p><b><font face="Arial,Helvetica"><font color="#6633CC"><font size=-1>Sequence
content model</font></font></font></b>
<p><font size=-1><font face="Arial">The </font><b><font face="Arial,Helvetica">Invoice</font></b><font face="Arial">
element has a content model that looks like this:</font></font>
<br><font size=-1><font face="Arial"> </font><font face="Courier New,Courier"><ELEMENT
Invoice (Header, Items+)></font></font>
<br><font size=-1><font face="Arial">This means that an </font><b><font face="Arial,Helvetica">Invoice</font></b><font face="Arial">
element can have one </font><b><font face="Arial,Helvetica">Header</font></b><font face="Arial">
element followed by multiple </font><b><font face="Arial,Helvetica">Items</font></b><font face="Arial">.</font></font>
<p><font size=-1><font face="Arial">In the Design View of the XML Editor,
select the </font><b><font face="Arial,Helvetica">Invoice</font></b><font face="Arial">
element. From the pop-up menu, select </font><b><font face="Arial,Helvetica">Add
Child -> Item</font></b><font face="Arial"> to add an </font><b><font face="Arial,Helvetica">Item</font></b><font face="Arial">
to the </font><b><font face="Arial,Helvetica">Invoice</font></b><font face="Arial">
element. You can repeat this to add as many </font><b><font face="Arial,Helvetica">Items</font></b><font face="Arial">
to the </font><b><font face="Arial,Helvetica">Invoice</font></b><font face="Arial">element
as you like.</font></font>
<p><b><font face="Arial,Helvetica"><font color="#6633CC"><font size=-1>Choice
content model</font></font></font></b>
<p><font size=-1><font face="Arial">The </font><b><font face="Arial,Helvetica">Date</font></b><font face="Arial">
element has a content model that looks like this:</font></font>
<br><font size=-1><font face="Arial"> </font><font face="Courier New,Courier"><ELEMENT
Date ((Month, Day, Year) | (Day, Month, Year))></font></font>
<br><font size=-1><font face="Arial">This means that a </font><b><font face="Arial,Helvetica">Date</font></b><font face="Arial">
can be of the format </font><b><font face="Arial,Helvetica">Month</font></b><font face="Arial">,
followed by </font><b><font face="Arial,Helvetica">Day</font></b><font face="Arial">,
followed by </font><b><font face="Arial,Helvetica">Year</font></b><font face="Arial">,
or of the format </font><b><font face="Arial,Helvetica">Day</font></b><font face="Arial">,
followed by </font><b><font face="Arial,Helvetica">Month</font></b><font face="Arial">,
followed by </font><b><font face="Arial,Helvetica">Year</font></b><font face="Arial">.</font></font>
<p><font size=-1><font face="Arial">You can toggle between these two groups
easily in the Design View of the XML Editor: First multiple select the
</font><b><font face="Arial,Helvetica">Month</font></b><font face="Arial">,
</font><b><font face="Arial,Helvetica">Day</font></b><font face="Arial">,
and
</font><b><font face="Arial,Helvetica">Year</font></b><font face="Arial">
elements (Hold down the Ctrl key while you select them). Then from the
pop-up menu, choose </font><b><font face="Arial,Helvetica">Replace With
-> (Day, Month, Year)</font></b><font face="Arial"> to replace it with
the second group.</font></font>
<p><b><font face="Arial,Helvetica"><font color="#6633CC"><font size=-1>Enumerated
attribute type</font></font></font></b>
<p><font size=-1><font face="Arial">The <b>Item</b> element has an attribute
</font><b><font face="Arial,Helvetica">discount</font></b><font face="Arial">
whose value can be set to either </font><b><font face="Arial,Helvetica">promotion</font></b><font face="Arial">
or </font><b><font face="Arial,Helvetica">regular</font></b><font face="Arial">.
In the Design View of the XML Editor, select the </font><b><font face="Arial,Helvetica">discount</font></b><font face="Arial">
attribute. A combo-box will appear where you can choose between the two
values. Alternatively, in the Source View, select content assist for the
</font><b><font face="Arial,Helvetica">discount</font></b><font face="Arial">
attribute to choose between the two values.</font></font>
<p>
<hr WIDTH="100%"><br><a NAME="substitutionGroup"></a><font face="Arial,Helvetica"><font color="#000000"><font size=+1>Using
Substitution Groups</font></font></font>
<p>XML Schema allows named groups of elements to be substituted for other
elements. The Catalogue.xsd file declares <b>Book</b> and <b>Magazine</b>
to be in a substitution group with <b>Publication</b>:
<pre> <element name="Book" type="Catalogue:BookType" substitutionGroup="Catalogue:Publication"/>
<element name="Magazine" type="Catalogue:MagazineType" substitutionGroup="Catalogue:Publication"/></pre>
The content of <b>Catalogue</b> can be any element that is in the substitution
group. In the Design View of the XML Editor, select the Add Child menu
on the <b>Catalogue</b> element. Notice how both <b>Book</b> and <b>Magazine</b>
can be substituted as the content of the <b>Publication</b> element. In
additon, we have declared the <b>Publication</b> element as <i>abstract</i>,
to prevent the <b>Publication</b> element to be used directly in the instance
document..
<br>
<BR>
<hr WIDTH="100%"><br><a NAME="GolfCountryClub"></a><font face="Arial,Helvetica"><font color="#000000"><font size=+1>
XML Schema - Golf Country Club Example</font></font></font>
<p>
<p><b><font face="Arial,Helvetica"><font color="#6633CC"><font size=-1>Inheritance</font></font></font></b>
<p>The GolfCountryClub.xsd defines various types that extend content from other complex types. In particular,
look at the various member types and <b>EmployeeType</b>, and they all extend <b>PersonType</b>.
<p><b><font face="Arial,Helvetica"><font color="#6633CC"><font size=-1>Enumerations</font></font></font></b>
<p>You can restrict the values allowed for an element in the instance document by defining enumerations in the schema.
For example, look at the simple type <b>ClubKindType</b> in the schema. Then, look at ClubKind element in the instance
document, GolfCountryClub.xml, using the XML Editor.
<p><b><font face="Arial,Helvetica"><font color="#6633CC"><font size=-1>Choices</font></font></font></b>
<p>Similar to the Invoice example, you can choose a different content model for a particular element. In the golf
country club example, a Member can be restricted, regular or exclusive.
<br>
<hr WIDTH="100%">
<h3 id="addressbook">Validating against a DTD - Addressbook Example</h3>
<p>The DOCTYPE declaration in addresses.xml associates the DTD file "addresses.dtd" with this XML document.
The XML-editor of eclipse will now assist you when editing the document. Furthermore, with context-menu "Validate" your
XML document will be parsed and validated against the DTD. Validation errors are marked as usual. The error messages can
be found under the "Problems" tab, or are displayed as tooltip over the red error-mark in the scrollbar on the right.
</p>
<HR width="100%">
<P></P>
</body>
</html>