diff --git a/Sda1/sda1.xml b/Sda1/sda1.xml index 46e64ac9722e281446abf390fffb0a1a0b5af7f2..0e5cbbbd8495fe1382bc9f6f35586962d16d8c29 100644 --- a/Sda1/sda1.xml +++ b/Sda1/sda1.xml @@ -3641,12 +3641,13 @@ INSERT INTO Customer (id, name) VALUES ('eve', 'Eve intruder')</computeroutput>< <itemizedlist> <listitem> - <para>Some elements being central for a DTD may appear at - different places. For example a <tag class="starttag">title</tag> - element is likely to appear as a child of chapters, sections, - tables figures and so on. It may be sufficient to define a single - template with a <code>match="title"</code> attribute which - contains all rules being required.</para> + <para>Some elements may appear at different places of a given + document hierarchy. For example a <tag + class="starttag">title</tag> element is likely to appear as a + child of chapters, sections, tables figures and so on. It may be + sufficient to define a single template with a + <code>match="title"</code> attribute which contains all rules + being required.</para> </listitem> <listitem> @@ -4377,17 +4378,25 @@ you need some </emphasis><em>time</em><emphasis role="bold">.</empha <para>The <abbrev xlink:href="http://www.w3.org/TR/xpath">XPath</abbrev> expression <code>select="text()|emphasis|url"</code> corresponds - nicely to the content model definition in the DTD:</para> - - <programlisting language="none"><!ELEMENT content (#PCDATA|emphasis|url)*></programlisting> + nicely to the schema's content model definition:</para> + + <programlisting language="none"><xs:element name="content"> + <xs:complexType <emphasis role="bold">mixed="true"</emphasis>> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:element <emphasis role="bold">ref="emphasis"</emphasis>/> + <xs:element <emphasis role="bold">ref="url"</emphasis>/> + </xs:choice> + ... + </xs:complexType> +</xs:element></programlisting> </listitem> <listitem> <para>In most mixed content models <emphasis>all</emphasis> sub elements of e.g. <tag class="starttag" role="">content</tag> have to be formatted. During development some of the elements - defined in a DTD are likely to be omitted by accidence. For this - reason the <quote>typical</quote> <abbrev + defined in a schema are likely to be omitted by accidence. For + this reason the <quote>typical</quote> <abbrev xlink:href="http://www.w3.org/TR/xpath">XPath</abbrev> expression acting on mixed content models is defined to match <emphasis>any</emphasis> sub element nodes:</para> @@ -4555,10 +4564,11 @@ you need some </emphasis><em>time</em><emphasis role="bold">.</empha <qandaentry> <question> <para>In <xref linkend="example_book.dtd_v5"/> we - constructed a DTD allowing itemized lists an mixed content - for <tag class="starttag">book</tag> instances. This DTD - also allowed to define <tag class="starttag">emphasis</tag>, - <tag class="starttag">table</tag> and <tag + constructed a schema allowing itemized lists and mixed + content for <tag class="starttag">book</tag> instances. This + schema also allowed to define <tag + class="starttag">emphasis</tag>, <tag + class="starttag">table</tag> and <tag class="starttag">link</tag> elements being part of a mixed content definition. Extend the current book2html.xsl to account for these extensions.</para> @@ -4773,11 +4783,11 @@ you need some </emphasis><em>time</em><emphasis role="bold">.</empha <para>The call to <code>id(@linkend)</code> returns either a <tag class="starttag">chapter</tag> or a <tag - class="starttag">para</tag> node since according to the DTD - attributes of type <code>ID</code> are only defined for - these two elements. Using this node as input to - <code>generate-id()</code> returns the desired identity - value for the generated Xhtml.</para> + class="starttag">para</tag> node since attributes of type + <code>ID</code> are only defined for these two elements. + Using this node as input to <code>generate-id()</code> + returns the desired identity value to be used in the + generated Xhtml.</para> </answer> </qandaentry> </qandadiv> @@ -4790,8 +4800,8 @@ you need some </emphasis><em>time</em><emphasis role="bold">.</empha <para>XSL allows us to traverse a document instance's graph in different directions. We start with a memo document instance:</para> - <programlisting language="none"><!DOCTYPE memo SYSTEM "memo.dtd"> -<memo date="9.9.2099"> + <programlisting language="none"><memo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="memo.xsd" date="9.9.2099"> <from>Joe</from> <to>Jack</to> <to>Eve</to> @@ -5677,7 +5687,7 @@ Closing Document <listitem> <para>The parser will not validate a document instance against a - DTD being present.</para> + schema being present.</para> </listitem> </itemizedlist> @@ -6189,29 +6199,39 @@ public class MemoViewHandler extends DefaultHandler { <figure xml:id="saxNotValid"> <title>An invalid XML document.</title> - <programlisting language="none"><?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE catalog [ - <!ELEMENT catalog (item) > - <!ELEMENT item (#PCDATA) > -<!ATTLIST item orderNo NMTOKEN #REQUIRED > -]> -<catalog> + <programlisting language="none"><xs:element name="catalog"> + <xs:complexType> + <xs:sequence> + <xs:element ref="item"/> + </xs:sequence> + </xs:complexType> +</xs:element> + +<xs:element name="item"> + <xs:complexType mixed="true"> + <xs:attribute name="orderNo" type="xs:int" use="required"/> + </xs:complexType> +</xs:element></programlisting> + + <programlisting language="none"><catalog> <item orderNo="3218">Swinging headset</item> - <item orderNo="9921">200W Stereo Amplifier</item> + <item orderNo="9921">200W Stereo Amplifier</item> <emphasis + role="bold"><!-- second entry forbidden by schema --></emphasis> </catalog></programlisting> <caption> <para>In contrast to <xref linkend="saxMissItem"/> this document is well formed. But it is not <emphasis - role="bold">valid</emphasis> with respect to the DTD grammar since - more than one <tag class="starttag">item</tag> elements are + role="bold">valid</emphasis> with respect to the schema since more + than one <tag class="starttag">item</tag> elements are present.</para> </caption> </figure> - <para>This document instance is well-formed but not valid. The parser - will not report any error or warning. In order to enable validation we - need to configure our parser:</para> + <para>This document instance is well-formed but not valid: Only one + element <tag class="starttag">item</tag> is allowed due to an + ill-defined schema. The parser will not report any error or warning. + In order to enable validation we need to configure our parser:</para> <programlisting language="none">xmlReader.setFeature("http://xml.org/sax/features/validation", true);</programlisting> @@ -6243,14 +6263,6 @@ public class MemoViewHandler extends DefaultHandler { </varlistentry> </variablelist> - <para>Though not strictly required SAX validation may need DTD related - (Entity) resolving. Having just SYSTEM identifier pointing to remote - network addresses like <code>... SYSTEM - "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd - ..."</code> may take a long time for download or even fail completely. - So XML catalog files are in order for validation being based on - locally available schemes or DTDs.</para> - <para>The <productname xlink:href="http://projects.apache.org/projects/xml_commons_resolver.html">xml-commons resolver project </productname>offers an implementation being able to