diff --git a/Doc/course.xml b/Doc/course.xml index bb62d7ed540a7ecaaacb38fb40cebb540f8cfeca..21d3b99c8a42c2f5633b34aaffb12234c36bf8d7 100644 --- a/Doc/course.xml +++ b/Doc/course.xml @@ -1030,11 +1030,11 @@ terminated by the matching end-tag "</to>". parsing error</computeroutput> </listitem> </itemizedlist> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="example_memoAttribTree"> <title>A graphical representation of a memo.</title> <qandadiv> - <qandaentry xml:id="example_memoAttribTree"> + <qandaentry> <question> <para>Draw a graphical representation similar as in <xref linkend="mathmltree"/> of the memo document being given in @@ -1694,11 +1694,11 @@ terminated by the matching end-tag "</to>". parsing error</computeroutput> </mediaobject> </figure> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="example_memoTestValid"> <title>Validation of memo document instances.</title> <qandadiv> - <qandaentry xml:id="example_memoTestValid"> + <qandaentry> <question> <para>Copy the two files <link xlink:href="Ref/src/Memo.1/message.xml">message.xml</link> @@ -1832,11 +1832,11 @@ public class Memo { extended as our knowledge about XML advances. We start with an initial exercise:</para> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="example_bookDtd"> <title>>A DTD for editing books</title> <qandadiv> - <qandaentry xml:id="example_bookDtd"> + <qandaentry> <question> <para>Write a DTD describing book document instances with the following features:</para> @@ -1958,21 +1958,21 @@ public class Memo { </mediaobject> </figure> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="quandaentry_MultipleFk"> <title><abbrev xlink:href="http://en.wikipedia.org/wiki/Document_Type_Declaration">DTD</abbrev>'s and <acronym xlink:href="http://en.wikipedia.org/wiki/Sql">SQL</acronym>-DDL</title> <qandadiv> - <qandaentry xml:id="quandaentry_MultipleFk"> + <qandaentry> <question> <para><xref linkend="invoiceXml"/> is a complete implementation of the invoice data model including all integrity constraints of <xref linkend="invoiceSqlDdl"/>. Can this be achieved for arbitrary <acronym xlink:href="http://en.wikipedia.org/wiki/Sql">SQL</acronym> - schema's.</para> + schema's?</para> </question> <answer> @@ -2449,11 +2449,11 @@ int count = 2; // Fatal error: A variable must not be just a special case of a single text node and no element nodes being present.</para> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="example_allowed_mixed"> <title>Variations of mixed content models</title> <qandadiv> - <qandaentry xml:id="example_allowed_mixed"> + <qandaentry> <question> <para>You may assume that the element types <tag class="element">emphasize</tag> and <tag @@ -2694,11 +2694,12 @@ int count = 2; // Fatal error: A variable must not be </glosslist> </figure> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" + xml:id="example_operatorprecedence"> <title>Content models and operator priority></title> <qandadiv> - <qandaentry xml:id="example_operatorprecedence"> + <qandaentry> <question> <para>Find and explain the error being buried in the following DTD. After correcting the error construct a @@ -3185,11 +3186,11 @@ int count = 2; // Fatal error: A variable must not be but the current example shows that the production rules of <code>#PCDATA</code> and <code>CDATA</code> differ.</para> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="example_book.dtd_v3"> <title>book.dtd and languages></title> <qandadiv> - <qandaentry xml:id="example_book.dtd_v3"> + <qandaentry> <question> <para>We want to extend our DTD from <xref linkend="example_book_v2"/> by allowing an author to @@ -3306,11 +3307,11 @@ int count = 2; // Fatal error: A variable must not be </production> </productionset> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="example_quotes"> <title>Enclosing quotes</title> <qandadiv> - <qandaentry xml:id="example_quotes"> + <qandaentry> <question> <para>We recall the problem of nested quotes yielding non-well formed XML code:</para> @@ -3598,11 +3599,11 @@ int count = 2; // Fatal error: A variable must not be attributes property allowing values to be chosen from a <emphasis>set</emphasis>.</para> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="example_book.dtd_v4"> <title>Restriction of allowed languages</title> <qandadiv> - <qandaentry xml:id="example_book.dtd_v4"> + <qandaentry> <question> <para xml:lang="">We extend our book.dtd version from <xref linkend="example_book.dtd_v3"/>. The attribute @@ -3931,11 +3932,12 @@ int count = 2; // Fatal error: A variable must not be </glossentry> </glosslist> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" + xml:id="example_legal_attribute_values"> <title>Legal attribute values</title> <qandadiv> - <qandaentry xml:id="example_legal_attribute_values"> + <qandaentry> <question> <para>Complete the following matrix. Enter a <quote>+</quote> if the attribute value satisfies the @@ -4191,11 +4193,11 @@ int count = 2; // Fatal error: A variable must not be </qandadiv> </qandaset> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="example_book.dtd_v5"> <title>book.dtd and internal references</title> <qandadiv> - <qandaentry xml:id="example_book.dtd_v5"> + <qandaentry> <question> <para>We want to extent our DTD from <xref linkend="example_book.dtd_v4"/> to allow document @@ -4541,11 +4543,11 @@ PUBLIC "-//OASIS//DTD DocBook V3.1//EN" docbook.dtd application is free to choose either of the two offered DTD files if both are accessible.</para> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="example_public_system"> <title>Relation between public and system identifiers</title> <qandadiv> - <qandaentry xml:id="example_public_system"> + <qandaentry> <question> <para>We recall <xref linkend="figure_xhtml_public"/>. The public identifier uniquely identifies the DTD. Thus the @@ -5314,11 +5316,11 @@ Martin Goik</computeroutput></programlisting> <programlisting><computeroutput>INSERT INTO Customer (id, name) VALUES ('goik', 'Martin Goik') INSERT INTO Customer (id, name) VALUES ('eve', 'Eve intruder')</computeroutput></programlisting> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="example_position_last"> <title>The XPath functions position() and last()</title> <qandadiv> - <qandaentry xml:id="example_position_last"> + <qandaentry> <question> <para>We return to our recipient list in <xref linkend="figure_recipientlist_trailing_comma"/>. We are @@ -5563,11 +5565,11 @@ broken! This bug has been reported by the sender.</computeroutput></programlisti its default rule and copies the node's content <code>foo</code> to its output.</para> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="example_rdbms_person"> <title>Extending the export to a RDBMS</title> <qandadiv> - <qandaentry xml:id="example_rdbms_person"> + <qandaentry> <question> <para>We assume that our RDBMS table <code>Customer</code> from <xref linkend="programlisting_memo_export_sql"/> shall @@ -5830,11 +5832,11 @@ IV: ... <code>xmlns="http://www.w3.org/1999/xhtml</code>. This will be inherited by all inner Xhtml elements.</para> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="example_xsl_book_1_dtd"> <title>Transforming book instances to Xhtml</title> <qandadiv> - <qandaentry xml:id="example_xsl_book_1_dtd"> + <qandaentry> <question> <para>Create a <abbrev xlink:href="http://www.w3.org/Style/XSL">XSL</abbrev> @@ -5970,11 +5972,11 @@ IV: ... </html> </xsl:template></programlisting> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="example_book_toc"> <title>Adding a table of contents (toc)</title> <qandadiv> - <qandaentry xml:id="example_book_toc"> + <qandaentry> <question> <para>For larger document instances it is convenient to add a table of contents to the generated Xhtml document. @@ -6360,12 +6362,12 @@ you need some </emphasis><em>time</em><emphasis role="bold">.</empha <emphasis role="bold">(Home trainer)</emphasis> gets added after the hypertext link.</para> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="example_book_xsl_mixed"> <title>Extending the memo style sheet by mixed content and itemized lists</title> <qandadiv> - <qandaentry xml:id="example_book_xsl_mixed"> + <qandaentry> <question> <para>In <xref linkend="example_book.dtd_v5"/> we constructed a DTD allowing itemized lists an mixed content @@ -6825,11 +6827,11 @@ Jack Eve Jude <----Tolstoi----> <co </callout> </calloutlist> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="example_book_chunk"> <title>Splitting book into chapter files</title> <qandadiv> - <qandaentry xml:id="example_book_chunk"> + <qandaentry> <question> <para>Extend your solution of <xref linkend="example_book_xsl_mixed"/> by writing each <tag @@ -7651,11 +7653,11 @@ public class ElementCount { redefine only those methods corresponding to events actually being handled by the application in question.</para> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="exercise_saxAttrib"> <title>Reading XML attributes</title> <qandadiv> - <qandaentry xml:id="exercise_saxAttrib"> + <qandaentry> <question> <label>Reading an element's set of attributes.</label> @@ -8059,11 +8061,11 @@ localName='HTML'</programlisting> </listitem> </itemizedlist> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="quandaentry_SqlFromXml"> <title>Generating SQL INSERT statements from XML data</title> <qandadiv> - <qandaentry xml:id="quandaentry_SqlFromXml"> + <qandaentry> <question> <para>Consider the following DTD + document instance example:</para> @@ -8169,11 +8171,11 @@ INSERT INTO Description VALUES('instantTent', 'Pre-attached tent poles');</progr </qandadiv> </qandaset> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="quandaentry_NumElemByNs"> <title>Counting element names grouped by namespaces</title> <qandadiv> - <qandaentry xml:id="quandaentry_NumElemByNs"> + <qandaentry> <question> <para>We want to extend the SAX examples counting <link linkend="saxElementCount">elements</link> and <link @@ -8609,11 +8611,11 @@ public class CreateDoc { <section xml:id="domCreateExercises"> <title>Exercises</title> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="createDocModify"> <title>A sub structured <tag class="starttag">title</tag></title> <qandadiv> - <qandaentry xml:id="createDocModify"> + <qandaentry> <question> <label>Creation of an extended XML document instance</label> @@ -8778,11 +8780,11 @@ Article: 200W Stereo Amplifier, order number: 9921</programlisting> </imageobject> </mediaobject> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="exercise_domHtmlSimple"> <title>Creating HTML output</title> <qandadiv> - <qandaentry xml:id="exercise_domHtmlSimple"> + <qandaentry> <question> <label>Simple HTML output</label> @@ -9310,11 +9312,11 @@ public class DomXpath { <programlisting>inline.gif one.gif http://www.hdm-stuttgart.de/favicon.ico </programlisting> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="quandaentry_CastAlwaysLegal"> <title>Legal casting?</title> <qandadiv> - <qandaentry xml:id="quandaentry_CastAlwaysLegal"> + <qandaentry> <question> <para>Why is the cast in <coref linkend="programlisting_java_searchimg_cast"/> in <xref @@ -9336,11 +9338,11 @@ public class DomXpath { </qandadiv> </qandaset> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="exercise_htmlImageVerify"> <title>Verification of referenced images readability</title> <qandadiv> - <qandaentry xml:id="exercise_htmlImageVerify"> + <qandaentry> <question> <para>We want to extend the example given in <xref linkend="domFindImages"/> by testing the existence and @@ -9636,11 +9638,11 @@ public class Xml2HtmlDriver { }</programlisting> </figure> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="exercise_catalogRdbms"> <title>HTML from XML and relational data</title> <qandadiv> - <qandaentry xml:id="exercise_catalogRdbms"> + <qandaentry> <question> <label>Catalogs and RDBMS</label> @@ -10275,11 +10277,11 @@ public class DbAccess { <programlisting>Successfully inserted 1 dataset(s)</programlisting> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="quandaentry_DupInsert"> <title>Exception on inserting objects</title> <qandadiv> - <qandaentry xml:id="quandaentry_DupInsert"> + <qandaentry> <question> <para>A second invocation of <classname>sda.jdbc.intro.v1.SimpleInsert</classname> yields @@ -10403,13 +10405,13 @@ public class DbAccess { </glossentry> </glosslist> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="quandaentry_AutoCommit"> <title><trademark xlink:href="http://electronics.zibb.com/trademark/jdbc/29545026">JDBC</trademark> and transactions</title> <qandadiv> - <qandaentry xml:id="quandaentry_AutoCommit"> + <qandaentry> <question> <para><link xlink:href="http://docs.oracle.com/javase/7/docs/api/java/sql/Connection.html#setAutoCommit(boolean)">How @@ -10464,13 +10466,13 @@ public class DbAccess { </qandadiv> </qandaset> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="quandaentry_Close"> <title>Closing <trademark xlink:href="http://electronics.zibb.com/trademark/jdbc/29545026">JDBC</trademark> connections</title> <qandadiv> - <qandaentry xml:id="quandaentry_Close"> + <qandaentry> <question> <para>Why is it very important to call the close() method for <classname>java.sql.Connection</classname> and / or @@ -10491,11 +10493,11 @@ public class DbAccess { </qandadiv> </qandaset> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="quandaentry_AbortTran"> <title>Aborted transactions</title> <qandadiv> - <qandaentry xml:id="quandaentry_AbortTran"> + <qandaentry> <question> <para>In the previous exercise we mentioned the possibility of a transaction abort issued by the database server. Which @@ -10515,12 +10517,12 @@ public class DbAccess { </qandadiv> </qandaset> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="exerciseJdbcWhyInterface"> <title>Interfaces and classes in <trademark xlink:href="http://electronics.zibb.com/trademark/jdbc/29545026">JDBC</trademark></title> <qandadiv> - <qandaentry xml:id="exerciseJdbcWhyInterface"> + <qandaentry> <question> <para>The <trademark xlink:href="http://electronics.zibb.com/trademark/jdbc/29545026">JDBC</trademark> @@ -10636,11 +10638,11 @@ public someClass { </qandadiv> </qandaset> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="quandaentry_DriverDispatch"> <title>Driver dispatch mechanism</title> <qandadiv> - <qandaentry xml:id="quandaentry_DriverDispatch"> + <qandaentry> <question> <para>In exercise <xref linkend="exerciseJdbcWhyInterface"/> we saw a hypothetic way to resolve the interface/class @@ -10756,7 +10758,7 @@ public someClass { helper class' name and finally create the actual <filename>message.properties</filename> file.</para> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="quandaentry_WritProps"> <title>Moving <trademark xlink:href="http://electronics.zibb.com/trademark/jdbc/29545026">JDBC</trademark> <abbrev @@ -10764,7 +10766,7 @@ public someClass { credentials to a property file</title> <qandadiv> - <qandaentry xml:id="quandaentry_WritProps"> + <qandaentry> <question> <para>Start executing the code given in <xref linkend="figJdbcSimpleWrite"/>. Then extend this example by @@ -10927,11 +10929,11 @@ public class SimpleInsert { and <emphasis role="bold">really</emphasis> understand the examples being presented therein.</para> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="quandaentry_GuiDb"> <title>GUI for inserting Person data to a database server</title> <qandadiv> - <qandaentry xml:id="quandaentry_GuiDb"> + <qandaentry> <question> <para>Write a GUI application as being outlined in <xref linkend="simpleInsertGui"/>. You may proceed as @@ -11059,11 +11061,11 @@ public class InsertPerson extends JFrame { ugly mix of GUI components and database related code. We take a first step to decouple these two distinct concerns:</para> - <qandaset xml:id="exercicseGuiStateful"> + <qandaset xml:id="quandaentry_DbLayer"> <title>Handling the database layer</title> <qandadiv> - <qandaentry xml:id="quandaentry_DbLayer"> + <qandaentry> <question> <para>Implement a class <code>PersistenceHandler</code> to be later used as a component of our next step GUI @@ -11350,11 +11352,11 @@ PersistenceHandler.username=foo</pre> <para>We may now complete the next enhancement step of our GUI database client.</para> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="exerciseGuiWriteTakeTwo"> <title>Connection on user action</title> <qandadiv> - <qandaentry xml:id="exerciseGuiWriteTakeTwo"> + <qandaentry> <question> <label>An application writing records to a database server</label> @@ -11699,11 +11701,11 @@ public class InsertPerson extends JFrame { </mediaobject> </figure> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="sqlInjectDropTable"> <title>Attack from the dark side</title> <qandadiv> - <qandaentry xml:id="sqlInjectDropTable"> + <qandaentry> <question> <para>Use the application from <xref linkend="exerciseGuiWriteTakeTwo"/> and <xref @@ -11918,12 +11920,12 @@ public class InsertPerson extends JFrame { </mediaobject> </figure> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="quandaentry_RegexpUse"> <title>Using regular expressions in <link linkend="gloss_Java"><trademark>Java</trademark></link></title> <qandadiv> - <qandaentry xml:id="quandaentry_RegexpUse"> + <qandaentry> <question> <para>This exercise is a preparation for <xref linkend="exercisefilterUserInput"/>. The aim is to deal @@ -12004,11 +12006,11 @@ The expression '[^0-9]+.*' ... </qandadiv> </qandaset> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="exercisefilterUserInput"> <title>Input validation by regular expressions</title> <qandadiv> - <qandaentry xml:id="exercisefilterUserInput"> + <qandaentry> <question> <para>The application of <xref linkend="sqlInjectDropTable"/> proved to be vulnerable to @@ -12369,12 +12371,12 @@ public class SimpleInsert { <para>The above string will be taken <quote>as is</quote> and thus simply becomes part of the database server's content.</para> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="exerciseSqlInjectPrepare"> <title>Prepared Statements to keep the barbarians at the gate</title> <qandadiv> - <qandaentry xml:id="exerciseSqlInjectPrepare"> + <qandaentry> <question> <para>In <xref linkend="sqlInjectDropTable"/> we found our implementation in <xref @@ -12439,14 +12441,15 @@ public class SimpleInsert { If you use a private Eclipse installation you may want to follow <xref linkend="testngInstall"/>.</para> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" + xml:id="quandaentry_DbLayerUnitTest"> <title>Testing <classname>sda.jdbc.intro.v1.PersistenceHandler</classname> using <productname xlink:href="http://testng.org">TestNG</productname></title> <qandadiv> - <qandaentry xml:id="quandaentry_DbLayerUnitTest"> + <qandaentry> <question> <para>Read <xref linkend="chapUnitTesting"/>. Then test:</para> @@ -12622,11 +12625,12 @@ public class SimpleRead { </callout> </calloutlist> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" + xml:id="quandaentry_JdbcTypeConversion"> <title>Getter methods and type conversion</title> <qandadiv> - <qandaentry xml:id="quandaentry_JdbcTypeConversion"> + <qandaentry> <question> <para>Apart from type mappings the <trademark xlink:href="http://electronics.zibb.com/trademark/jdbc/29545026">JDBC</trademark> @@ -12716,11 +12720,11 @@ INSERT INTO Friends VALUES (1, <emphasis role="bold">'31'</emphasis>, '1991-10-1 </qandadiv> </qandaset> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="quandaentry_HandlingNull"> <title>Handling NULL values.</title> <qandadiv> - <qandaentry xml:id="quandaentry_HandlingNull"> + <qandaentry> <question> <para>The attribute <code>birthday</code> in our database table Friends allows <code>NULL</code> values:</para> @@ -12761,11 +12765,11 @@ INSERT INTO Friends VALUES (1, <emphasis role="bold">'31'</emphasis>, '1991-10-1 </qandadiv> </qandaset> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="exerciseInsecureAuth"> <title>A user authentication <quote>strategy</quote></title> <qandadiv> - <qandaentry xml:id="exerciseInsecureAuth"> + <qandaentry> <question> <para>Our current application for entering <code>Person</code> records lacks authentication: A user @@ -12845,11 +12849,11 @@ INSERT INTO Friends VALUES (1, <emphasis role="bold">'31'</emphasis>, '1991-10-1 </qandadiv> </qandaset> - <qandaset xml:id="passwordHashes"> + <qandaset xml:id="exerciseHashTraining"> <title>Passwords and hash values</title> <qandadiv> - <qandaentry xml:id="exerciseHashTraining"> + <qandaentry> <question> <para>In exercise <xref linkend="exerciseInsecureAuth"/> we discarded the idea of clear text passwords in favour of @@ -12963,11 +12967,11 @@ public class TestHashProvider { </qandadiv> </qandaset> - <qandaset xml:id="exercise_GuiEnterPersonAuth"> + <qandaset xml:id="exerciseInsertLoginCredentials"> <title>Gui authentication: The real McCoy</title> <qandadiv> - <qandaentry xml:id="exerciseInsertLoginCredentials"> + <qandaentry> <question> <para>We now implement a refined version to enter <code>Person</code> records based on the solutions of two @@ -13251,13 +13255,13 @@ public class InsertPerson extends JFrame { </qandadiv> </qandaset> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="quandaentry_ArchSecurity"> <title>Architectural security considerations</title> <qandadiv> - <qandaentry xml:id="quandaentry_ArchSecurity"> + <qandaentry> <question> - <para>In <xref linkend="exercise_GuiEnterPersonAuth"/> we + <para>In <xref linkend="exerciseInsertLoginCredentials"/> we achieved end user credential protection. How about the overall application security? Provide improvement proposals if appropriate.</para> @@ -14851,11 +14855,11 @@ leader-pattern="dots"/>C<fo:leader leader-pattern="dots"/>D</fo:bloc example</link> with prices being added and incrementally create a series of PDF versions improving from one version to another.</para> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="idCatalogStart"> <title>A first PDF version of the catalog</title> <qandadiv> - <qandaentry xml:id="idCatalogStart"> + <qandaentry> <question> <para>Write a <abbrev xlink:href="http://www.w3.org/Style/XSL">XSL</abbrev> script @@ -15775,11 +15779,12 @@ Hibernate: Found user 'Martin Goik'</programlisting> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" + xml:id="quandaentry_MetodNullIfNoexist"> <title>Choosing the correct method</title> <qandadiv> - <qandaentry xml:id="quandaentry_MetodNullIfNoexist"> + <qandaentry> <question> <para>Actually the code in <xref linkend="loadByClassAndPrimaryKey"/> is not quite correct. @@ -15904,7 +15909,7 @@ final List<User> users = (List<User>) searchUsers.list(); uid=goik, Martin Goik uid=wings, Fred Wings</programlisting> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="quandaentry_AnalyzeHqlResult"> <title><abbrev xlink:href="http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html/ch16.html">HQL</abbrev> and <acronym @@ -15912,7 +15917,7 @@ uid=wings, Fred Wings</programlisting> analyzing results.</title> <qandadiv> - <qandaentry xml:id="quandaentry_AnalyzeHqlResult"> + <qandaentry> <question> <para>We may actually retrieve attributes rather than objects. For this purpose our query actually resembles @@ -16355,12 +16360,13 @@ public class Project { </callout> </calloutlist> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" + xml:id="quandaentry_IdGetterProtected"> <title><link linkend="gloss_JPA"><abbrev>JPA</abbrev></link> <code language="java">id</code> getter visibility.</title> <qandadiv> - <qandaentry xml:id="quandaentry_IdGetterProtected"> + <qandaentry> <question> <para>The setter void <methodname annotations="nojavadoc">setId(int)</methodname>in @@ -17025,11 +17031,12 @@ Caused by: java.sql.SQLException: Field 'bankName' doesn't have a default value< to specify not null constraints for properties of derived classes.</para> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" + xml:id="quandaentry_MappingFigureInherit"> <title>Mapping figures</title> <qandadiv> - <qandaentry xml:id="quandaentry_MappingFigureInherit"> + <qandaentry> <question> <para>Map the following model to a database:</para> @@ -17191,12 +17198,13 @@ public class RetrieveAll { </tr> </informaltable> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" + xml:id="quandaentry_IntegrityGenerate"> <title><link linkend="gloss_JPA"><abbrev>JPA</abbrev></link> constraints and database integrity.</title> <qandadiv> - <qandaentry xml:id="quandaentry_"> + <qandaentry> <question> <para>Explain all integrity constraints of the Hibernate generated schema. Will it implement the constraints corectly @@ -17300,11 +17308,12 @@ CREATE TABLE BankAccount ( </qandadiv> </qandaset> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" + xml:id="quandaentry_FigureJoinedSubclass"> <title>Implementing figures by joined subclasses</title> <qandadiv> - <qandaentry xml:id="quandaentry_FigureJoinedSubclass"> + <qandaentry> <question> <para>Implement the model being given in <xref linkend="modelFigureInheritance"/> by joined @@ -17663,11 +17672,12 @@ public class User { </calloutlist> </figure> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" + xml:id="quandaentry_MethodFieldAccess"> <title>Method and field access</title> <qandadiv> - <qandaentry xml:id="quandaentry_MethodFieldAccess"> + <qandaentry> <question> <para>Consider <xref linkend="implementEqualsByNaturalKey"/>. You may get a @@ -17798,11 +17808,11 @@ public class PersistUser { transaction.commit(); } ...</programlisting> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="quandaentry_HomeWorAddress"> <title>Home and work address</title> <qandadiv> - <qandaentry xml:id="quandaentry_HomeWorAddress"> + <qandaentry> <question> <para>Consider the following sketch of an address class:</para> @@ -17887,11 +17897,11 @@ public class PersistUser { transaction.commit(); } ...</programlisting> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="quandaentry_HqlSearchEmail"> <title>Searching users by email components</title> <qandadiv> - <qandaentry xml:id="quandaentry_HqlSearchEmail"> + <qandaentry> <question> <para>Create a <link linkend="gloss_Hql">HQL</link> query searching for:</para> @@ -17915,11 +17925,11 @@ public class PersistUser { </qandadiv> </qandaset> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="quandaentry_EmbeddedPostal"> <title>Embedded postal addresses</title> <qandadiv> - <qandaentry xml:id="quandaentry_EmbeddedPostal"> + <qandaentry> <question> <para>Construct a corresponding example allowing <classname>session3.User</classname> instances to have a set @@ -17930,11 +17940,12 @@ public class PersistUser { </qandadiv> </qandaset> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" + xml:id="quandaentry_ComponentLifecycleDepend"> <title>Life cycle of parents and components</title> <qandadiv> - <qandaentry xml:id="quandaentry_ComponentLifecycleDepend"> + <qandaentry> <question> <para>What happens, if an owning User instance gets deleted? Are composed Email or Address values are implicitly being @@ -17944,11 +17955,12 @@ public class PersistUser { </qandadiv> </qandaset> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" + xml:id="quandaentry_OrderedComponents"> <title>Ordered components</title> <qandadiv> - <qandaentry xml:id="quandaentry_OrderedComponents"> + <qandaentry> <question> <para>Replace <classname>java.util.Set</classname> by <classname>java.util.List</classname> and assure that the @@ -18103,11 +18115,12 @@ public class LoadAndDeRegister { <para>All three entities are still present in our database but the corresponding foreign key has been set to <code>NULL</code>.</para> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" + xml:id="quandaentry_EmployeeLaptopRelate"> <title>One laptop per employee</title> <qandadiv> - <qandaentry xml:id="quandaentry_EmployeeLaptopRelate"> + <qandaentry> <question> <para>Consider a company where each employee must have a laptop being assigned and modify the mapping in @@ -18226,12 +18239,13 @@ public class Laptop { @OneToOne (<emphasis role="bold">mappedBy="laptop"</emphasis>) public Employee getOwner() { return owner;} ...</programlisting> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" + xml:id="quandaentry_BiDirectionalLaptopOwner"> <title>Symmetric implementation of getter and setter methods</title> <qandadiv> - <qandaentry xml:id="quandaentry_BiDirectionalLaptopOwner"> + <qandaentry> <question> <para>The current implementation is not symmetric with respect to entity.company5.model.Employee.setLaptop and @@ -18250,11 +18264,11 @@ l.setOwner(e);</programlisting> </qandadiv> </qandaset> - <qandaset defaultlabel="qanda"> + <qandaset defaultlabel="qanda" xml:id="quandaentry_LaptopExchange"> <title>Transactions and data integrity</title> <qandadiv> - <qandaentry xml:id="quandaentry_LaptopExchange"> + <qandaentry> <question> <para>Use your implementation to exchange the laptops of two users. Which problem possibly arises? Is there a diff --git a/ws/Docbook/Extensions/Tdata/qanda.xml b/ws/Docbook/Extensions/Tdata/qanda.xml index aba7fe37b21493b72d6f6b23e232bffb57689df3..6abeca6e82b80761d9a712d5bc648ae42476288f 100644 --- a/ws/Docbook/Extensions/Tdata/qanda.xml +++ b/ws/Docbook/Extensions/Tdata/qanda.xml @@ -46,11 +46,11 @@ <chapter xml:id="chap2"> <title>More questions</title> - <qandaset> + <qandaset xml:id="q2"> <title>Second question</title> <qandadiv> - <qandaentry xml:id="q2"> + <qandaentry> <question> <para>My Second question</para> </question> @@ -78,5 +78,11 @@ </qandadiv> </qandaset> </chapter> + + <appendix xml:id="appendix"> + <title>List of exercises</title> + + <para>See <xref linkend="q2"/>.</para> + </appendix> </part> </book> diff --git a/ws/Docbook/Extensions/Xsl/docbook2docbook.xsl b/ws/Docbook/Extensions/Xsl/docbook2docbook.xsl index 8faa777e5ce0f37fcc8c731014046bbac7aaa7b3..d38d75b272d592b6e1d02f521147e691cf26695d 100644 --- a/ws/Docbook/Extensions/Xsl/docbook2docbook.xsl +++ b/ws/Docbook/Extensions/Xsl/docbook2docbook.xsl @@ -65,10 +65,9 @@ <xsl:template match="db:part"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> - <!-- <appendix> <title> - <xsl:text>Solutions exercises </xsl:text> + <xsl:text>List of exercise sets</xsl:text> <xsl:value-of select="db:title" /> </title> @@ -80,13 +79,11 @@ <th>Exercise title / page</th> <th>Status of completion</th> </tr> - <xsl:for-each select=".//db:qandaset/db:qandadiv/db:qandaentry"> + <xsl:for-each select=".//db:qandaset"> <tr> <td> - <xref xrefstyle="template:%n, %t"> - <xsl:attribute name="linkend"> - <xsl:apply-templates select="." mode="hdmIdGenerate"/> - </xsl:attribute> + <xref xrefstyle="template:%n, %t" linkend="{@xml:id}"> + <xsl:copy-of select="db:title/node()"/> </xref> </td> <td/> @@ -94,7 +91,6 @@ </xsl:for-each> </table> </appendix> - --> </xsl:copy> </xsl:template>