/
db2xhtml.xhtml
6584 lines (6578 loc) · 346 KB
/
db2xhtml.xhtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
SYSTEM "about:legacy-compat">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XML Design Patterns</title>
<link rel="stylesheet" type="text/css" href="index.css"/>
<meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"/>
</head>
<body>
<div class="book" title="XML Design Patterns" id="d55e2">
<div class="titlepage">
<div>
<div>
<h1 class="title">XML Design Patterns</h1>
</div>
<div>
<div class="author">
<h3 class="author">
<span class="firstname">Toivo</span>
<span class="surname">Lainevool</span>
</h3>
<code class="email"><<a class="email" href="mailto:info@xmlpatterns.com">info@xmlpatterns.com</a>></code>
</div>
</div>
</div>
<hr/>
</div>
<nav>
<dl class="toc">
<dt>Table of Contents</dt>
<dd>
<ol class="book">
<li class="part">
<a href="#d55e33">Home</a>
<ol>
<li class="article">
<a href="#d55e36">XML Design Patterns</a>
</li>
</ol>
</li>
<li class="part">
<a href="#d55e59">Introduction</a>
<ol>
<li class="article">
<a href="#d55e62">Introductory Material</a>
</li>
<li class="article">
<a href="#d55e67">Pattern</a>
</li>
<li class="article">
<a href="#d55e83">History</a>
</li>
<li class="article">
<a href="#d55e96">Pattern Forms</a>
<ol>
<li class="glossary">
<a href="#d55e114">Glossary</a>
</li>
</ol>
</li>
<li class="article">
<a href="#d55e175">Good Design</a>
</li>
<li class="article">
<a href="#d55e222">Journey</a>
</li>
</ol>
</li>
<li class="part">
<a href="#d55e243">Patterns</a>
<ol>
<li class="chapter">
<a href="#d55e247">Document Roots</a>
<ol>
<li class="section">
<a href="#d55e255">Multi Root Document Types</a>
</li>
<li class="section">
<a href="#d55e314">Multiple Document Types</a>
</li>
<li class="section">
<a href="#d55e376">Universal Root</a>
</li>
</ol>
</li>
<li class="chapter">
<a href="#d55e437">Metadata</a>
<ol>
<li class="section">
<a href="#d55e445">Head-Body</a>
</li>
<li class="section">
<a href="#d55e525">Metadata First</a>
</li>
<li class="section">
<a href="#d55e584">Metadata in Separate Document</a>
</li>
<li class="section">
<a href="#d55e659">Separate Metadata and Data</a>
</li>
</ol>
</li>
<li class="chapter">
<a href="#d55e724">Abstraction</a>
<ol>
<li class="section">
<a href="#d55e732">Choice Reducing Container</a>
</li>
<li class="section">
<a href="#d55e801">Collection Element</a>
</li>
<li class="section">
<a href="#d55e871">Container Element</a>
</li>
<li class="section">
<a href="#d55e942">Domain Element</a>
</li>
<li class="section">
<a href="#d55e998">Optional Container Element</a>
</li>
</ol>
</li>
<li class="chapter">
<a href="#d55e1067">Organization</a>
<ol>
<li class="section">
<a href="#d55e1075">Declare Before First Use</a>
</li>
<li class="section">
<a href="#d55e1129">Envelope</a>
</li>
<li class="section">
<a href="#d55e1215">Flyweight</a>
</li>
<li class="section">
<a href="#d55e1316">Marketplace</a>
</li>
<li class="section">
<a href="#d55e1377">Referenced Note</a>
</li>
</ol>
</li>
<li class="chapter">
<a href="#d55e1454">Flexibility</a>
<ol>
<li class="section">
<a href="#d55e1462">Catch-All Element</a>
</li>
<li class="section">
<a href="#d55e1534">Extensible Content Model</a>
</li>
<li class="section">
<a href="#d55e1642">Generic Element</a>
</li>
<li class="section">
<a href="#d55e1700">Role Attribute</a>
</li>
</ol>
</li>
<li class="chapter">
<a href="#d55e1765">Consistency</a>
<ol>
<li class="section">
<a href="#d55e1773">Common Attributes</a>
</li>
<li class="section">
<a href="#d55e1859">Consistent Element Set</a>
</li>
<li class="section">
<a href="#d55e1921">Parallel Design</a>
</li>
</ol>
</li>
<li class="chapter">
<a href="#d55e1983">Miscellaneous</a>
<ol>
<li class="section">
<a href="#d55e1991">Content Type Label</a>
</li>
<li class="section">
<a href="#d55e2057">Reuse Document Types</a>
</li>
<li class="section">
<a href="#d55e2140">Short Understandable Names</a>
</li>
<li class="section">
<a href="#d55e2194">Use XML</a>
</li>
</ol>
</li>
</ol>
</li>
<li class="part">
<a href="#d55e2323">Books</a>
<ol>
<li class="chapter">
<a href="#d55e2326">XML Structure</a>
</li>
<li class="chapter">
<a href="#d55e2331">Patterns</a>
</li>
<li class="chapter">
<a href="#d55e2336">Software Design Patterns</a>
</li>
</ol>
</li>
<li class="part">
<a href="#d55e2344">Links</a>
<ol>
<li class="article">
<a href="#d55e2347">Links</a>
<ol>
<li class="section">
<a href="#d55e2352">XML Design Patterns</a>
</li>
<li class="section">
<a href="#d55e2406">Other Patterns</a>
</li>
<li class="section">
<a href="#d55e2430">XML Design</a>
</li>
<li class="section">
<a href="#d55e2448">Schema Repositories</a>
</li>
</ol>
</li>
<li class="article">
<a href="#d55e2472">Other XML Links</a>
<ol>
<li class="section">
<a href="#d55e2477">General XML</a>
</li>
<li class="section">
<a href="#d55e2507">XSLT</a>
</li>
</ol>
</li>
</ol>
</li>
<li class="article">
<a href="#d55e2532">About</a>
<ol>
<li class="section">
<a href="#d55e2537">Contacts</a>
</li>
<li class="section">
<a href="#d55e2552">What They Are Saying About Us</a>
</li>
<li class="section">
<a href="#d55e2561">Privacy Statement</a>
</li>
<li class="section">
<a href="#d55e2568">Log Files</a>
</li>
<li class="section">
<a href="#d55e2573">Cookies and Web Beacons</a>
</li>
<li class="section">
<a href="#d55e2580">DoubleClick DART cookies</a>
</li>
</ol>
</li>
</ol>
</dd>
</dl>
</nav>
<nav class="list-of-examples">
<p>
<strong>List of Examples</strong>
</p>
<ol>
<li>1.1 <a href="#d55e346">Employees.dtd:</a>
</li>
<li>1.2 <a href="#d55e351">HoursWorked.dtd:</a>
</li>
<li>2.1 <a href="#d55e620">File: <code class="filename">author-info.xml</code>
</a>
</li>
<li>2.2 <a href="#d55e627">File: <code class="filename">document.xml</code>
</a>
</li>
<li>3.1 <a href="#d55e762">Example</a>
</li>
<li>3.2 <a href="#d55e769">Example</a>
</li>
<li>3.3 <a href="#d55e831">Simple Collection Element</a>
</li>
<li>3.4 <a href="#d55e836">Container Element With Metadata</a>
</li>
<li>3.5 <a href="#d55e841">Multiple Categories of Same Collection</a>
</li>
<li>4.1 <a href="#d55e1267">XML Entities</a>
</li>
<li>4.2 <a href="#d55e1274">XLink</a>
</li>
<li>4.3 <a href="#d55e1281">ID and IDREF</a>
</li>
<li>5.1 <a href="#d55e1494">Example</a>
</li>
<li>5.2 <a href="#d55e1501">Example</a>
</li>
<li>5.3 <a href="#d55e1564">Using DTDs</a>
</li>
<li>5.4 <a href="#d55e1571">purchase_order.dtd</a>
</li>
<li>5.5 <a href="#d55e1580">mydoc.xml</a>
</li>
<li>5.6 <a href="#d55e1585">Using XML Schemas</a>
</li>
<li>5.7 <a href="#d55e1590">PurchaseOrder.xsd</a>
</li>
<li>5.8 <a href="#d55e1597">US-Address.xsd</a>
</li>
<li>5.9 <a href="#d55e1604">mydoc.xml</a>
</li>
<li>6.1 <a href="#d55e1803">Common Attributes in DTDs</a>
</li>
<li>6.2 <a href="#d55e1813">Common Attributes in XML Schemas</a>
</li>
<li>6.3 <a href="#d55e1889">Example</a>
</li>
<li>6.4 <a href="#d55e1896">Example</a>
</li>
</ol>
</nav>
<div class="part" title="Part I. Home" id="d55e33">
<div class="titlepage">
<div>
<div>
<h1 class="title">Part I. Home</h1>
</div>
</div>
</div>
<nav>
<dl class="toc">
<dt>Table of Contents</dt>
<dd>
<ol class="part">
<li class="article">
<a href="#d55e36">XML Design Patterns</a>
</li>
</ol>
</dd>
</dl>
</nav>
<div class="article" title="XML Design Patterns" id="d55e36">
<header class="titlepage">
<div>
<h2 class="title">XML Design Patterns</h2>
</div>
</header>
<p>Welcome to XMLPatterns.com, the site about designing good XML structure with patterns.</p>
<p>There are 28 <a class="link" href="patterns/patterns.part.xml">XML Design Patterns</a>. If you are new to software design patterns, a good place to start is the <a class="link" href="intro/introduction.part.xml">Introductory Material</a>.</p>
<p>In the years since XMLPatterns.com was launched, XML has moved from being a relatively obscure technology to being a part of the everyday technologies that software developers use. Since XML design patterns are an excellent way to pass knowledge on from the experts to XML newcomers, they have become more important then ever. Designing good XML structure using DTDs, W3C XML Schema or RelaxNG does not always come easily, and hopefully the patterns on this site will be able to help out.</p>
<p>Please feel free to <a class="link" href="mailto:info@xmlpatterns.com">email</a> feedback about this site.</p>
<p>Thanks for visiting!</p>
</div>
</div>
<div class="part" title="Part II. Introduction" id="d55e59">
<div class="titlepage">
<div>
<div>
<h1 class="title">Part II. Introduction</h1>
</div>
</div>
</div>
<nav>
<dl class="toc">
<dt>Table of Contents</dt>
<dd>
<ol class="part">
<li class="article">
<a href="#d55e62">Introductory Material</a>
</li>
<li class="article">
<a href="#d55e67">Pattern</a>
</li>
<li class="article">
<a href="#d55e83">History</a>
</li>
<li class="article">
<a href="#d55e96">Pattern Forms</a>
<ol>
<li class="glossary">
<a href="#d55e114">Glossary</a>
</li>
</ol>
</li>
<li class="article">
<a href="#d55e175">Good Design</a>
</li>
<li class="article">
<a href="#d55e222">Journey</a>
</li>
</ol>
</dd>
</dl>
</nav>
<div class="article" title="Introductory Material" id="d55e62">
<header class="titlepage">
<div>
<h2 class="title">Introductory Material</h2>
</div>
</header>
<p>Follow the links below for some background material that might be useful as an introduction into the world of XML Design Patterns.</p>
</div>
<div class="article" title="Pattern" id="d55e67">
<header class="titlepage">
<div>
<h2 class="title">Pattern</h2>
</div>
</header>
<p>The originator of the pattern, Christopher Alexander, defines a pattern as “a three part rule, which expresses a relation between a certain context, a problem, and a solution” [<a class="link" href="books/books.part.xml#0195024028">Alex79</a>].</p>
<p>A pattern can be thought of as a tried and true way to deal with a problem that appears over and over again. People who are experienced in a particular field of knowledge will have internalized certain solutions to these problems. They recognize a problem to be solved and know which solution to apply in the particular situation. The idea of a pattern is to be able to describe this internalized expert knowledge and to state the problem, context and solution, so that less experienced people can benefit from this knowledge.</p>
<p>Another benefit of having formal, written patterns is that these previously internalized concepts get named. It is much easier to discuss and think about something once it has been named. Discussing concepts that are unnamed is difficult.</p>
<p>A pattern language brings together a number of these patterns in one particular field. It is an attempt to reproduce all of the knowledge needed to create quality items in that field. A pattern language for buildings gives one the power to create building which people will want to live in, a pattern language for software design gives the power to create software which is usable and maintainable. Just as spoken language give people the ability to create an infinite variety of sentences, pattern languages give people the power to create an infinite variety of document types. We just need to create a common vocabulary so we can make useful sentences.</p>
<p>This site is an attempt to start to produce an XML Structural Pattern language. This pattern language gives one the power to create document types for XML, which describe documents that are useful, maintainable, easy to author, and easy to process. This pattern language will be most useful if it is shared across the whole XML community. Because of this, your feedback into this process is very important.</p>
</div>
<div class="article" title="History" id="d55e83">
<header class="titlepage">
<div>
<h2 class="title">History</h2>
</div>
</header>
<p>The concept of patterns was originated by Christopher Alexander. Alexander was an architect. He used patterns to design building and towns. His patterns deal with subjects such as entry ways, gardens and roadways. In the late 1980s people started applying his concept to object oriented software design. The first to do so were Ward Cunningham and Kent Beck, who in 1987 wrote a paper entitled "<a class="link" href="http://c2.com/doc/oopsla87.html">Using Pattern Languages for Object-Oriented Programs</a>", which described five patterns that discussed problems in designing Smalltalk windows.</p>
<p>The object oriented community quickly recognized the power of patterns and started writing patterns that appeared in articles, workshops and books. The breakthrough work was the "<a class="link" href="books/books.part.xml#0201633612">Design Patterns</a>" book, which brought wide scale acceptance of patterns to the object-oriented world. Work has also been done in the areas of analysis patterns, process patterns, and organizational patterns. This site is an attempt to apply the concept of patterns to XML Structural Design.</p>
</div>
<div class="article" title="Pattern Forms" id="d55e96">
<header class="titlepage">
<div>
<h2 class="title">Pattern Forms</h2>
</div>
</header>
<nav>
<dl class="toc">
<dt>Table of Contents</dt>
<dd>
<ol class="article">
<li class="glossary">
<a href="#d55e114">Glossary</a>
</li>
</ol>
</dd>
</dl>
</nav>
<p>There are many different ways to write patterns. Different authors have different way of organizing the ideas presented. Alexander's original patterns were presented in a fairly informal, narrative style. The patterns presented in "<a class="link" href="books/books.part.xml#0201633612">Design Patterns</a>" book were much more fine grained, decomposing each pattern into many sections. The structure used depends on several factors. Each author has his or own preferences. Different subject matters may influence the structure. For example more technical subject areas can call for patterns with more structure. Different audiences may call for different structures as well, novice readers may prefer a more prosy style, while more experienced readers may prefer a more structured approach. The form chosen for this site is a middle of the road one, not as prosy as Alexander's patterns in <a class="link" href="books/books.part.xml#0195019199">A Pattern Language</a>, yet not as structured as "<a class="link" href="books/books.part.xml#0201633612">Design Patterns</a>" book either.</p>
<p>What matters is that there is a consistent structure so patterns are easier to understand and compare.</p>
<p>Most people would agree that there must be at least five elements in every pattern: a name; a problem description; the context of the problem; the solution; and the rational for the solution. This web site uses the following sections for each pattern:</p>
<div class="glossary" title="Glossary" id="d55e114">
<div class="titlepage">
<div>
<div>
<h2 class="title">Glossary</h2>
</div>
</div>
</div>
<dl>
<dt>
<a id="d55e121"/>Abstract</dt>
<dd>
<p>A brief description of the pattern. No more than a few sentences.</p>
</dd>
<dt>
<a id="d55e133"/>Context</dt>
<dd>
<p>The context that the problem appears in. Some problems only arise in certain contexts. Different contexts could require different solutions, leading to different patterns.</p>
</dd>
<dt>
<a id="d55e157"/>Discussion</dt>
<dd>
<p>Includes a rationale for the pattern. Explains why this solution works, and possibly why the solution might not work in certain contexts.</p>
</dd>
<dt>
<a id="d55e151"/>Examples</dt>
<dd>
<p>Sample(s) of how to apply the pattern. Usually a simple, made-up demonstration.</p>
</dd>
<dt>
<a id="d55e139"/>Forces</dt>
<dd>
<p>A description of the elements that influence the problem. These are issues that the effect the solution, and that the solution will try to fix.</p>
</dd>
<dt>
<a id="d55e169"/>Known Uses</dt>
<dd>
<p>Describes existing documents where instances of the pattern exist.</p>
</dd>
<dt>
<a id="d55e115"/>Name</dt>
<dd>
<p>The name of the pattern.</p>
</dd>
<dt>
<a id="d55e127"/>Problem</dt>
<dd>
<p>A description of the problem to be solved.</p>
</dd>
<dt>
<a id="d55e163"/>Related Patterns</dt>
<dd>
<p>A list of patterns which may be similar to, specializations of, or generalizations of this pattern. Will discuss how similar patterns differ.</p>
</dd>
<dt>
<a id="d55e145"/>Solution</dt>
<dd>
<p>The way to fix the problem.</p>
</dd>
</dl>
</div>
</div>
<div class="article" title="Good Design" id="d55e175">
<header class="titlepage">
<div>
<h2 class="title">Good Design</h2>
</div>
</header>
<p>The purpose of XML Structural Patterns are to help create document types that are designed well. The goal of a design can be thought of a balancing of forces. There are many competing forces that the designer of a document type must deal with simultaneously. In non-trivial problems, it is impossible for all of the forces to be eliminated completely, so compromises must be made.</p>
<p>These are some of the forces that the XML document designer must deal with:</p>
<div class="variablelist">
<dl>
<dt>
<span class="term">Document Size</span>
</dt>
<dd>
<p>It is usually better to have short documents. Longer documents take up more disk space, take longer to process by machines and humans, and take longer to transmit across the network.</p>
</dd>
<dt>
<span class="term">Ease of Authoring</span>
</dt>
<dd>
<p>Documents which are authored by people must be understandable to them. Extremely complex documents will cause authors to make mistakes, waste time, and get frustrated.</p>
</dd>
<dt>
<span class="term">Ease of Processing</span>
</dt>
<dd>
<p>XML documents are ultimately processed by software at some point, and the document structure effects how difficult the processing software will be to write.</p>
</dd>
<dt>
<span class="term">Flexibility</span>
</dt>
<dd>
<p>This is an indication of how the document instances written for a particular document type can differ. Some document types, such as HTML were meant to provide for a huge variety of documents to be written using them. For other systems, for examples, a payroll processing system, very strict rules about how the data is to be presented is needed.</p>
</dd>
<dt>
<span class="term">Consistency</span>
</dt>
<dd>
<p>Consistency is important for documents to be usable. Inconsistencies lead to errors and misunderstandings.</p>
</dd>
<dt>
<span class="term">Amount of Abstraction</span>
</dt>
<dd>
<p>The granularity and types of abstraction used in a document type will vary depending on the context. A date could be marked up as
</p>
<pre class="programlisting">
<Date>12-10-2000</Date>
or
<Date> <Month>Dec</Month> <Day>10</Day> <Year>2000</Year> </Date>.
</pre>
<p>
Which one is more appropriate depends on the situation where it is used.</p>
</dd>
</dl>
</div>
</div>
<div class="article" title="Journey" id="d55e222">
<header class="titlepage">
<div>
<h2 class="title">Journey</h2>
</div>
</header>
<p>This page provides an overview of the patterns on this site. It is written in a more informal, narrative fashion then other indexes, to provide a gentler introduction to the patterns. This description of the patterns should give a good idea of how the different patterns relate, and roughly in what order they will be used.</p>
<p>When creating a system a data representation must be chosen for information, one possibility is to Use XML. After deciding on XML, investigate existing schemas to see if the project can Reuse Document Types.</p>
<p>Once XML has been chosen as a data representation, it must be determined what the root elements are, or if multiple document types should be used. Multiple Document Types can be used to represent a range of different document types, or if documents are related and have some commonalities, a Multi Root Document Types can be used. If multiple transaction types are needed a Universal Root can be used. To separate concerns such as transport of the data from the data itself, an Envelope can be used.</p>
<p>To create structure in a document, element types which represent abstractions are needed. Name these abstractions using Short Understandable Names These can be based on domain concepts and become Domain Element. To add more structure Container Element can be used. When containers of like element types are needed a Collection Element can be used. To make the documents easier to use for authors, abstraction can be added with Choice Reducing Container and Optional Container Element</p>
<p>When creating these abstractions, some metadata will be needed to be placed in the document. Care should be taken to Separate Metadata and Data. This can be done by placing Metadata in Separate Document or by using a Head-Body. When creating the structure, put Metadata First.</p>
<p>It must be decided how to organize these abstractions. When one abstraction references another one, that is when one abstraction uses information that is declared in another one, Declare Before First Use. When the same information needs to be referenced from many places, use a Flyweight. A Referenced Note can be used when an area of text needs to reference an note in another area of the text. The natural way to structure information in XML is using a hierarchical format, however it is sometimes better to use a more graph-like structure using Marketplace.</p>
<p>Sometimes a document designer will not be able to foresee all of the uses of a document type, in that case a Catch-All Element can be used to easily introduce elements from other DTDs. Role Attribute and Extensible Content Model can be used to make a more flexible document type by adding element that can be introduced by the document author.</p>
<p>To make documents easier to use, consistency is important. Common Attributes and Consistent Element Set can be used to provide this consistency.</p>
</div>
</div>
<div class="part" title="Part III. Patterns" id="d55e243">
<div class="titlepage">
<div>
<div>
<h1 class="title">Part III. Patterns</h1>
</div>
</div>
</div>
<nav>
<dl class="toc">
<dt>Table of Contents</dt>
<dd>
<ol class="part">
<li class="chapter">
<a href="#d55e247">Document Roots</a>
<ol>
<li class="section">
<a href="#d55e255">Multi Root Document Types</a>
<ol>
<li class="section">
<a href="#d55e262">Problem</a>
</li>
<li class="section">
<a href="#d55e267">Context</a>
</li>
<li class="section">
<a href="#d55e272">Forces</a>
</li>
<li class="section">
<a href="#d55e277">Solution</a>
</li>
<li class="section">
<a href="#d55e282">Examples</a>
</li>
<li class="section">
<a href="#d55e293">Discussion</a>
</li>
<li class="section">
<a href="#d55e298">Related Patterns</a>
</li>
<li class="section">
<a href="#d55e308">Known Uses</a>
</li>
</ol>
</li>
<li class="section">
<a href="#d55e314">Multiple Document Types</a>
<ol>
<li class="section">
<a href="#d55e321">Problem</a>
</li>
<li class="section">
<a href="#d55e326">Context</a>
</li>
<li class="section">
<a href="#d55e331">Forces</a>
</li>
<li class="section">
<a href="#d55e336">Solution</a>
</li>
<li class="section">
<a href="#d55e341">Examples</a>
</li>
<li class="section">
<a href="#d55e356">Discussion</a>
</li>
<li class="section">
<a href="#d55e363">Related Patterns</a>
</li>
<li class="section">
<a href="#d55e370">Known Uses</a>
</li>
</ol>
</li>
<li class="section">
<a href="#d55e376">Universal Root</a>
<ol>
<li class="section">
<a href="#d55e383">Problem</a>
</li>
<li class="section">
<a href="#d55e388">Context</a>
</li>
<li class="section">
<a href="#d55e393">Forces</a>
</li>
<li class="section">
<a href="#d55e398">Solution</a>
</li>
<li class="section">
<a href="#d55e403">Examples</a>
</li>
<li class="section">
<a href="#d55e410">Discussion</a>
</li>
<li class="section">
<a href="#d55e421">Related Patterns</a>
</li>
<li class="section">
<a href="#d55e431">Known Uses</a>
</li>
</ol>
</li>
</ol>
</li>
<li class="chapter">
<a href="#d55e437">Metadata</a>
<ol>
<li class="section">
<a href="#d55e445">Head-Body</a>
<ol>
<li class="section">
<a href="#d55e452">Problem</a>
</li>
<li class="section">
<a href="#d55e457">Context</a>
</li>
<li class="section">
<a href="#d55e462">Forces</a>
</li>
<li class="section">
<a href="#d55e467">Solution</a>
</li>
<li class="section">
<a href="#d55e480">Examples</a>
</li>
<li class="section">
<a href="#d55e491">Discussion</a>
</li>
<li class="section">
<a href="#d55e504">Related Patterns</a>
</li>
<li class="section">
<a href="#d55e509">Known Uses</a>
</li>
<li class="section">
<a href="#d55e519">References</a>
</li>
</ol>
</li>
<li class="section">
<a href="#d55e525">Metadata First</a>
<ol>
<li class="section">
<a href="#d55e532">Problem</a>
</li>
<li class="section">
<a href="#d55e537">Context</a>
</li>
<li class="section">
<a href="#d55e542">Forces</a>
</li>
<li class="section">
<a href="#d55e547">Solution</a>
</li>
<li class="section">
<a href="#d55e558">Examples</a>
</li>
<li class="section">
<a href="#d55e565">Discussion</a>
</li>
<li class="section">
<a href="#d55e570">Related Patterns</a>
</li>
<li class="section">
<a href="#d55e578">Known Uses</a>
</li>
</ol>
</li>
<li class="section">
<a href="#d55e584">Metadata in Separate Document</a>
<ol>
<li class="section">
<a href="#d55e591">Problem</a>
</li>
<li class="section">
<a href="#d55e596">Context</a>
</li>
<li class="section">
<a href="#d55e601">Forces</a>
</li>
<li class="section">
<a href="#d55e606">Solution</a>
</li>
<li class="section">
<a href="#d55e615">Examples</a>
</li>
<li class="section">
<a href="#d55e634">Discussion</a>
</li>
<li class="section">
<a href="#d55e643">Related Patterns</a>
</li>
<li class="section">
<a href="#d55e648">Known Uses</a>
</li>
<li class="section">
<a href="#d55e653">References</a>
</li>
</ol>
</li>
<li class="section">
<a href="#d55e659">Separate Metadata and Data</a>
<ol>
<li class="section">
<a href="#d55e666">Problem</a>
</li>
<li class="section">
<a href="#d55e675">Context</a>
</li>
<li class="section">
<a href="#d55e680">Forces</a>
</li>
<li class="section">
<a href="#d55e685">Solution</a>
</li>
<li class="section">
<a href="#d55e690">Examples</a>
</li>
<li class="section">
<a href="#d55e701">Discussion</a>
</li>
<li class="section">
<a href="#d55e706">Related Patterns</a>
</li>
<li class="section">
<a href="#d55e716">Known Uses</a>
</li>
</ol>
</li>
</ol>
</li>
<li class="chapter">
<a href="#d55e724">Abstraction</a>
<ol>
<li class="section">
<a href="#d55e732">Choice Reducing Container</a>
<ol>
<li class="section">
<a href="#d55e739">Problem</a>
</li>
<li class="section">
<a href="#d55e744">Context</a>
</li>
<li class="section">
<a href="#d55e749">Forces</a>
</li>
<li class="section">
<a href="#d55e754">Solution</a>
</li>
<li class="section">
<a href="#d55e759">Examples</a>
</li>
<li class="section">
<a href="#d55e776">Discussion</a>
</li>
<li class="section">
<a href="#d55e783">Related Patterns</a>
</li>
<li class="section">
<a href="#d55e790">Known Uses</a>
</li>
<li class="section">
<a href="#d55e795">References</a>
</li>
</ol>
</li>
<li class="section">
<a href="#d55e801">Collection Element</a>
<ol>
<li class="section">
<a href="#d55e808">Problem</a>
</li>
<li class="section">
<a href="#d55e813">Context</a>
</li>
<li class="section">
<a href="#d55e818">Forces</a>
</li>
<li class="section">
<a href="#d55e823">Solution</a>
</li>
<li class="section">
<a href="#d55e828">Examples</a>
</li>
<li class="section">
<a href="#d55e848">Discussion</a>
</li>
<li class="section">
<a href="#d55e857">Related Patterns</a>
</li>
<li class="section">
<a href="#d55e862">Known Uses</a>
</li>
</ol>
</li>
<li class="section">
<a href="#d55e871">Container Element</a>
<ol>
<li class="section">
<a href="#d55e878">Problem</a>
</li>
<li class="section">
<a href="#d55e883">Context</a>
</li>
<li class="section">
<a href="#d55e888">Forces</a>
</li>
<li class="section">
<a href="#d55e893">Solution</a>
</li>
<li class="section">
<a href="#d55e898">Examples</a>
</li>
<li class="section">
<a href="#d55e909">Discussion</a>
</li>
<li class="section">
<a href="#d55e916">Related Patterns</a>
</li>
<li class="section">
<a href="#d55e931">Known Uses</a>
</li>
<li class="section">
<a href="#d55e936">References</a>
</li>
</ol>
</li>
<li class="section">
<a href="#d55e942">Domain Element</a>
<ol>
<li class="section">
<a href="#d55e949">Problem</a>
</li>
<li class="section">
<a href="#d55e954">Context</a>
</li>
<li class="section">
<a href="#d55e959">Forces</a>
</li>
<li class="section">
<a href="#d55e964">Solution</a>
</li>
<li class="section">
<a href="#d55e969">Examples</a>
</li>
<li class="section">
<a href="#d55e976">Discussion</a>
</li>
<li class="section">
<a href="#d55e983">Related Patterns</a>
</li>
<li class="section">
<a href="#d55e988">Known Uses</a>
</li>
</ol>
</li>
<li class="section">
<a href="#d55e998">Optional Container Element</a>
<ol>
<li class="section">
<a href="#d55e1005">Problem</a>
</li>
<li class="section">
<a href="#d55e1010">Context</a>
</li>
<li class="section">
<a href="#d55e1015">Forces</a>
</li>
<li class="section">
<a href="#d55e1020">Solution</a>
</li>
<li class="section">
<a href="#d55e1025">Examples</a>
</li>
<li class="section">
<a href="#d55e1038">Discussion</a>
</li>
<li class="section">
<a href="#d55e1047">Related Patterns</a>
</li>
<li class="section">
<a href="#d55e1052">Known Uses</a>
</li>
<li class="section">
<a href="#d55e1061">Contributions</a>
</li>
</ol>
</li>
</ol>
</li>
<li class="chapter">
<a href="#d55e1067">Organization</a>
<ol>
<li class="section">
<a href="#d55e1075">Declare Before First Use</a>
<ol>
<li class="section">
<a href="#d55e1082">Problem</a>
</li>
<li class="section">
<a href="#d55e1087">Context</a>
</li>
<li class="section">
<a href="#d55e1092">Forces</a>
</li>
<li class="section">
<a href="#d55e1097">Solution</a>
</li>
<li class="section">
<a href="#d55e1102">Examples</a>
</li>