From 1ca2e95419bb0c5b292d7a33d7f322d7fdc564df Mon Sep 17 00:00:00 2001 From: Martin Goik <goik@hdm-stuttgart.de> Date: Tue, 27 Feb 2018 18:09:30 +0100 Subject: [PATCH] XML slides --- Doc/Common/glossary.xml | 8 + Doc/Sda1/Ref/Fig/attributes.fig | 82 +- Doc/Sda1/Ref/Fig/xmlbase.fig | 84 +- .../Ref/Xmlschema/P/MemoSqlModel/schema.sql | 26 + Doc/Sda1/prerequisites.xml | 20 - Doc/Sda1/xmlintro.xml | 846 +++++++++++++----- Doc/Sda1/xmlschema.xml | 406 ++++++--- 7 files changed, 1001 insertions(+), 471 deletions(-) create mode 100644 Doc/Sda1/Ref/Xmlschema/P/MemoSqlModel/schema.sql diff --git a/Doc/Common/glossary.xml b/Doc/Common/glossary.xml index d3c8b0261..754a80055 100644 --- a/Doc/Common/glossary.xml +++ b/Doc/Common/glossary.xml @@ -56,6 +56,14 @@ </glossdef> </glossentry> + <glossentry xml:id="glo_CLI"> + <glossterm><acronym>CLI</acronym></glossterm> + + <glossdef> + <para>Command line interface</para> + </glossdef> + </glossentry> + <glossentry xml:id="glo_CRUD"> <glossterm>CRUD</glossterm> diff --git a/Doc/Sda1/Ref/Fig/attributes.fig b/Doc/Sda1/Ref/Fig/attributes.fig index 592c47957..be015c244 100644 --- a/Doc/Sda1/Ref/Fig/attributes.fig +++ b/Doc/Sda1/Ref/Fig/attributes.fig @@ -1,8 +1,8 @@ -#FIG 3.2 Produced by xfig version 3.2.5 +#FIG 3.2 Produced by xfig version 3.2.6a Landscape Center Metric -Letter +Letter 100.00 Single -2 @@ -19,78 +19,78 @@ Single 0 41 #424242 0 42 #8c8c8c 0 43 #424242 -6 1575 3780 5670 6705 -1 3 0 2 4 0 890 -1 -1 0.000 1 0.0000 3780 4770 901 901 3780 4770 3825 5670 +6 6570 2610 10665 5535 +1 3 0 2 4 0 890 -1 -1 0.000 1 0.0000 8775 3600 901 901 8775 3600 8820 4500 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 1 0 2 2 1 1.00 60.00 120.00 - 2655 6705 2655 3870 + 7650 5535 7650 2700 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 1 0 2 2 1 1.00 60.00 120.00 - 1710 5895 5400 5895 + 6705 4725 10395 4725 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 2880 5850 2880 5940 + 7875 4680 7875 4770 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 3105 5850 3105 5940 + 8100 4680 8100 4770 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 3330 5850 3330 5940 + 8325 4680 8325 4770 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 3555 5850 3555 5940 + 8550 4680 8550 4770 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 4005 5850 4005 5940 + 9000 4680 9000 4770 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 4230 5850 4230 5940 + 9225 4680 9225 4770 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 4455 5850 4455 5940 + 9450 4680 9450 4770 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 4680 5850 4680 5940 + 9675 4680 9675 4770 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 4905 5760 4905 5940 + 9900 4590 9900 4770 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 2430 5850 2430 5940 + 7425 4680 7425 4770 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 2205 5850 2205 5940 + 7200 4680 7200 4770 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 1980 5850 1980 5940 + 6975 4680 6975 4770 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 2610 6120 2700 6120 + 7605 4950 7695 4950 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 2610 6345 2700 6345 + 7605 5175 7695 5175 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 2610 5670 2700 5670 + 7605 4500 7695 4500 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 2610 5445 2700 5445 + 7605 4275 7695 4275 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 2610 5220 2700 5220 + 7605 4050 7695 4050 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 2610 4995 2700 4995 + 7605 3825 7695 3825 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 2610 4545 2700 4545 + 7605 3375 7695 3375 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 2610 4320 2700 4320 + 7605 3150 7695 3150 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 3780 5760 3780 5940 + 8775 4590 8775 4770 2 1 0 1 0 4 900 -1 20 0.000 0 0 -1 0 0 2 - 2610 4770 2790 4770 + 7605 3600 7785 3600 2 1 0 1 0 0 890 -1 -1 0.000 0 0 -1 0 0 2 - 3735 4815 3825 4725 + 8730 3645 8820 3555 2 1 0 1 4 0 890 -1 -1 0.000 0 0 -1 1 0 2 2 1 1.00 60.00 120.00 - 3780 4770 4635 4545 + 8775 3600 9630 3375 2 1 0 1 0 0 890 -1 -1 0.000 0 0 -1 0 0 2 - 3825 4815 3735 4725 + 8820 3645 8730 3555 2 2 0 2 1 0 880 -1 -1 0.000 0 0 -1 0 0 5 - 1980 6120 3330 6120 3330 5220 1980 5220 1980 6120 -4 0 0 900 -1 2 24 0.0000 4 270 210 2295 4860 5\001 -4 0 0 900 -1 2 24 0.0000 4 270 210 3690 6255 5\001 -4 0 0 900 -1 2 24 0.0000 4 270 420 4725 6300 10\001 -4 0 0 900 -1 2 24 0.0000 4 195 210 5490 6075 x\001 -4 0 0 900 -1 2 24 0.0000 4 285 210 2385 3960 y\001 -4 0 4 890 -1 2 24 0.0000 4 270 615 3735 4590 r=4\001 -4 0 4 890 -1 2 24 0.0000 4 345 795 3645 5130 (5,5)\001 -4 0 1 880 -1 2 24 0.0000 4 345 1065 1575 6435 (-3,-1)\001 + 6975 4950 8325 4950 8325 4050 6975 4050 6975 4950 +4 0 0 900 -1 2 24 0.0000 4 270 210 7290 3690 5\001 +4 0 0 900 -1 2 24 0.0000 4 270 210 8685 5085 5\001 +4 0 0 900 -1 2 24 0.0000 4 270 420 9720 5130 10\001 +4 0 0 900 -1 2 24 0.0000 4 195 210 10485 4905 x\001 +4 0 0 900 -1 2 24 0.0000 4 285 210 7380 2790 y\001 +4 0 4 890 -1 2 24 0.0000 4 270 615 8730 3420 r=4\001 +4 0 4 890 -1 2 24 0.0000 4 345 795 8640 3960 (5,5)\001 +4 0 1 880 -1 2 24 0.0000 4 345 1065 6570 5265 (-3,-1)\001 -6 2 2 0 1 7 7 900 -1 -1 0.000 0 0 -1 0 0 5 - 0 0 10800 0 10800 6750 0 6750 0 0 + 0 0 10800 0 10800 5760 0 5760 0 0 4 0 0 900 -1 2 24 0.0000 4 270 1065 1800 495 <cad>\001 4 0 4 890 -1 2 24 0.0000 4 360 4470 2250 1215 <circle x='5' y='5' r='4'/>\001 4 0 1 880 -1 2 24 0.0000 4 360 6525 2250 1845 <rectangle x='-3' y='-1' h='4' w='6'/>\001 diff --git a/Doc/Sda1/Ref/Fig/xmlbase.fig b/Doc/Sda1/Ref/Fig/xmlbase.fig index e790c7cb3..4505fa35c 100644 --- a/Doc/Sda1/Ref/Fig/xmlbase.fig +++ b/Doc/Sda1/Ref/Fig/xmlbase.fig @@ -1,8 +1,8 @@ -#FIG 3.2 Produced by xfig version 3.2.5 +#FIG 3.2 Produced by xfig version 3.2.6a Landscape Center Metric -Letter +Letter 100.00 Single -2 @@ -19,50 +19,52 @@ Single 0 41 #424242 0 42 #8c8c8c 0 43 #424242 -1 3 0 0 0 1 840 -1 20 0.000 1 0.0000 8700 3420 255 255 8700 3420 8955 3420 -1 3 0 0 0 2 840 -1 20 0.000 1 0.0000 9870 4770 255 255 9870 4770 10125 4770 -1 3 0 0 0 1 890 -1 20 0.000 1 0.0000 8700 3420 255 255 8700 3420 8955 3420 -1 3 0 0 0 28 870 -1 20 0.000 1 0.0000 6435 6165 255 255 6435 6165 6690 6165 -1 3 0 0 0 2 880 -1 20 0.000 1 0.0000 7110 4770 255 255 7110 4770 7365 4770 -1 3 0 0 0 26 860 -1 20 0.000 1 0.0000 7785 6120 255 255 7785 6120 8040 6120 -1 3 0 0 0 28 840 -1 20 0.000 1 0.0000 9180 6165 255 255 9180 6165 9435 6165 -1 3 0 0 0 26 840 -1 20 0.000 1 0.0000 10530 6120 255 255 10530 6120 10785 6120 -1 3 0 0 0 1 880 -1 20 0.000 1 0.0000 8685 3420 255 255 8685 3420 8940 3420 -1 3 0 0 0 2 870 -1 20 0.000 1 0.0000 7110 4770 255 255 7110 4770 7365 4770 -1 3 0 0 0 2 860 -1 20 0.000 1 0.0000 7110 4770 255 255 7110 4770 7365 4770 +6 6210 1890 10845 5175 +1 3 0 0 0 1 840 -1 20 0.000 1 0.0000 8745 2160 255 255 8745 2160 9000 2160 +1 3 0 0 0 2 840 -1 20 0.000 1 0.0000 9915 3510 255 255 9915 3510 10170 3510 +1 3 0 0 0 1 890 -1 20 0.000 1 0.0000 8745 2160 255 255 8745 2160 9000 2160 +1 3 0 0 0 28 870 -1 20 0.000 1 0.0000 6480 4905 255 255 6480 4905 6735 4905 +1 3 0 0 0 2 880 -1 20 0.000 1 0.0000 7155 3510 255 255 7155 3510 7410 3510 +1 3 0 0 0 26 860 -1 20 0.000 1 0.0000 7830 4860 255 255 7830 4860 8085 4860 +1 3 0 0 0 28 840 -1 20 0.000 1 0.0000 9225 4905 255 255 9225 4905 9480 4905 +1 3 0 0 0 26 840 -1 20 0.000 1 0.0000 10575 4860 255 255 10575 4860 10830 4860 +1 3 0 0 0 1 880 -1 20 0.000 1 0.0000 8730 2160 255 255 8730 2160 8985 2160 +1 3 0 0 0 2 870 -1 20 0.000 1 0.0000 7155 3510 255 255 7155 3510 7410 3510 +1 3 0 0 0 2 860 -1 20 0.000 1 0.0000 7155 3510 255 255 7155 3510 7410 3510 +2 1 0 2 0 2 841 -1 20 0.000 0 0 -1 0 0 2 + 9945 3510 9225 4860 +2 1 0 2 0 2 841 -1 20 0.000 0 0 -1 0 0 2 + 9900 3555 10575 4860 +2 1 0 2 0 2 841 -1 20 0.000 0 0 -1 0 0 2 + 8730 2160 9855 3510 +2 1 0 2 0 0 881 -1 20 0.000 0 0 -1 0 0 2 + 8730 2160 7155 3510 +2 1 0 2 0 2 861 -1 20 0.000 0 0 -1 0 0 2 + 7155 3555 7830 4860 +2 1 0 2 0 2 871 -1 20 0.000 0 0 -1 0 0 2 + 7200 3510 6480 4860 +-6 2 1 0 2 0 7 750 -1 20 0.000 0 0 -1 1 0 2 2 1 2.00 120.00 240.00 7290 225 3915 225 2 1 0 2 0 7 740 -1 20 0.000 0 0 -1 1 0 2 2 1 2.00 120.00 240.00 - 7245 990 1890 630 + 7290 675 1890 630 2 1 0 2 0 7 740 -1 20 0.000 0 0 -1 1 0 2 2 1 2.00 120.00 240.00 - 8640 1350 8640 2970 + 8730 945 8730 1755 2 2 0 1 7 7 890 -1 -1 0.000 0 0 -1 0 0 5 - 0 0 10800 0 10800 6750 0 6750 0 0 -2 1 0 2 0 2 841 -1 20 0.000 0 0 -1 0 0 2 - 9900 4770 9180 6120 -2 1 0 2 0 2 841 -1 20 0.000 0 0 -1 0 0 2 - 9855 4815 10530 6120 -2 1 0 2 0 2 841 -1 20 0.000 0 0 -1 0 0 2 - 8685 3420 9810 4770 -2 1 0 2 0 0 881 -1 20 0.000 0 0 -1 0 0 2 - 8685 3420 7110 4770 -2 1 0 2 0 2 861 -1 20 0.000 0 0 -1 0 0 2 - 7110 4815 7785 6120 -2 1 0 2 0 2 871 -1 20 0.000 0 0 -1 0 0 2 - 7155 4770 6435 6120 -4 0 4 900 -1 2 24 0.0000 4 285 4245 0 270 <?xml version="1.0" ?>\001 -4 0 10 890 -1 2 24 0.0000 4 285 1860 0 690 <booklist>\001 -4 0 10 890 -1 2 24 0.0000 4 285 1980 0 4185 </booklist>\001 -4 0 2 880 -1 2 24 0.0000 4 285 1320 540 1125 <book>\001 -4 0 2 880 -1 2 24 0.0000 4 285 1440 540 2205 </book>\001 -4 0 2 840 -1 2 24 0.0000 4 285 1320 540 2655 <book>\001 -4 0 2 840 -1 2 24 0.0000 4 285 1440 540 3735 </book>\001 -4 0 28 870 -1 2 24 0.0000 4 375 5055 855 1485 <title>Starting JAVA</title>\001 -4 0 28 840 -1 2 24 0.0000 4 285 4200 855 3015 <title>Databases</title>\001 -4 0 25 860 -1 2 24 0.0000 4 285 5070 855 1845 <isbn>1234-x334-232</isbn>\001 -4 0 26 840 -1 2 24 0.0000 4 375 5280 855 3375 <isbn>4321-y334-1182</isbn>\001 -4 0 4 750 -1 2 24 0.0000 4 285 2265 7425 315 XML header\001 -4 0 10 740 -1 2 24 0.0000 4 375 3330 7470 1125 Top Level Element\001 + 0 0 10800 0 10800 5175 0 5175 0 0 +4 0 4 900 -1 2 24 0.0000 4 270 4245 0 270 <?xml version="1.0" ?>\001 +4 0 10 890 -1 2 24 0.0000 4 270 1860 0 690 <booklist>\001 +4 0 10 890 -1 2 24 0.0000 4 270 1980 0 4185 </booklist>\001 +4 0 2 880 -1 2 24 0.0000 4 270 1320 540 1125 <book>\001 +4 0 2 880 -1 2 24 0.0000 4 270 1440 540 2205 </book>\001 +4 0 2 840 -1 2 24 0.0000 4 270 1320 540 2655 <book>\001 +4 0 2 840 -1 2 24 0.0000 4 270 1440 540 3735 </book>\001 +4 0 28 870 -1 2 24 0.0000 4 360 5055 855 1485 <title>Starting JAVA</title>\001 +4 0 28 840 -1 2 24 0.0000 4 270 4200 855 3015 <title>Databases</title>\001 +4 0 25 860 -1 2 24 0.0000 4 270 5070 855 1845 <isbn>1234-x334-232</isbn>\001 +4 0 26 840 -1 2 24 0.0000 4 360 5280 855 3375 <isbn>4321-y334-1182</isbn>\001 +4 0 4 750 -1 2 24 0.0000 4 270 2265 7425 315 XML header\001 +4 0 10 740 -1 2 24 0.0000 4 360 3330 7425 810 Top Level Element\001 diff --git a/Doc/Sda1/Ref/Xmlschema/P/MemoSqlModel/schema.sql b/Doc/Sda1/Ref/Xmlschema/P/MemoSqlModel/schema.sql new file mode 100644 index 000000000..47e6f2adc --- /dev/null +++ b/Doc/Sda1/Ref/Xmlschema/P/MemoSqlModel/schema.sql @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS Para; +DROP TABLE IF EXISTS `To`; +DROP TABLE IF EXISTS Memo; + +CREATE TABLE Memo ( + id INT PRIMARY KEY, + `from` CHAR(20) NOT NULL, + subject CHAR(40), + `priority` CHAR(6), + CHECK (`priority` IN ('low', 'medium', 'high')) +); + +CREATE TABLE `To` ( + email CHAR(20), + memo INT NOT NULL, + PRIMARY KEY (email, memo), + FOREIGN KEY (memo) REFERENCES Memo(id) +); + +CREATE TABLE Para ( + item INT NOT NULL, + content CHAR(20), + memo INT NOT NULL, + PRIMARY KEY (item, memo), + FOREIGN KEY (memo) REFERENCES Memo(id) +); \ No newline at end of file diff --git a/Doc/Sda1/prerequisites.xml b/Doc/Sda1/prerequisites.xml index 33efa0648..1ccd7caaa 100644 --- a/Doc/Sda1/prerequisites.xml +++ b/Doc/Sda1/prerequisites.xml @@ -14,26 +14,6 @@ <title>Lecture related resources</title> <glosslist> - <glossentry> - <glossterm>Recommended books</glossterm> - - <glossdef> - <itemizedlist> - <listitem> - <para><xref linkend="bib_fawcett2012"/> possibly <link - xlink:href="https://proquest.safaribooksonline.com/book/web-development/xml/9781118239483">accessible - online</link>.</para> - </listitem> - - <listitem> - <para><xref linkend="bib_Walmsley02"/> possibly <link - xlink:href="https://proquest.safaribooksonline.com/book/web-development/xml/9780132886741">accessible - online</link>.</para> - </listitem> - </itemizedlist> - </glossdef> - </glossentry> - <glossentry> <glossterm>Live lecture additions</glossterm> diff --git a/Doc/Sda1/xmlintro.xml b/Doc/Sda1/xmlintro.xml index 0039ee9ec..b63cc67e3 100644 --- a/Doc/Sda1/xmlintro.xml +++ b/Doc/Sda1/xmlintro.xml @@ -1,37 +1,154 @@ <?xml version="1.0" encoding="UTF-8"?> -<chapter version="5.0" xml:id="xmlIntro" xmlns="http://docbook.org/ns/docbook" +<chapter annotations="slide" version="5.0" xml:id="xmlIntro" + xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:xila="http://www.w3.org/2001/XInclude/local-attributes" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> <title>Introduction to XML</title> + <figure xml:id="sda1_xml_fig_recommendedReading"> + <title>Recommended reading</title> + + <itemizedlist> + <listitem> + <para><xref linkend="bib_fawcett2012"/>.</para> + </listitem> + + <listitem> + <para>W3schools XML</para> + </listitem> + </itemizedlist> + + <!-- Add w3schools link --> + </figure> + <section xml:id="xmlBasic"> <title>The XML industry standard</title> - <para>A short question might be: <quote>What is XML?</quote> An answer - might be: The acronym <xref linkend="glo_XML"/> stands for - <quote>E<emphasis>x</emphasis>tensible <emphasis>M</emphasis>arkup - <emphasis>L</emphasis><foreignphrase>anguage</foreignphrase></quote> and - is an industry standard being published by the W3C standardization - organization. Like other industry software standards talking about XML - leads to talk about XML based software: Applications and frameworks - supplying added values to software implementors and enhancing data - exchange between applications.</para> - - <para>Many readers are already familiar with XML without explicitly - referring to the standard itself: The world wide web's - <foreignphrase>lingua franca</foreignphrase> HTML has been ported to an - XML dialect forming the <link - xlink:href="https://www.w3.org/MarkUp">XHTML</link> Standard. The idea - behind this standard is to distinguish between an abstract markup language - and rendered results being generated from so called document instances by - a browser:</para> + <figure xml:id="sda1_xml_fig_whatIsXml"> + <title>What is XML?</title> + + <itemizedlist> + <listitem> + <para>Acronym <quote>E<emphasis + role="red"><emphasis>x</emphasis></emphasis>tensible + <emphasis><emphasis role="red">M</emphasis></emphasis>arkup + <emphasis><emphasis + role="red">L</emphasis></emphasis><foreignphrase>anguage</foreignphrase></quote>.</para> + </listitem> + + <listitem> + <para>W3C standard.</para> + + <!-- Add W3C link--> + </listitem> + + <listitem> + <para>Superset / Generalization of <link + xlink:href="https://www.w3.org/MarkUp">(X)HTML</link>.</para> + </listitem> + </itemizedlist> + </figure> + + <figure xml:id="sda1_xml_fig_applicationAreas"> + <title>Application domains</title> + + <itemizedlist> + <listitem> + <para>Representing documents. Examples: Docbook, DITA</para> + + <!-- Add links--> + </listitem> + + <listitem> + <para>Representing application data:</para> + + <itemizedlist> + <listitem> + <para>Software configurations.</para> + </listitem> + + <listitem> + <para>Application data exchange / Web services</para> + </listitem> + </itemizedlist> + </listitem> + </itemizedlist> + </figure> + + <figure xml:id="sda1_xml_fig_benefits"> + <title>Benefits</title> + + <itemizedlist> + <listitem> + <para>Tons of well-defined standards i.e. SOAP,...</para> + + <!-- Add W3C standards list examples--> + </listitem> + + <listitem> + <para>Tons of sound framework implementations.</para> + + <!-- Add parsers / JAXB/JDK, XSLT, FOP,...--> + </listitem> + </itemizedlist> + </figure> + + <figure xml:id="sda1_xml_fig_relevance"> + <title>Relevance (2018/02)</title> + + <informaltable border="0"> + <colgroup width="56%"/> + + <colgroup width="44%"/> + + <tr> + <td valign="top"><screen>locate \.xml +... +/etc/ImageMagick-6/type.xml +/etc/alternatives/desktop-background.xml +/etc/bonobo-activation/bonobo-activation-config.xml +/etc/cupshelpers/preferreddrivers.xml +/etc/gconf/gconf.xml.defaults +...</screen></td> + + <td valign="top"><screen>locate \.xml|wc + <emphasis role="red">28898</emphasis> 29536 2687893</screen></td> + </tr> + </informaltable> + </figure> + + <figure xml:id="sda1_xml_fig_relevanceJson"> + <title><abbrev>JSON</abbrev> catches up!</title> + + <informaltable border="0"> + <colgroup width="56%"/> + + <colgroup width="44%"/> + + <tr> + <td valign="top"><screen>locate \.json +/opt/google/chrome/default_apps/external_extensions.json +/usr/lib/libreoffice/share/emojiconfig/emoji.json +/usr/lib/python3/dist-packages/idna-2.5.egg-info/pbr.json +/usr/share/calibre/editor-functions.json +/usr/share/calibre/template-functions.json +/usr/share/calibre/user-agent-data.json +...</screen></td> + + <td valign="top"><screen>locate \.json|wc + <emphasis role="red">829</emphasis> 834 84404</screen></td> + </tr> + </informaltable> + </figure> <figure xml:id="renderXhtmlMarkup"> - <title>Rendering XHTML markup</title> + <title>Rendering (X)HTML markup</title> <mediaobject> <imageobject> @@ -40,11 +157,11 @@ </mediaobject> </figure> - <para><xref linkend="glo_XHTML"/> is actually a good example to illustrate - the tree like, hierarchical structure of XML documents:</para> + <para><xref linkend="glo_XHTML"/> illustrating <xref linkend="glo_XML"/> + documents' tree like / hierarchical structure:</para> <figure xml:id="xhtmlTree"> - <title>Xhtml tree structure</title> + <title>HTML tree structure</title> <mediaobject> <imageobject> @@ -58,9 +175,8 @@ xlink:href="https://www.w3.org/Math">Mathml</link>:</para> <figure xml:id="mathmlExample"> - <title>A formula in <link - xlink:href="https://www.w3.org/Math">MathML</link> - representation.</title> + <title><link xlink:href="https://www.w3.org/Math">MathML</link> + formula</title> <mediaobject> <imageobject> @@ -69,53 +185,12 @@ </mediaobject> </figure> - <para>Again we observe a similar situation: A database like - <emphasis>representation</emphasis> of a formula on the left and a - <emphasis>rendered</emphasis> version on the right. Regarding XML we - have:</para> - - <itemizedlist> - <listitem> - <para>The <link xlink:href="https://www.w3.org/Math">MathML</link> - standard intended to describe mathematical formulas. The standard - defines a set of <emphasis>tags</emphasis> like e.g. <tag - class="starttag">math:msqrt</tag> with well-defined semantics - regarding permitted attribute values and nesting rules.</para> - </listitem> - - <listitem> - <para>Informal descriptions of formatting expectations.</para> - </listitem> - - <listitem> - <para>Software transforming an XML formula representation into visible - or printable output. In other words: A rendering engine.</para> - </listitem> - </itemizedlist> - - <para>XML documents may also be regarded as a persistence mechanism to - represent and store data. Similarities to Relational Database Systems - exist. A RDBMS - (<emphasis>R</emphasis><foreignphrase>elational</foreignphrase> - <emphasis>D</emphasis><foreignphrase>atabase</foreignphrase> - <emphasis>M</emphasis><foreignphrase>anagement</foreignphrase> - <emphasis>S</emphasis><foreignphrase>ystem</foreignphrase>) is typically - capable to hold Tera bytes of data being organized in tables. The - arrangement of data may be subject to various constraints like candidate- - or foreign key rules. With respect to both end users and software - developers a RDBMS itself is a building block in a complete solution. We - need an application on top of it acting as a user interface to the data - being contained.</para> - - <para>In contrast to a RDBMS XML allows data to be organized - hierarchically. The <link - xlink:href="https://www.w3.org/Math">MathML</link> representation given in - <xref linkend="mathmlExample"/> may be graphically visualized:</para> + <para>In contrast to a RDBMS <xref linkend="glo_XML"/> allows for + hierarchically organized data:</para> <figure xml:id="mathmltree"> - <title>A tree graph representation of the <link - xlink:href="https://www.w3.org/Math">MathML</link> example given - before.</title> + <title><link xlink:href="https://www.w3.org/Math">MathML</link> tree + graph representation</title> <mediaobject> <imageobject> @@ -124,31 +199,77 @@ </mediaobject> </figure> - <para>CAD applications may user XML documents as a representation of - graphical primitives:</para> + <figure xml:id="sda1_xml_fig_htmlMathmlSimilarities"> + <title><xref linkend="glo_HTML"/> / <link + xlink:href="https://www.w3.org/Math">MathML</link> document + similarities</title> + + <itemizedlist> + <listitem> + <para>Defining tags:</para> + + <screen><html>, <head>, <body>, ... +<math:math>, <math:mrow>, <math:msqrt>,...</screen> + </listitem> + + <listitem> + <para>Nesting rules e.g. <quote>The <tag class="starttag">body</tag> + element may contain <tag class="starttag">p</tag>, <tag + class="starttag">ul</tag>, <tag class="starttag">table</tag>,... + elements</quote>.</para> + </listitem> + + <listitem> + <para>Associating tags and formatting expectations (semantics) e.g. + <quote>A <tag class="starttag">p</tag> element represents a block of + text to be separated from neighbouring blocks by + newlines</quote>.</para> + </listitem> + + <listitem> + <para>Visualization capable software (renderer).</para> + </listitem> + </itemizedlist> + </figure> + + <figure xml:id="sda1_xml_fig_physicalFileRepresentation"> + <title>XML files: Representing data</title> + + <itemizedlist> + <listitem> + <para>Low level data store (single user, no transactions).</para> + </listitem> + + <listitem> + <para>Representing hierarchically nested data.</para> + </listitem> + + <listitem> + <para>Access by standard frameworks.</para> + </listitem> + </itemizedlist> + </figure> + + <para>Example: A CAD application representing graphical primitives:</para> + + <figure xml:id="sda1_xml_fig_cadDataRepresentation"> + <title>Representing CAD data</title> - <informalfigure> <mediaobject> <imageobject> <imagedata fileref="Ref/Fig/attributes.fig" scale="65"/> </imageobject> </mediaobject> - </informalfigure> - - <para>Of course RDBMS also allow the representation of tree like - structures or arbitrary graphs. But these have to be modelled by using - foreign key constraints since relational tables themselves have a - <quote>flat</quote> structure. Some RDBMS vendors provide extensions to - the SQL standard which allow <quote>native</quote> representations of - <xref linkend="glo_XML"/> documents.</para> + </figure> </section> <section xml:id="xmlHtml"> <title>Well formed XML documents</title> - <para>The general structure of an document is as follows:</para> + <para>The general structure of an <xref linkend="glo_XML"/> document is as + follows:</para> - <figure xml:id="xmlbase"> + <figure xml:id="sda1_xml_fig_basicStructure"> <title><xref linkend="glo_XML"/> basic structure</title> <mediaobject> @@ -158,11 +279,27 @@ </mediaobject> </figure> - <para>We explore a simple XML document representing messages like - E-mails:</para> + <figure xml:id="sda1_xml_fig_mostSimpleXml"> + <title>Minimal XML document</title> + + <programlisting language="xml"><minimum/></programlisting> + </figure> + + <figure xml:id="sda1_xml_fig_emptyTags"> + <title>Empty tags</title> + + <programlisting language="xml"><p></p></programlisting> + + <para>is equivalent to:</para> + + <programlisting language="xml"><p/></programlisting> + </figure> + + <para>We explore a simple XML document representing E-mail type + messages:</para> <figure xml:id="memoWellFormed"> - <title>The representation of a short message.</title> + <title>Representing messages.</title> <programlisting language="xml"><?xml<co xml:id="first_xml_code_magic"/> version="1.0"<co xml:id="first_xml_code_version"/> encoding="UTF-8"<co @@ -178,54 +315,84 @@ <calloutlist> <callout arearefs="first_xml_code_magic"> - <para>The very first characters <code><?xml</code> may be regarded + <para>The very first character group <code + language="xml"><?xml</code> is actually a terminal to be conceived as a <link xlink:href="https://en.wikipedia.org/wiki/Magic_number_(programming)">magic - number string</link> being used as a format indicator which allows to - distinguish between different file types i.e. GIF, JPEG, HTML and so - on.</para> + number string</link> indicating the content type. It allows for + distinguishing <xref linkend="glo_XML"/> documents from other file + types i.e. <filename>.gif</filename>, <filename>.jpg</filename>, + <filename>.zip</filename> and so on.</para> + + <note> + <itemizedlist> + <listitem> + <para>The whole header line is optional with respect to the + <xref linkend="glo_XML"/> standard.</para> + </listitem> + + <listitem> + <para>The <quote>document type XML</quote> notion is fairly + generic: It may be further categorized <abbrev>i.e.</abbrev> + containing <xref linkend="glo_SVG"/> data.</para> + </listitem> + </itemizedlist> + </note> </callout> <callout arearefs="first_xml_code_version"> - <para>The <code>version="1.0"</code> attribute tells us that all + <para>The <code language="xml">version="1.0"</code> attribute declares subsequent lines will conform to the <link xlink:href="https://www.w3.org/TR/xml">XML</link> standard of version - 1.0. This way a document can express its conformance to the version - 1.0 standard even if in the future this standard evolves to a higher - version e.g. <code>version="2.1"</code>.</para> + 1.0. This allows for XML standard evolution <abbrev>e.g.</abbrev> to + <code language="xml">version="2.1"</code>.</para> </callout> <callout arearefs="first_xml_code_encoding"> - <para>The attribute <code>encoding="UTF-8"</code> tells us that all - text in the current document uses <link - xlink:href="http://unicode.org">Unicode</link> encoding. <link - xlink:href="http://unicode.org">Unicode</link> is a widely accepted - industry standard for font encoding. Thus European, Cyrillic and most - Asian font codes are allowed to be used in documents - <emphasis>simultaneously</emphasis>. Other encodings may limit the set - of allowed characters, e.g. <code>encoding="ISO-8859-1"</code> will - only allow characters belonging to western European languages. However - a system also needs to have the corresponding fonts (e.g. TrueType) - being installed in order to render the document appropriately. A - document containing Chinese characters is of no use if the underlying - rendering system lacks e.g. a set of Chinese True Type fonts.</para> + <para>The attribute <code language="xml">encoding="UTF-8"</code> + denotes the current document's content to be composed of + <code>UTF-8</code><link xlink:href="http://unicode.org"> + Unicode</link> characters being a widely accepted font encoding + standard. This way European, Cyrillic and most Asian font codes are + allowed to be used <emphasis>simultaneously</emphasis>.</para> + + <note> + <para>Proper visual rendering requires corresponding fonts to be + installed: A document containing Chinese characters is of no use if + the underlying rendering system lacks <abbrev>e.g.</abbrev> Chinese + True Type fonts.</para> + </note> </callout> <callout arearefs="first_xml_code_topelement"> - <para>An XML document has exactly one top level - <emphasis>node</emphasis>. In contrast to the HTML standard these - nodes are commonly called elements rather than tags. In this example - the top level (root) element is <tag - class="starttag">memo</tag>.</para> + <para>An <xref linkend="glo_XML"/> document must have exactly one top + level <emphasis>node</emphasis>. In contrast to the <xref + linkend="glo_HTML"/> standard when talking about XML documents + <quote>nodes</quote> are commonly referred to as + <quote>elements</quote> rather than <quote>tags</quote>. In this + example <tag class="starttag">memo</tag> is the top level root + element.</para> + + <note> + <para>The document's root element may still appear as a nested + descendant element again:</para> + + <programlisting language="xml"><memo> + ... + <content>Hi all, congratulations to your splendid party</content> + <emphasis role="red"><memo>Play it again, sam</memo></emphasis> +</memo></programlisting> + </note> </callout> <callout arearefs="first_xml_code_from"> - <para>Each XML element like <tag class="starttag">from</tag> has a - corresponding counterpart <tag class="endtag">from</tag>. In terms of - XML we say each element being opened has to be closed. In conjunction - with the precedent point this is equivalent to the fact that each XML - document represents a tree structure as being shown in the <link - linkend="mathmltree">tree graph</link> representation.</para> + <para>Each <xref linkend="glo_XML"/> element like <tag + class="starttag">from</tag> has a corresponding counterpart <tag + class="endtag">from</tag>. In terms of XML we say each element being + opened has to be closed accordingly. In conjunction with the preceding + point this is equivalent to the fact that each XML document represents + a tree structure as being shown in the <link linkend="mathmltree">tree + graph</link> representation.</para> </callout> </calloutlist> @@ -240,44 +407,41 @@ <userinput><command>xmlparse</command> message.xml</userinput> to start a check:</para> - <screen><errortext>goik>xmlparse wellformed.xml + <figure xml:id="sda1_xml_fig_miParser"> + <title>MI department <xref linkend="glo_CLI"/> parser</title> + + <para>Checking an <xref linkend="glo_XML"/> document for + well-formedness:</para> + + <screen><errortext>goik>xmlparse message.xml Parsing was successful</errortext></screen> + </figure> - <para>Various XML related plugins are supplied for the <productname - xlink:href="https://eclipse.org">eclipse platform</productname> like the - <productname xlink:href="http://oxygenxml.com">Oxygen - software</productname> supplying <quote>life</quote> conformance checking - while editing XML documents. Now we test our assumptions by violating some - of the rules stated before. We deliberately omit the closing element <tag + <para>We deliberately omit the closing element <tag class="endtag">from</tag>:</para> - <figure xml:id="omitFrom"> - <title>An invalid XML document due to the omission of <tag - class="endtag">from</tag>.</title> + <figure xml:id="sda1_xml_fig_omitFrom"> + <title>Non-wellformed, missing <tag class="endtag">from</tag></title> - <programlisting language="xml"><?xml version="1.0" encoding="UTF-8"?> -<memo> - <from>M. Goik <co xml:id="omitFromMissingElement"/> + <programlisting language="none"><memo> + <from>M. Goik <emphasis role="red"><!-- missing </from> --></emphasis> <to>B. King</to> <to>A. June</to> <subject>Best whishes</subject> <content>Hi all, congratulations to your splendid party</content> </memo></programlisting> - - <calloutlist> - <callout arearefs="omitFromMissingElement"> - <para>The opening element <tag class="starttag">from</tag> is not - terminated by <tag class="endtag">from</tag>.</para> - </callout> - </calloutlist> </figure> <para>Consequently the parser's output reads:</para> - <screen><errortext>goik>xmlparse omitfrom.xml -file:///ma/goik/workspace/Vorlesungen/Input/Memo/omitfrom.xml:8:3: + <figure xml:id="sda1_xml_fig_omitFromResult"> + <title>Parsing non-wellformed</title> + + <screen><errortext>goik>xmlparse omitfrom.xml +file:///ma/goik/workspace/Vorlesungen/Input/Memo/omitfrom.xml:7:3: fatal error org.xml.sax.SAXParseException: The element type "from" must be terminated by the matching end-tag "</from>". parsing error</errortext></screen> + </figure> <para>Experienced HTML authors may be confused: In fact HTML is not an XML standard. Instead HTML belongs to the set of SGML applications. SGML is a @@ -287,32 +451,40 @@ must be terminated by the matching end-tag "</from>". parsing error</error <para>Even if every XML element has a closing counterpart the resulting XML may be invalid:</para> - <programlisting language="xml"><?xml version="1.0" encoding="UTF-8"?> -<memo> - <from>M. Goik<to>B. King</from></to> + <figure xml:id="sda1_xml_fig_improperNesting"> + <title>Improperly nested elements</title> + + <programlisting language="xml"><memo> + <emphasis role="red"><from></emphasis>M. Goik<emphasis role="red"><to></emphasis>B. King<emphasis + role="red"></from></emphasis><emphasis role="red"></to></emphasis> <to>A. June</to> <subject>Best whishes</subject> <content>Hi all, congratulations to your splendid party</content> </memo></programlisting> + </figure> - <para>The parser echoes:</para> + <para>This type of error is caused by so called improper nesting of + elements: The element <tag class="starttag">from</tag>is being closed + before the <quote>inner</quote> element <tag class="starttag">to</tag> has + been closed. This would contradict representing XML documents as a tree + like structures. The parser thus echoes:</para> + + <figure xml:id="sda1_xml_fig_improperNestingResult"> + <title>Improperly nested elements: Result</title> - <screen><computeroutput>file:///ma/goik/workspace/Vorlesungen/Input/Memo/nonest.xml:3:29: + <screen><computeroutput>file:///ma/goik/workspace/Vorlesungen/Input/Memo/nonest.xml:2:29: fatal error org.xml.sax.SAXParseException: The element type "to" must be terminated by the matching end-tag "</to>". parsing error</computeroutput></screen> + </figure> - <para>This type of error is caused by so called improper nesting of - elements: The element <tag class="starttag">from</tag>is closed before the - <quote>inner</quote> element <tag class="starttag">to</tag> has been - closed. Actually this violates the expressibility of XML documents as a - tree like structure. The situation may be resolved by choosing:</para> + <para>The situation may be resolved by choosing:</para> <programlisting language="xml">...<from>M. Goik<to>B. King</to></from>...</programlisting> <para>We provide two examples illustrating proper and improper nesting of XML documents:</para> - <figure xml:id="fig_nestingProper"> + <figure xml:id="sda1_xml_fig_properNesting"> <title>Proper nesting of XML elements</title> <mediaobject> @@ -322,8 +494,9 @@ terminated by the matching end-tag "</to>". parsing error</computeroutput> </mediaobject> </figure> - <para>The following example violates proper nesting constraint and thus - does not provide an XML document:</para> + <para>The following example violates the <xref linkend="glo_XML"/> proper + nesting constraint and thus does not represent a well-formed + document:</para> <figure xml:id="fig_improperNest"> <title>Improperly nested elements</title> @@ -341,14 +514,14 @@ terminated by the matching end-tag "</to>". parsing error</computeroutput> xlink:href="src/viewlet/wellformed/wellformed_viewlet_swf.html">here</uri>.</para> --> - <para>XML elements may have so called attributes like <tag + <para>XML elements may have attributes like <tag class="attribute">date</tag> in the following example:</para> <figure xml:id="memoWellAttrib"> - <title>An XML Memo having attributes.</title> + <title>date and priority attributes.</title> - <programlisting language="xml"><?xml version="1.0" encoding="UTF-8"?> -<memo date="10.02.2006" priority="high"> + <programlisting language="xml"><memo <emphasis role="red">date="10.02.2026"</emphasis> <emphasis + role="red">priority="high"</emphasis>> <from>M. Goik</from> <to>B. King</to> <to>A. June</to> @@ -357,31 +530,46 @@ terminated by the matching end-tag "</to>". parsing error</computeroutput> </memo></programlisting> </figure> - <para>The conformance of a XML document with the following rules may be - verified by invoking a parser:</para> - - <itemizedlist> - <listitem> - <para>Within the <emphasis>scope</emphasis> of a given element an - attribute name must be unique. In the example above one may not define - a second attribute <varname>date="..."</varname> within the same - element <memo ... >. This reflects the usual programming - language semantics of attributes: In a <xref linkend="glo_Java"/> - class an attribute is represented by an unique identifier and thus - cannot appear twice.</para> - </listitem> + <figure xml:id="sda1_xml_fig_uniqueAttributeName"> + <title>Unique attribute names</title> + + <informaltable border="0"> + <tr> + <td valign="top"><programlisting language="none"><!-- Error: Attribute date must be + unique within element + <memo> --> +<memo date = "10.02.2026" + priority = "high" + <emphasis role="red">date = "10.02.2026"</emphasis>> + ...</programlisting></td> + + <td valign="top"><programlisting language="none">public class Memo { + Date date; + int priority; + <emphasis role="red">Date date</emphasis>; + ... +}</programlisting></td> + </tr> + </informaltable> + </figure> - <listitem> - <para>An attribute value must be enclosed either in single (') or - double (") quotes. This is different from the HTML standard which - allows attribute values without quotes provided the given attribute - value does not give rise to ambiguities. For example <tag - class="starttag">td align=left</tag> is allowed since the attribute - value <tag class="attvalue">left</tag> does not contain any spaces - thus allowing a parser to recognize the end of the value's - definition.</para> - </listitem> - </itemizedlist> + <figure xml:id="sda1_xml_fig_attributeRequiresQuotes"> + <title>Quotes required</title> + + <informaltable border="0"> + <tr> + <td valign="top"><programlisting language="xml"> ... +<img valign = 'top'> + ...</programlisting></td> + + <td valign="top"><programlisting language="xml"> ... +<!-- Error: Attribute value + must be quoted --> +<img valign = <emphasis role="red">top</emphasis>> + ...</programlisting></td> + </tr> + </informaltable> + </figure> <qandaset defaultlabel="qanda" xml:id="example_memoAttribTree"> <title>A graphical representation of a memo.</title> @@ -427,49 +615,49 @@ terminated by the matching end-tag "</to>". parsing error</computeroutput> <para>As stated before XML attributes have to be enclosed in single or double quotes. Construct an XML document with mixed - quotes like <code><date day="monday'></code>. How does the - parser react? Find the corresponding syntax definition of legal - attribute values in the <link - xlink:href="https://www.w3.org/TR/xml">XML standard W3C - Recommendation</link>.</para> + quotes like <code><date day="monday'></code>. Find the + corresponding syntax definition of legal attribute values in the + <link xlink:href="https://www.w3.org/TR/xml">XML standard W3C + Recommendation</link> to explain your result.</para> </question> <answer> <para>The parser flags a mixture of single and double quotes for a given attribute as an error. The XML standard <link xlink:href="https://www.w3.org/TR/xml#NT-AttValue">defines</link> - the syntax of attribute values: An attribute value has to be - enclosed <emphasis>either</emphasis> in two single + the syntax of attribute values as follows: An attribute value has + to be enclosed <emphasis>either</emphasis> in two single <emphasis>or</emphasis> in two double quotes as being defined in <uri - xlink:href="https://www.w3.org/TR/xml/#NT-AttValue">http://www.w3.org/TR/xml/#NT-AttValue</uri>.</para> + xlink:href="https://www.w3.org/TR/xml/#NT-AttValue">http://www.w3.org/TR/xml/#NT-AttValue</uri>. + Mixed quotes are disallowed.</para> </answer> </qandaentry> <qandaentry xml:id="quoteInAttributValue"> <question> - <label>Quotes as part of an attributes value?</label> + <label>Quotes as part of an attribute value?</label> <para>Single and double quote are used to delimit an attribute value. May quotes appear themselves as part of an at tribute's - value, e.g. like in a person's name <code>Gary "King" - Mandelson</code>?</para> + value, <abbrev>e.g.</abbrev> like in a person's name <code>Gary + "King" Mandelson</code>?</para> </question> <answer> <para>Attribute values may contain double quotes if the attributes - value is enclosed in single quotes and vice versa. As a limitation - the value of an an attribute may not contain single quotes and - double quotes at the same time:</para> + value is enclosed in single quotes and vice versa. Thus an + attributes value may not contain single and double quotes at the + same time:</para> <informalfigure xml:id="exampleSingleDoubleQuotes"> <para>Quotes as part of attribute values.</para> <programlisting language="xml"><?xml version="1.0" encoding="UTF-8"?> <test> - <person name='Gary "King" Mandelson'/> <!-- o.k. --> - <person name="Gary 'King' Mandelson"/> <!-- o.k. --> - <person name="Gary 'King 'S.' "Mandelson"'/> <!-- oops! --> + <person name='Gary "King" Mandelson'/> <!-- o.k.: Double quotes inside single quotes. --> + <person name="Gary 'King' Mandelson"/> <!-- o.k.: Single quotes inside double quotes. --> + <person name="Gary 'King 'S.' "Mandelson"'/> <!-- Oops: Just either of! --> </test></programlisting> </informalfigure> </answer> @@ -477,44 +665,246 @@ terminated by the matching end-tag "</to>". parsing error</computeroutput> </qandadiv> </qandaset> - <para>Some constraints being imposed on XML documents by the standard - defined so far may be summarized as:</para> + <para>Some constraints being imposed on XML documents are:</para> - <itemizedlist> - <listitem> - <para>A XML documents requires to have exactly one top level - element.</para> - </listitem> + <figure xml:id="sda1_xml_fig_wellformedConstraints"> + <title>Important well-formedness constraints</title> - <listitem> - <para>Elements have to be properly nested. An element must not be - closed if an <quote>inner</quote> Element is still open.</para> - </listitem> + <itemizedlist> + <listitem> + <para><link linkend="sda1_xml_fig_basicStructure">Exactly one root + element.</link></para> + </listitem> - <listitem> - <para>Attribute names within a given Element must be unique.</para> - </listitem> + <listitem> + <para><link linkend="sda1_xml_fig_basicStructure">Proper nesting of + elements</link>.</para> + </listitem> - <listitem> - <para>Attribute values <emphasis>must</emphasis> be quoted - correctly.</para> - </listitem> - </itemizedlist> + <listitem> + <para><link linkend="sda1_xml_fig_uniqueAttributeName">Unique + attribute names within a given Element</link>.</para> + </listitem> - <para>The very last rule shows one of several differences to the HTML - Standard: In HTML a lot of elements don't have to be closed. For example - paragraphs (<tag class="starttag">p</tag>) or images (<tag - class="starttag">img src='foo.gif'</tag>) don't have to be closed - explicitly. This is due to the fact that HTML used to be defined in - accordance with the older <emphasis><emphasis - role="bold">S</emphasis>tandard <emphasis - role="bold">G</emphasis>eneralized <emphasis role="bold">M</emphasis>arkup - <emphasis role="bold">L</emphasis>anguage</emphasis> (SGML) - Standard.</para> + <listitem> + <para><link linkend="sda1_xml_fig_attributeRequiresQuotes">Attribute + values <emphasis>must</emphasis> be quoted correctly</link>.</para> + </listitem> + </itemizedlist> + </figure> <para>These constraints are part of the definition of a <link xlink:href="https://www.w3.org/TR/xml#sec-well-formed">well formed document</link>. The specification imposes additional constraints for a document to be well-formed.</para> + + <figure xml:id="sda1_xml_fig_problemMarkupInterfere"> + <title><xref linkend="glo_XML"/> markup collision I</title> + + <informaltable border="1"> + <tr> + <th>Wrong</th> + + <th>Replacement</th> + </tr> + + <tr> + <td valign="top"><programlisting language="none"><p> if (a <emphasis + role="red"><</emphasis> b) return true;</p></programlisting></td> + + <td valign="top"><programlisting language="none"><p> if (a <emphasis + role="red">&lt;</emphasis> b) return true;</p></programlisting></td> + </tr> + + <tr> + <td valign="top"><itemizedlist> + <listitem> + <para><xref linkend="glo_XML"/> parser assumes opening element + <tag class="starttag">b</tag>.</para> + </listitem> + + <listitem> + <para>Operator <quote><</quote> interferes with <xref + linkend="glo_XML"/> markup.</para> + </listitem> + </itemizedlist></td> + + <td valign="top">Replacement entity <quote>&lt;</quote></td> + </tr> + </informaltable> + </figure> + + <figure xml:id="sda1_xml_fig_problemMarkupEscape"> + <title><xref linkend="glo_XML"/> markup collision II</title> + + <informaltable border="1"> + <colgroup width="41%"/> + + <colgroup width="59%"/> + + <tr> + <th>Error</th> + + <th>Replacement</th> + </tr> + + <tr> + <td valign="top"><programlisting language="none"><p>Smith <emphasis + role="red">&</emphasis> Wesson</p></programlisting></td> + + <td valign="top"><programlisting language="none"><p>Smith <emphasis + role="red">&amp;</emphasis> Wesson</p></programlisting></td> + </tr> + + <tr> + <td valign="top"><programlisting language="none"><img ... alt="a <emphasis + role="red">'</emphasis>good<emphasis role="red">'</emphasis> fellow"/></programlisting></td> + + <td valign="top"><programlisting language="none"><img ... alt="a &quot;good&quot; fellow"/></programlisting></td> + </tr> + + <tr> + <td valign="top"><programlisting language="none"><img ... alt="a <emphasis + role="red">"</emphasis>good<emphasis role="red">"</emphasis> fellow"/></programlisting></td> + + <td valign="top"><programlisting language="none"><img ... alt="a &dquot;good&dquot; fellow"/></programlisting></td> + </tr> + </informaltable> + </figure> + + <figure xml:id="sda1_xml_fig_standardEscapeEntities"> + <title><xref linkend="glo_XML"/> standard replacement entities</title> + + <informaltable border="1"> + <tr> + <th>Character</th> + + <th>Replacement</th> + </tr> + + <tr> + <td valign="top"><</td> + + <td valign="top">&lt;</td> + </tr> + + <tr> + <td valign="top">></td> + + <td valign="top">&gt;</td> + </tr> + + <tr> + <td valign="top">&</td> + + <td valign="top">&amp;</td> + </tr> + + <tr> + <td valign="top">'</td> + + <td valign="top">&quot;</td> + </tr> + + <tr> + <td valign="top">"</td> + + <td valign="top">&dquot;</td> + </tr> + </informaltable> + </figure> + + <figure xml:id="sda1_xml_fig_cdataSection"> + <title>Using CDATA sections</title> + + <informaltable border="0"> + <tr> + <td valign="top"><programlisting language="none"><!-- Avoiding &amp; --> +<h3><emphasis role="red"><![CDATA[</emphasis>HTML & XML<emphasis + role="red">]]></emphasis></h3> + +<!-- Display markup code + »as is« --> +<pre><emphasis role="red"><![CDATA[</emphasis><ul> + <li>One</li> + <li>Two</li> +</ul><emphasis role="red">]]></emphasis></pre></programlisting><para>Hint: + Possibly useful when exporting e.g. <xref linkend="glo_RDBMS"/> data + to <xref linkend="glo_XML"/>.</para></td> + + <td valign="top"><mediaobject> + <imageobject> + <imagedata fileref="Ref/Xml/cdataPre.png"/> + </imageobject> + </mediaobject></td> + </tr> + </informaltable> + </figure> + + <figure xml:id="sda1_xml_fig_cdataSectionReplacementEntities"> + <title>Using replacement entities</title> + + <informaltable border="0"> + <tr> + <td valign="top"><programlisting language="none"><h3>HTML <emphasis + role="red">&amp;</emphasis> XML</h3> + +<pre><emphasis role="red">&lt;</emphasis>ul<emphasis role="red">&gt;</emphasis> + <emphasis role="red">&lt;</emphasis>li<emphasis role="red">&gt;</emphasis>One<emphasis + role="red">&lt;</emphasis>/li<emphasis role="red">&lt;</emphasis> + <emphasis role="red">&lt;</emphasis>li<emphasis role="red">&gt;</emphasis>Two<emphasis + role="red">&lt;</emphasis>/li<emphasis role="red">&gt;</emphasis> +<emphasis role="red">&lt;</emphasis>/ul<emphasis role="red">&gt;</emphasis></pre></programlisting></td> + + <td valign="top"><mediaobject> + <imageobject> + <imagedata fileref="Ref/Xml/cdataPre.png"/> + </imageobject> + </mediaobject></td> + </tr> + </informaltable> + </figure> + + <qandaset defaultlabel="qanda" xml:id="qanda_"> + <title><acronym>CDATA</acronym> usage limitation</title> + + <qandadiv> + <qandaentry> + <question> + <para>State the obvious limitation of <acronym>CDATA</acronym> + sections with respect to representing document content. Hint: Is + there any content you may not be allowed to use?</para> + </question> + + <answer> + <para>The <acronym>CDATA</acronym> termination symbol + <quote><code>]]></code></quote> itself cannot be + represented:</para> + + <programlisting language="none"><h3><emphasis role="red"><![CDATA[</emphasis>A CDATA section is being terminated by »]]>«.<emphasis + role="red">]]></emphasis></h3></programlisting> + + <screen>xmlparse /tmp/pre.xhtml +file:///tmp/pre.xhtml:1:63: fatal error org.xml.sax.SAXParseException; +systemId: file:///tmp/pre.xhtml; lineNumber: 2; columnNumber: 63; +The character sequence "]]>" must not appear in content unless used to +mark the end of a CDATA section.</screen> + + <note> + <para>A <acronym>CDATA</acronym>'s closing terminal is exactly + <quote><code>]]></code></quote> : Using e.g. <quote><code>]] + ></code></quote> containing a space does not cause any + parsing problem.</para> + </note> + </answer> + </qandaentry> + </qandadiv> + </qandaset> + + <figure xml:id="sda1_xml_fig_processingInstruction"> + <title>Processing instruction (PI)</title> + + <programlisting language="none"><?format src="styles.css"?></programlisting> + </figure> </section> </chapter> diff --git a/Doc/Sda1/xmlschema.xml b/Doc/Sda1/xmlschema.xml index 700815dee..1cdfd3656 100644 --- a/Doc/Sda1/xmlschema.xml +++ b/Doc/Sda1/xmlschema.xml @@ -11,12 +11,12 @@ xmlns:db="http://docbook.org/ns/docbook"> <title>Beyond well- formedness</title> - <section xml:id="sda1BeyondWellformedReading"> - <title>Suggested readings</title> + <figure xml:id="sda1_xmlschema_fig_recommendedReading"> + <title>Recommended reading</title> <itemizedlist> <listitem> - <para><xref linkend="bib_fawcett2012"/></para> + <para><xref linkend="bib_Walmsley02"/>.</para> </listitem> <listitem> @@ -25,18 +25,76 @@ Tutorial</link></para> </listitem> </itemizedlist> - </section> + </figure> - <section xml:id="motivationSchema"> + <figure xml:id="sda1_xmlschema_fig_motivation"> <title>Motivation</title> - <para>So far we are able to create XML documents containing hierarchically - structured data. We may nest elements and thus create tree structures of - arbitrary depth. The only restrictions being imposed by the XML standard - are the constraints of well - formedness.</para> + <informaltable border="1"> + <tr> + <th>Well-formed</th> + + <th>Valid (Grammar)</th> + </tr> + + <tr> + <td valign="top"><itemizedlist> + <listitem> + <para>Arbitrary element / attribute names.</para> + </listitem> + + <listitem> + <para>Arbitrary element nesting.</para> + </listitem> + + <listitem> + <para>Arbitrary data types e.g. <code language="xml"><bill + amount="sorry!"/></code>, <code + language="xml"><money>2026/08/11</money></code>.</para> + </listitem> + </itemizedlist></td> + + <td valign="top"><itemizedlist> + <listitem> + <para>Restrict allowed element / attribute names.</para> + </listitem> - <para>For many purposes in software development this is not - sufficient.</para> + <listitem> + <para>Restrict parent / child relations.</para> + </listitem> + + <listitem> + <para>Element / attribute value types based on an extensible + type scheme.</para> + </listitem> + </itemizedlist></td> + </tr> + </informaltable> + </figure> + + <figure xml:id="sda1_xmlschema_fig_xmlGrammarExamples"> + <title><xref linkend="glo_XML"/> grammar examples</title> + + <itemizedlist> + <listitem> + <para>DTDs</para> + + <!-- Add link --> + </listitem> + + <listitem> + <para><link xlink:href="https://www.w3.org/XML/Schema">XML + Schema</link></para> + </listitem> + + <listitem> + <para><link xlink:href="http://www.relaxng.org">RelaxNG</link></para> + </listitem> + </itemizedlist> + </figure> + + <section xml:id="motivationSchema"> + <title>Motivation</title> <para>A company named <productname>Softmail</productname> might implement an email system which uses <link linkend="memoWellAttrib">memo</link> @@ -83,21 +141,6 @@ into their applications (A solution bad programmers are in favour of though...). Various XML standards exist for declarative constraint definitions namely:</para> - - <itemizedlist> - <listitem> - <para>DTDs</para> - </listitem> - - <listitem> - <para><link xlink:href="https://www.w3.org/XML/Schema">XML - Schema</link></para> - </listitem> - - <listitem> - <para><link xlink:href="http://www.relaxng.org">RelaxNG</link></para> - </listitem> - </itemizedlist> </section> <section xml:id="dtdBasic"> @@ -107,11 +150,11 @@ <title>Structural descriptions for documents</title> <para>As an example we choose documents of type - <emphasis>memo</emphasis> as a starting point. We extend example - slightly:</para> + <emphasis>memo</emphasis> as a starting point. We extend our <tag + class="starttag">memo</tag> example:</para> <figure xml:id="memoWellAttribEmailPara"> - <title>memo having email and paragraphs.</title> + <title>memo having date, priority and paragraphs.</title> <programlisting language="xml"><memo date="2006-10-02" priority="high"> <from>helen@fast.net</from> @@ -193,7 +236,7 @@ <tr> <td valign="top"><itemizedlist> <listitem> - <para>A sender.</para> + <para>Exactly one sender.</para> </listitem> <listitem> @@ -215,10 +258,10 @@ </listitem> <listitem> - <para>Optional priority - <emphasis>indication</emphasis></para> + <para>Optional priority <emphasis>indication + </emphasis></para> - <para>Allowed values : {low|medium|high}</para> + <para>of value {low|medium|high}.</para> </listitem> </itemizedlist></td> </tr> @@ -236,7 +279,7 @@ </question> <answer> - <para>We need three entities:</para> + <para>We need at least three entities:</para> <glosslist> <glossentry> @@ -257,8 +300,8 @@ relationship: Each recipient belongs to exactly one memo and each memo must have at least one recipient.</para> - <para>We may decide than recipient order does not matter - when dealing with E-mails.</para> + <para>Since the order of recipient does not matter we + choose them set based.</para> </glossdef> </glossentry> @@ -270,11 +313,13 @@ relationship.</para> <para>Since there is no natural order for set based - relational databases paragraphs need an explicit order - attribute: This attribute allows us to Keep track of our - paragraph's order, With respect to <xref - linkend="sda1_fig_memoWellAttribFaulty"/> we might - see:</para> + relational databases each paragraph needs an explicit + ordering attribute: This attribute allows for keeping + track of paragraph's order. Note this being different from + the XML version providing natural ordering.</para> + + <para>With respect to <xref + linkend="sda1_fig_memoWellAttribFaulty"/> we have:</para> <informaltable border="1"> <colgroup width="19%"/> @@ -310,11 +355,14 @@ </imageobject> </mediaobject> - <para>Thus we end up with:</para> + <para>Physical tables reflecting our Model:</para> <programlisting language="sql">CREATE TABLE Memo ( id INT PRIMARY KEY, - `from` CHAR(20) NOT NULL + `from` CHAR(20) NOT NULL, + subject CHAR(40), + `priority` CHAR(6), + CHECK (`priority` IN ('low', 'medium', 'high')) ); CREATE TABLE `To` ( @@ -331,12 +379,32 @@ CREATE TABLE Para ( PRIMARY KEY (item, memo), FOREIGN KEY (memo) REFERENCES Memo(id) );</programlisting> + + <note> + <para>A more elaborate schema might define a separate <code + language="sql">Addressbook</code> table providing:</para> + + <itemizedlist> + <listitem> + <para>A 0:n by 1:1 relation <quote>sender</quote> + connecting <code language="sql">Memo</code> and <code + language="sql">Addressbook</code>.</para> + </listitem> + + <listitem> + <para>A 0:m by 1:n relation <quote>recipient</quote> + connecting <code language="sql">Memo</code> and <code + language="sql">Addressbook</code>.</para> + </listitem> + </itemizedlist> + </note> </answer> </qandaentry> </qandadiv> </qandaset> - <para>In addition we are interested in a clean vocabulary:</para> + <para>With respect to an <xref linkend="glo_XML"/> representation we are + interested in a clean vocabulary:</para> <figure xml:id="figure_memo_vocabulary"> <title>Desired vocabulary</title> @@ -359,13 +427,13 @@ CREATE TABLE Para ( <listitem> <para><tag class="starttag">to</tag></para> </listitem> + </itemizedlist></td> + <td valign="top"><itemizedlist> <listitem> <para><tag class="starttag">subject</tag></para> </listitem> - </itemizedlist></td> - <td valign="top"><itemizedlist> <listitem> <para><tag class="starttag">content</tag></para> </listitem> @@ -379,8 +447,8 @@ CREATE TABLE Para ( </figure> <para>All these fields contain ordinary text to be filled in by a user - and shall appear exactly in the defined order. For simplicity we do yet - not care about data and email address syntax rules being described in + and shall appear exactly in the defined order. For simplicity we do not + yet care about data and email address syntax rules being described in <link xlink:href="https://www.w3.org/Protocols/rfc822">RFC based address schemes</link>. We will see how the <emphasis>constraints</emphasis> mentioned above can be modelled in XML by an extension to the concept of @@ -392,14 +460,14 @@ CREATE TABLE Para ( <para>We now introduce an example of an XML schema. It allows for the specification of additional constraints to both element nodes and their - attributes. Our set of <link linkend="figure_memo_informalconstraints" - revision="">informal constraints</link> on memo documents may be - expressed as:</para> + attributes. We start by defining the top level memo element implementing + our set of <link linkend="figure_memo_informalconstraints" + revision="">informal constraints</link>:</para> - <figure xml:id="figure_memo_dtd"> - <title>A memo schema.</title> + <figure xml:id="sda1_xmlschema_fig_memoSchemaMemo"> + <title>Top level <tag class="starttag">memo</tag></title> - <programlisting language="xml"><xs:element name="memo"> <co + <programlisting><xs:element name="memo"> <co linkends="sda1_callout_memoXsdSchema-1" xml:id="sda1_callout_memoXsdSchema-1-co"/> <<link xlink:href="https://www.w3.org/TR/xmlschema11-1/#sec-cvc-complex-type">xs:complexType</link>> @@ -430,116 +498,172 @@ CREATE TABLE Para ( linkends="sda1_callout_memoXsdSchema-8" xml:id="sda1_callout_memoXsdSchema-8-co"/> </xs:complexType> -</xs:element> - -<xs:element name="content"> <co linkends="sda1_callout_memoXsdSchema-9" - xml:id="sda1_callout_memoXsdSchema-9-co"/> +</xs:element></programlisting> + + <calloutlist> + <callout arearefs="sda1_callout_memoXsdSchema-1-co" + xml:id="sda1_callout_memoXsdSchema-1"> + <para>Defining the top level element <tag + class="starttag">memo</tag>.</para> + </callout> + + <callout arearefs="sda1_callout_memoXsdSchema-2-co" + xml:id="sda1_callout_memoXsdSchema-2"> + <para>A <tag class="starttag">memo</tag> consists of a sequence + of:</para> + + <orderedlist> + <listitem> + <para>Exactly one <tag class="starttag">from</tag> + element</para> + </listitem> + + <listitem> + <para>One or more <tag class="starttag">to</tag> + elements.</para> + </listitem> + + <listitem> + <para>Exactly one <tag class="starttag">subject</tag> + element</para> + </listitem> + + <listitem> + <para>Exactly one <tag class="starttag">content</tag> + element.</para> + </listitem> + </orderedlist> + </callout> + + <callout arearefs="sda1_callout_memoXsdSchema-3-co" + xml:id="sda1_callout_memoXsdSchema-3"> + <para>A <tag class="starttag">from</tag> element representing the + sender's email contains ordinary text.</para> + </callout> + + <callout arearefs="sda1_callout_memoXsdSchema-4-co" + xml:id="sda1_callout_memoXsdSchema-4"> + <para>One or more <tag class="starttag">to</tag> elements + representing the recipient's email addresses containing ordinary + text.</para> + </callout> + + <callout arearefs="sda1_callout_memoXsdSchema-5-co" + xml:id="sda1_callout_memoXsdSchema-5"> + <para>One <tag class="starttag">subject</tag> element containing + ordinary text.</para> + </callout> + + <callout arearefs="sda1_callout_memoXsdSchema-6-co" + xml:id="sda1_callout_memoXsdSchema-6"> + <para>One <tag class="starttag">content</tag> element consisting + of at least one <tag class="starttag">para</tag> being defined at + XXXX in YYYY.</para> + </callout> + + <callout arearefs="sda1_callout_memoXsdSchema-7-co" + xml:id="sda1_callout_memoXsdSchema-7"> + <para>A <tag class="element"><tag + class="starttag">memo</tag></tag> has got a required attribute + <varname>date</varname> of type <link + xlink:href="https://www.w3.org/TR/xmlschema11-2/#date">xs:date</link>.</para> + </callout> + + <callout arearefs="sda1_callout_memoXsdSchema-8-co" + xml:id="sda1_callout_memoXsdSchema-8"> + <para>A <tag class="starttag">memo</tag> has got an optional + attribute <varname>priority</varname>. Its type is being defined + by XXXX in YYYY.</para> + </callout> + </calloutlist> + </figure> + + <figure xml:id="sda1_xmlschema_fig_memoSchemaContent"> + <title>Defining <tag class="starttag">content</tag></title> + + <programlisting language="xml"><xs:element name="content"> <co + linkends="sda1_xmlschema_fig_memoSchemaContent-1" + xml:id="sda1_xmlschema_fig_memoSchemaContent-1-co"/> <<link xlink:href="https://www.w3.org/TR/xmlschema11-1/#sec-cvc-complex-type">xs:complexType</link>> <xs:sequence> <xs:element name="para" type="<link - xlink:href="https://www.w3.org/TR/xmlschema11-2/#string">xs:string</link>" minOccurs="1" maxOccurs="unbounded"/> + xlink:href="https://www.w3.org/TR/xmlschema11-2/#string">xs:string</link>" <co + linkends="sda1_xmlschema_fig_memoSchemaContent-2" + xml:id="sda1_xmlschema_fig_memoSchemaContent-2-co"/> + minOccurs="1" <co linkends="sda1_xmlschema_fig_memoSchemaContent-3" + xml:id="sda1_xmlschema_fig_memoSchemaContent-3-co"/> maxOccurs="unbounded" <co + linkends="sda1_xmlschema_fig_memoSchemaContent-4" + xml:id="sda1_xmlschema_fig_memoSchemaContent-4-co"/> /> </xs:sequence> </xs:complexType> -</xs:element> - -<<link xlink:href="https://www.w3.org/TR/xmlschema11-1/#Simple_Type_Definitions">xs:simpleType</link> name="Priority"> <co - linkends="sda1_callout_memoXsdSchema-10" - xml:id="sda1_callout_memoXsdSchema-10-co"/> - <<link xlink:href="https://www.w3.org/TR/xmlschema11-1/#Simple_Type_Definitions">xs:restriction</link> base="<link - xlink:href="https://www.w3.org/TR/xmlschema11-2/#string">xs:string</link>"> - <xs:enumeration value="low"/> - <xs:enumeration value="medium"/> - <xs:enumeration value="high"/> - </xs:restriction> -</xs:simpleType></programlisting> +</xs:element></programlisting> </figure> <calloutlist> - <callout arearefs="sda1_callout_memoXsdSchema-1-co" - xml:id="sda1_callout_memoXsdSchema-1"> - <para>Defining the top level element <tag - class="starttag">memo</tag>.</para> + <callout arearefs="sda1_xmlschema_fig_memoSchemaContent-1-co" + xml:id="sda1_xmlschema_fig_memoSchemaContent-1"> + <para>Defining element <tag class="starttag">content</tag> .</para> </callout> - <callout arearefs="sda1_callout_memoXsdSchema-2-co" - xml:id="sda1_callout_memoXsdSchema-2"> - <para>A <tag class="starttag">memo</tag> consists of a sequence - of:</para> - - <orderedlist> - <listitem> - <para>Exactly one <tag class="starttag">from</tag> - element</para> - </listitem> - - <listitem> - <para>One or more <tag class="starttag">to</tag> - elements.</para> - </listitem> - - <listitem> - <para>Exactly one <tag class="starttag">subject</tag> - element</para> - </listitem> - - <listitem> - <para>Exactly one <tag class="starttag">content</tag> - element.</para> - </listitem> - </orderedlist> + <callout arearefs="sda1_xmlschema_fig_memoSchemaContent-2-co" + xml:id="sda1_xmlschema_fig_memoSchemaContent-2"> + <para><tag class="starttag">content</tag> is being composed of <tag + class="starttag">para</tag> elements.</para> </callout> - <callout arearefs="sda1_callout_memoXsdSchema-3-co" - xml:id="sda1_callout_memoXsdSchema-3"> - <para>A <tag class="starttag">from</tag> element representing the - sender's email contains ordinary text.</para> + <callout arearefs="sda1_xmlschema_fig_memoSchemaContent-3-co" + xml:id="sda1_xmlschema_fig_memoSchemaContent-3"> + <para><tag class="starttag">content</tag> contains at least one <tag + class="starttag">para</tag> element.</para> </callout> - <callout arearefs="sda1_callout_memoXsdSchema-4-co" - xml:id="sda1_callout_memoXsdSchema-4"> - <para>One or more <tag class="starttag">to</tag> elements - representing the recipient's email addresses containing ordinary - text.</para> - </callout> + <callout arearefs="sda1_xmlschema_fig_memoSchemaContent-4-co" + xml:id="sda1_xmlschema_fig_memoSchemaContent-4"> + <para>The number of <tag class="starttag">para</tag> children of + <tag class="starttag">content</tag> is unlimited. Combined with the + preceding rule the <xref linkend="glo_EBNF"/> expression would + be:</para> - <callout arearefs="sda1_callout_memoXsdSchema-5-co" - xml:id="sda1_callout_memoXsdSchema-5"> - <para>One <tag class="starttag">subject</tag> element containing - ordinary text.</para> + <programlisting language="ebnf">content ::= para+</programlisting> </callout> + </calloutlist> - <callout arearefs="sda1_callout_memoXsdSchema-6-co" - xml:id="sda1_callout_memoXsdSchema-6"> - <para>One <tag class="starttag">content</tag> element consisting of - at least one <tag class="starttag">para</tag> being defined at - <coref linkend="sda1_callout_memoXsdSchema-9-co"/>.</para> - </callout> + <figure xml:id="sda1_xmlschema_fig_memoSchemaPriority"> + <title>Data type <code>Priority</code></title> - <callout arearefs="sda1_callout_memoXsdSchema-7-co" - xml:id="sda1_callout_memoXsdSchema-7"> - <para>A <tag class="element"><tag class="starttag">memo</tag></tag> - has got a required attribute <varname>date</varname> of type <link - xlink:href="https://www.w3.org/TR/xmlschema11-2/#date">xs:date</link>.</para> - </callout> + <programlisting language="xml"><<link + xlink:href="https://www.w3.org/TR/xmlschema11-1/#Simple_Type_Definitions">xs:simpleType</link> name="Priority"> <co + linkends="sda1_xmlschema_fig_memoSchemaPriority-1" + xml:id="sda1_xmlschema_fig_memoSchemaPriority-1-co"/> + <<link xlink:href="https://www.w3.org/TR/xmlschema11-1/#Simple_Type_Definitions">xs:restriction</link> base="<link + xlink:href="https://www.w3.org/TR/xmlschema11-2/#string">xs:string</link>"> <co + linkends="sda1_xmlschema_fig_memoSchemaPriority-2" + xml:id="sda1_xmlschema_fig_memoSchemaPriority-2-co"/> + <xs:enumeration value="low"/> <co + linkends="sda1_xmlschema_fig_memoSchemaPriority-3" + xml:id="sda1_xmlschema_fig_memoSchemaPriority-3-co"/> + <xs:enumeration value="medium"/> + <xs:enumeration value="high"/> + </xs:restriction> +</xs:simpleType></programlisting> + </figure> - <callout arearefs="sda1_callout_memoXsdSchema-8-co" - xml:id="sda1_callout_memoXsdSchema-8"> - <para>A <tag class="starttag">memo</tag> has got an optional - attribute <varname>priority</varname>. Its type is being defined by - <coref linkend="sda1_callout_memoXsdSchema-10-co"/>.</para> + <calloutlist> + <callout arearefs="sda1_xmlschema_fig_memoSchemaPriority-1-co" + xml:id="sda1_xmlschema_fig_memoSchemaPriority-1"> + <para>Defining a <emphasis>named</emphasis> type to be used both for + element or attribute content definitions.</para> </callout> - <callout arearefs="sda1_callout_memoXsdSchema-9-co" - xml:id="sda1_callout_memoXsdSchema-9"> - <para><tag class="starttag">content</tag> being defined as a - sequence of at least one <tag class="starttag">para</tag> - element.</para> + <callout arearefs="sda1_xmlschema_fig_memoSchemaPriority-2-co" + xml:id="sda1_xmlschema_fig_memoSchemaPriority-2"> + <para>Starting from base type string.</para> </callout> - <callout arearefs="sda1_callout_memoXsdSchema-10-co" - xml:id="sda1_callout_memoXsdSchema-10"> - <para>Defining a type allowing for exactly three string values - (low|medium|high).</para> + <callout arearefs="sda1_xmlschema_fig_memoSchemaPriority-3-co" + xml:id="sda1_xmlschema_fig_memoSchemaPriority-3"> + <para>Restricting arbitrary string content to + <code>(low|medium|high)</code>.</para> </callout> </calloutlist> -- GitLab