-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathxep-0000-Tables.html
More file actions
1354 lines (1335 loc) · 67.3 KB
/
Copy pathxep-0000-Tables.html
File metadata and controls
1354 lines (1335 loc) · 67.3 KB
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>XEP-xxxx: Tables in Instant Messaging</title>
<link rel="stylesheet" type="text/css" href="xmpp.css">
<link href="prettify.css" type="text/css" rel="stylesheet">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico"><script type="text/javascript" src="prettify.js"></script><meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=2.0">
<meta name="DC.Title" content="Tables in Instant Messaging">
<meta name="DC.Creator" content="Peter Waher">
<meta name="DC.Description" content="This specification provides a means to send tables between instant messaging clients, or between robots and instant messaging clients.">
<meta name="DC.Publisher" content="XMPP Standards Foundation">
<meta name="DC.Contributor" content="XMPP Extensions Editor">
<meta name="DC.Date" content="2013-12-11">
<meta name="DC.Type" content="XMPP Extension Protocol">
<meta name="DC.Format" content="XHTML">
<meta name="DC.Identifier" content="XEP-xxxx">
<meta name="DC.Language" content="en">
<meta name="DC.Rights" content="This XMPP Extension Protocol is copyright © 1999 - 2013 by the XMPP Standards Foundation (XSF).">
</head>
<body onload="prettyPrint()">
<h1>XEP-xxxx: Tables in Instant Messaging</h1>
<table>
<tr valign="top">
<td><strong>Abstract:</strong></td>
<td>This specification provides a means to send tables between instant messaging clients, or between robots and instant messaging clients.</td>
</tr>
<tr valign="top">
<td><strong>Author:</strong></td>
<td>Peter Waher</td>
</tr>
<tr valign="top">
<td><strong>Copyright:</strong></td>
<td>© 1999 - 2013 XMPP Standards Foundation. <a href="#appendix-legal">SEE LEGAL NOTICES</a>.</td>
</tr>
<tr valign="top">
<td><strong>Status:</strong></td>
<td>ProtoXEP</td>
</tr>
<tr valign="top">
<td><strong>Type:</strong></td>
<td>Standards Track</td>
</tr>
<tr valign="top">
<td><strong>Version:</strong></td>
<td>0.0.1</td>
</tr>
<tr valign="top">
<td><strong>Last Updated:</strong></td>
<td>2013-12-11</td>
</tr>
</table>
<hr>
<p style="color:red">WARNING: This document has not yet been accepted for consideration or approved in any official manner by the XMPP Standards Foundation, and this document is not yet an XMPP Extension Protocol (XEP). If this document is accepted as a XEP by the XMPP Council, it will be published at <<a href="http://xmpp.org/extensions/">http://xmpp.org/extensions/</a>> and announced on the <standards@xmpp.org> mailing list.</p>
<hr>
<h2>Table of Contents</h2>
<div class="indent">
<p><br>1. <a href="#intro">Introduction</a><br>2. <a href="#glossary">Glossary</a><br>3. <a href="#usecases">Use Cases</a><br>
3.1. <a href="#simpletable">Sending a simple table</a><br>
3.2. <a href="#textfallback">Text version fallback mechanism</a><br>
3.3. <a href="#alignments">Adding cell alignments</a><br>
3.4. <a href="#columnrowformats">Column and Row Formats</a><br>
3.5. <a href="#colorsandfonts">Colors and fonts</a><br>
3.6. <a href="#cellspan">Cell span</a><br>
3.7. <a href="#xhtmlimcontent">XHTML-IM content with text fallback</a><br>
3.8. <a href="#splittingtable">Splitting a table into multiple messages</a><br>4. <a href="#support">Determining Support</a><br>5. <a href="#rules">Business Rules</a><br>
5.1. <a href="#sect-ID0EYFAC">Column number mismatch</a><br>
5.2. <a href="#xhtmlfallback">XHTML-IM fallback</a><br>
5.3. <a href="#tableformats">Table Formats</a><br>
5.4. <a href="#columnformats">Column Formats</a><br>
5.5. <a href="#rowformats">Row Formats</a><br>
5.6. <a href="#cellspans">Cel spans</a><br>
5.7. <a href="#splittingtables">Splitting Tables</a><br>6. <a href="#impl">Implementation Notes</a><br>
6.1. <a href="#sect-ID0EHMAC">Feature support</a><br>7. <a href="#access">Accessibility Considerations</a><br>8. <a href="#i18n">Internationalization Considerations</a><br>
8.1. <a href="#lang">xml:lang</a><br>9. <a href="#security">Security Considerations</a><br>10. <a href="#iana">IANA Considerations</a><br>11. <a href="#registrar">XMPP Registrar Considerations</a><br>12. <a href="#schema">XML Schema</a></p>
<p><a href="#appendices">Appendices</a><br> <a href="#appendix-docinfo">A: Document Information</a><br> <a href="#appendix-authorinfo">B: Author Information</a><br> <a href="#appendix-legal">C: Legal Notices</a><br> <a href="#appendix-xmpp">D: Relation to XMPP</a><br> <a href="#appendix-discuss">E: Discussion Venue</a><br> <a href="#appendix-conformance">F: Requirements Conformance</a><br> <a href="#appendix-notes">G: Notes</a><br> <a href="#appendix-revs">H: Revision History</a></p>
</div>
<hr>
<h2>1.
<a name="intro">Introduction</a></h2>
<p class="" style="">
There are cases where an interchange of tables between internet messaging clients and/or chat robots is desired. Examples include pasting
tabulated data from the clipboard (perhaps copied from a spread sheet) or a chat robot presenting data in tabular form.
</p>
<p class="" style="">
Prior to this extension sending tabulated data could be achieved in various ways:
</p>
<ul class="" style="">
<li class="" style="">
<p class="" style="">
The tabulated data could be sent using a normal text message without formatting, where cells where separated by a tab character (\t).
The problem with this approach is that it only works if contents are more or less uniformly spaced. When cell contents cross by the receiver
preset tabs, the columns are offset a corresponding amount of columns. And since the sender cannot control which font is used to present the
data, there's no way for the sender to know if data is tabulated correctly on the receiving end or not.
</p>
</li>
<li class="" style="">
<p class="" style="">
The tabulated data could be encoded using HTML and sent according to <span class="ref" style=""><a href="http://xmpp.org/extensions/xep-0071.html">XHTML-IM</a></span> [<a href="#nt-ID0EAE">1</a>] This works in some clients, but is actually prohibited in §5 of
the same extension. Since support for this is prohibited and extension of the corresponding XEP is not desired, using XHTML-IM to convey
tabular data is not a recommended option.
</p>
</li>
<li class="" style="">
<p class="" style="">
The tabulated data could be rendered as an image on the sender side, and the image transmitted to the client either using XHTML-IM itself, or
some other means. The problem with this approach is that the tabular data cannot be used by the received more than to view it. It cannot be
edited, saved or used in a spread sheet application, which might have been the original idea.
</p>
</li>
</ul>
<p class="" style="">
So this extension specifies a means to encode and send simple tabulated data between XMPP clients. Apart from being easy to single out and render, the
receiver would also have the benefit of knowing the data is of tabular format, which allows the client to encode it as such when copying the data
to a clipboard, making it easy to paste it into spread sheets. Using this extension it would be easy to interchange tabular data without having to
go through the process of saving it in files, transmitting files and separately opening them, which includes trusting file content, scanning them
with antivirus software, etc.
</p>
<h2>2.
<a name="glossary">Glossary</a></h2>
<p class="" style="">The following table lists common terms and corresponding descriptions.</p>
<div class="indent">
<dl>
<di>
<dt><strong>Table</strong></dt>
<dd>A table consists of cells arranged along columns and rows.</dd>
</di>
<di>
<dt><strong>Row</strong></dt>
<dd>
A horizontal set of cells in a table. All cells in a row are aligned vertically, and each cell in the row has the same height, which corresponds
to the highest height of all the cells in the row.
</dd>
</di>
<di>
<dt><strong>Column</strong></dt>
<dd>
A vertical set of cells in a table. All cells in a column are aligned horizontally, and each cell in the column has the same width, which corresponds
to the widest width of all the cells in the column.
</dd>
</di>
<di>
<dt><strong>Cell</strong></dt>
<dd>A cell is a rectangular region in a table. It contains content to be rendered in the corresponding region. The size of the cell depends on its contents.</dd>
</di>
<di>
<dt><strong>Alignment</strong></dt>
<dd>
There are two types of alignments: Horizontal alignment and vertical alignment. They define how content is displayed in a region that is either
wider or higher than the content itself.
</dd>
</di>
</dl>
</div>
<h2>3.
<a name="usecases">Use Cases</a></h2>
<div class="indent">
<h3>3.1 <a name="simpletable">Sending a simple table</a></h3>
<p class="" style="">
The following example shows how to send a simple table in a chat message. The horizontal and vertical spacing defined in the table element
specifies a hint to the renderer how many pixels should be used to space cells apart in the table.
</p>
<p class="caption"><a name="example-1"></a>Example 1. Simple table</p>
<div class="indent">
<pre class="prettyprint">
<message from='device@clayster.com/device' to='user@clayster.com/client' type='chat' xml:lang='en'>
<table xmlns="urn:xmpp:tables" hspacing='5' vspacing='2'>
<row>
<cell>Field</cell>
<cell>Value</cell>
<cell>Unit</cell>
</row>
<row>
<cell>Location</cell>
<cell>Viña del Mar</cell>
<cell/>
</row>
<row>
<cell>Condition</cell>
<cell>Fair</cell>
<cell/>
</row>
<row>
<cell>Condition Code</cell>
<cell>34</cell>
<cell/>
</row>
<row>
<cell>Temperature</cell>
<cell>18</cell>
<cell>°C</cell>
</row>
<row>
<cell>Chill</cell>
<cell>18</cell>
<cell>°C</cell>
</row>
<row>
<cell>Wind Direction</cell>
<cell>330</cell>
<cell>°</cell>
</row>
<row>
<cell>Wind Speed</cell>
<cell>14,48</cell>
<cell>km/h</cell>
</row>
<row>
<cell>Humidity</cell>
<cell>52</cell>
<cell>%</cell>
</row>
<row>
<cell>Visibility</cell>
<cell>9,99</cell>
<cell>km</cell>
</row>
<row>
<cell>Pressure</cell>
<cell>1015,92</cell>
<cell>mbar</cell>
</row>
<row>
<cell>Pressure Trend</cell>
<cell>Steady</cell>
<cell/>
</row>
</table>
</message>
</pre>
</div>
</div>
<div class="indent">
<h3>3.2 <a name="textfallback">Text version fallback mechanism</a></h3>
<p class="" style="">
The following example shows how to add a text version of the table in the message that can be displayed in clients not supporting this extension.
</p>
<p class="caption"><a name="example-2"></a>Example 2. Table with text version fallback</p>
<div class="indent">
<pre class="prettyprint">
<message from='device@clayster.com/device' to='user@clayster.com/client' type='chat' xml:lang='en'>
<body>Field Value Unit
Location Viña del Mar
Condition Fair
Condition Code 34
Temperature 18 °C
Chill 18 °C
Wind Direction 330 °
Wind Speed 14,48 km/h
Humidity 52 %
Visibility 9,99 km
Pressure 1015,92 mbar
Pressure Trend Steady</body>
<table xmlns="urn:xmpp:tables" hspacing='5' vspacing='2'>
<row>
<cell>Field</cell>
<cell>Value</cell>
<cell>Unit</cell>
</row>
<row>
<cell>Location</cell>
<cell>Viña del Mar</cell>
<cell/>
</row>
<row>
<cell>Condition</cell>
<cell>Fair</cell>
<cell/>
</row>
<row>
<cell>Condition Code</cell>
<cell>34</cell>
<cell/>
</row>
<row>
<cell>Temperature</cell>
<cell>18</cell>
<cell>°C</cell>
</row>
<row>
<cell>Chill</cell>
<cell>18</cell>
<cell>°C</cell>
</row>
<row>
<cell>Wind Direction</cell>
<cell>330</cell>
<cell>°</cell>
</row>
<row>
<cell>Wind Speed</cell>
<cell>14,48</cell>
<cell>km/h</cell>
</row>
<row>
<cell>Humidity</cell>
<cell>52</cell>
<cell>%</cell>
</row>
<row>
<cell>Visibility</cell>
<cell>9,99</cell>
<cell>km</cell>
</row>
<row>
<cell>Pressure</cell>
<cell>1015,92</cell>
<cell>mbar</cell>
</row>
<row>
<cell>Pressure Trend</cell>
<cell>Steady</cell>
<cell/>
</row>
</table>
</message>
</pre>
</div>
</div>
<div class="indent">
<h3>3.3 <a name="alignments">Adding cell alignments</a></h3>
<p class="" style="">
The following example adds content alignment to individual cells to control how the content is laid out inside the corresponding cells.
</p>
<p class="" style="">
<span class="strong">Note:</span> Default horizontal alignment is <span class="strong">Left</span>, and default vertical alignment is <span class="strong">Top</span>. Cell attributes
override any corresponding row or column attributes.
</p>
<p class="caption"><a name="example-3"></a>Example 3. Cell alignments</p>
<div class="indent">
<pre class="prettyprint">
<message from='device@clayster.com/device' to='user@clayster.com/client' type='chat' xml:lang='en'>
<body>Field Value Unit
Location Viña del Mar
Condition Fair
Condition Code 34
Temperature 18 °C
Chill 18 °C
Wind Direction 330 °
Wind Speed 14,48 km/h
Humidity 52 %
Visibility 9,99 km
Pressure 1015,92 mbar
Pressure Trend Steady</body>
<table xmlns="urn:xmpp:tables" hspacing='5' vspacing='2'>
<row>
<cell>Field</cell>
<cell>Value</cell>
<cell>Unit</cell>
</row>
<row>
<cell>Location</cell>
<cell>Viña del Mar</cell>
<cell/>
</row>
<row>
<cell>Condition</cell>
<cell>Fair</cell>
<cell/>
</row>
<row>
<cell>Condition Code</cell>
<cell halign='Right'>34</cell>
<cell/>
</row>
<row>
<cell>Temperature</cell>
<cell halign='Right'>18</cell>
<cell>°C</cell>
</row>
<row>
<cell>Chill</cell>
<cell halign='Right'>18</cell>
<cell>°C</cell>
</row>
<row>
<cell>Wind Direction</cell>
<cell halign='Right'>330</cell>
<cell>°</cell>
</row>
<row>
<cell>Wind Speed</cell>
<cell halign='Right'>14,48</cell>
<cell>km/h</cell>
</row>
<row>
<cell>Humidity</cell>
<cell halign='Right'>52</cell>
<cell>%</cell>
</row>
<row>
<cell>Visibility</cell>
<cell halign='Right'>9,99</cell>
<cell>km</cell>
</row>
<row>
<cell>Pressure</cell>
<cell halign='Right'>1015,92</cell>
<cell>mbar</cell>
</row>
<row>
<cell>Pressure Trend</cell>
<cell>Steady</cell>
<cell/>
</row>
</table>
</message>
</pre>
</div>
</div>
<div class="indent">
<h3>3.4 <a name="columnrowformats">Column and Row Formats</a></h3>
<p class="" style="">
The following example uses column and row formats to format all cells in specific columns and rows in a certain way. Using column and row
formats avoids the use of repeated attributes for each cell in the corresponding column or row.
</p>
<p class="" style="">
<span class="strong">Note:</span> Column formats override any conflicting table formats, row formats override any conflicting column or table formats,
and cell formats override any conflicting row, column or table formats.
</p>
<p class="caption"><a name="example-4"></a>Example 4. Column and Row Formats</p>
<div class="indent">
<pre class="prettyprint">
<message from='device@clayster.com/device' to='user@clayster.com/client' type='chat' xml:lang='en'>
<body>Field Value Unit
Location Viña del Mar
Condition Fair
Condition Code 34
Temperature 18 °C
Chill 18 °C
Wind Direction 330 °
Wind Speed 14,48 km/h
Humidity 52 %
Visibility 9,99 km
Pressure 1015,92 mbar
Pressure Trend Steady</body>
<table xmlns="urn:xmpp:tables" hspacing='5' vspacing='2'>
<columnFormat bold='true'/>
<columnFormat italic='true'/>
<columnFormat italic='true'/>
<row bold='true' italic='false'>
<cell>Field</cell>
<cell>Value</cell>
<cell>Unit</cell>
</row>
<row>
<cell>Location</cell>
<cell>Viña del Mar</cell>
<cell/>
</row>
<row>
<cell>Condition</cell>
<cell>Fair</cell>
<cell/>
</row>
<row>
<cell>Condition Code</cell>
<cell halign='Right'>34</cell>
<cell/>
</row>
<row>
<cell>Temperature</cell>
<cell halign='Right'>18</cell>
<cell>°C</cell>
</row>
<row>
<cell>Chill</cell>
<cell halign='Right'>18</cell>
<cell>°C</cell>
</row>
<row>
<cell>Wind Direction</cell>
<cell halign='Right'>330</cell>
<cell>°</cell>
</row>
<row>
<cell>Wind Speed</cell>
<cell halign='Right'>14,48</cell>
<cell>km/h</cell>
</row>
<row>
<cell>Humidity</cell>
<cell halign='Right'>52</cell>
<cell>%</cell>
</row>
<row>
<cell>Visibility</cell>
<cell halign='Right'>9,99</cell>
<cell>km</cell>
</row>
<row>
<cell>Pressure</cell>
<cell halign='Right'>1015,92</cell>
<cell>mbar</cell>
</row>
<row>
<cell>Pressure Trend</cell>
<cell>Steady</cell>
<cell/>
</row>
</table>
</message>
</pre>
</div>
</div>
<div class="indent">
<h3>3.5 <a name="colorsandfonts">Colors and fonts</a></h3>
<p class="" style="">
The following example shows how to explicitly define colors and fonts for the table or its parts. When specified, they override any default settings used
by the IM client.
</p>
<p class="" style="">
<span class="strong">Note:</span> Font sizes are never set explicitly. Instead, a font size multiplier is used to define the font size. It is multiplied by the font size
currently being used in the IM client to get the actual font size desired.
</p>
<p class="" style="">
<span class="strong">Note 2:</span> If a font with the given name is not found, the current font should be used, i.e. the font being used if no font name was specified.
</p>
<p class="caption"><a name="example-5"></a>Example 5. Colors and fonts</p>
<div class="indent">
<pre class="prettyprint">
<message from='device@clayster.com/device' to='user@clayster.com/client' type='chat' xml:lang='en'>
<body>Field Value Unit
Location Viña del Mar
Condition Fair
Condition Code 34
Temperature 18 °C
Chill 18 °C
Wind Direction 330 °
Wind Speed 14,48 km/h
Humidity 52 %
Visibility 9,99 km
Pressure 1015,92 mbar
Pressure Trend Steady</body>
<table xmlns="urn:xmpp:tables" hspacing='5' vspacing='2' bgColor='FFFFFF' fgColor='000000' fontSizeMultiplier='1.125' fontName='Arial'>
<columnFormat bold='true'/>
<columnFormat italic='true' fontName='Courier New'/>
<columnFormat italic='true' fontName='Courier New'/>
<row bold='true' italic='false' fontName='Arial'>
<cell>Field</cell>
<cell>Value</cell>
<cell>Unit</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Location</cell>
<cell>Viña del Mar</cell>
<cell/>
</row>
<row>
<cell>Condition</cell>
<cell>Fair</cell>
<cell/>
</row>
<row bgColor='E0E0E0'>
<cell>Condition Code</cell>
<cell halign='Right'>34</cell>
<cell/>
</row>
<row>
<cell>Temperature</cell>
<cell halign='Right'>18</cell>
<cell>°C</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Chill</cell>
<cell halign='Right'>18</cell>
<cell>°C</cell>
</row>
<row>
<cell>Wind Direction</cell>
<cell halign='Right'>330</cell>
<cell>°</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Wind Speed</cell>
<cell halign='Right'>14,48</cell>
<cell>km/h</cell>
</row>
<row>
<cell>Humidity</cell>
<cell halign='Right'>52</cell>
<cell>%</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Visibility</cell>
<cell halign='Right'>9,99</cell>
<cell>km</cell>
</row>
<row>
<cell>Pressure</cell>
<cell halign='Right'>1015,92</cell>
<cell>mbar</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Pressure Trend</cell>
<cell>Steady</cell>
<cell/>
</row>
</table>
</message>
</pre>
</div>
</div>
<div class="indent">
<h3>3.6 <a name="cellspan">Cell span</a></h3>
<p class="" style="">
Normally, each cell in a table occupies exactly one cell in the internal grid generated by the table. However, sometimes you want the contents
of a cell to span multiple columns and/or rows in the table. You can do this by using the attributes <span class="strong">colSpan</span> and <span class="strong">rowSpan</span>.
Any cell using these attributes will be formatted according to the formatting of the top left cell in the invisible grid generated by the table. Alignment
however is computed over the entire span of the cell.
</p>
<p class="caption"><a name="example-6"></a>Example 6. Cell span</p>
<div class="indent">
<pre class="prettyprint">
<message from='device@clayster.com/device' to='user@clayster.com/client' type='chat' xml:lang='en'>
<body>Field Value Unit
Location Viña del Mar
Condition Fair
Condition Code 34
Temperature 18 °C
Chill 18 °C
Wind Direction 330 °
Wind Speed 14,48 km/h
Humidity 52 %
Visibility 9,99 km
Pressure 1015,92 mbar
Pressure Trend Steady</body>
<table xmlns="urn:xmpp:tables" hspacing='5' vspacing='2' bgColor='FFFFFF' fgColor='000000' fontSizeMultiplier='1.125' fontName='Arial'>
<columnFormat bold='true'/>
<columnFormat italic='true' fontName='Courier New'/>
<columnFormat italic='true' fontName='Courier New'/>
<row bold='true' italic='false' fontName='Arial'>
<cell>Field</cell>
<cell>Value</cell>
<cell>Unit</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Location</cell>
<cell colSpan='2' halign='Center'>Viña del Mar</cell>
</row>
<row>
<cell>Condition</cell>
<cell colSpan='2' halign='Center'>Fair</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Condition Code</cell>
<cell halign='Right'>34</cell>
<cell/>
</row>
<row>
<cell>Temperature</cell>
<cell halign='Right'>18</cell>
<cell>°C</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Chill</cell>
<cell halign='Right'>18</cell>
<cell>°C</cell>
</row>
<row>
<cell>Wind Direction</cell>
<cell halign='Right'>330</cell>
<cell>°</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Wind Speed</cell>
<cell halign='Right'>14,48</cell>
<cell>km/h</cell>
</row>
<row>
<cell>Humidity</cell>
<cell halign='Right'>52</cell>
<cell>%</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Visibility</cell>
<cell halign='Right'>9,99</cell>
<cell>km</cell>
</row>
<row>
<cell>Pressure</cell>
<cell halign='Right'>1015,92</cell>
<cell>mbar</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Pressure Trend</cell>
<cell colSpan='2' halign='Center'>Steady</cell>
</row>
</table>
</message>
</pre>
</div>
</div>
<div class="indent">
<h3>3.7 <a name="xhtmlimcontent">XHTML-IM content with text fallback</a></h3>
<p class="" style="">
Sometimes you might want to insert content in a table that is not pure text. Examples can be images, links or text formatted more in detail.
<a href="http://xmpp.org/extensions/xep-0071.html">XEP-0071: XHTML-IM</a> defines a mechanism whereby this can be achieved. However, since
not all clients support XHTML-IM, a text fallback mechanism should always be provided.
</p>
<p class="" style="">
The following example builds on the previous examples and shows how XHTML-IM can be embedded into a cell in a table together with a text fallback
that can be used by the table renderer in the client, if support for XHTML-IM is not available.
</p>
<p class="" style="">
<span class="strong">Note:</span> Since the <span class="strong">cell</span> element is of a mixed type you can mix both text and child elements. Note however, that any
whitespace around the child elements are considered part of the text fallback.
</p>
<p class="caption"><a name="example-7"></a>Example 7. XHTML-IM content with text fallback</p>
<div class="indent">
<pre class="prettyprint">
<message from='device@clayster.com/device' to='user@clayster.com/client' type='chat' xml:lang='en'>
<body>Field Value Unit
Location Viña del Mar
Condition Fair
Condition Code 34
Temperature 18 °C
Chill 18 °C
Wind Direction 330 °
Wind Speed 14,48 km/h
Humidity 52 %
Visibility 9,99 km
Pressure 1015,92 mbar
Pressure Trend Steady</body>
<table xmlns="urn:xmpp:tables" hspacing='5' vspacing='2' bgColor='FFFFFF' fgColor='000000' fontSizeMultiplier='1.125' fontName='Arial'>
<columnFormat bold='true'/>
<columnFormat italic='true' fontName='Courier New'/>
<columnFormat italic='true' fontName='Courier New'/>
<row bold='true' italic='false' fontName='Arial'>
<cell>Field</cell>
<cell>Value</cell>
<cell>Unit</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Location</cell>
<cell colSpan='2' halign='Center'>Viña del Mar<html xmlns='http://jabber.org/protocol/xhtml-im'>
<a href='http://weather.yahoo.com/chile/valparaiso/vina-del-mar-349873/'>Viña del Mar</a>
</html></cell>
</row>
<row>
<cell>Condition</cell>
<cell colSpan='2' halign='Center'>Fair</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Condition Code</cell>
<cell halign='Right'>34</cell>
<cell/>
</row>
<row>
<cell>Temperature</cell>
<cell halign='Right'>18</cell>
<cell>°C</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Chill</cell>
<cell halign='Right'>18</cell>
<cell>°C</cell>
</row>
<row>
<cell>Wind Direction</cell>
<cell halign='Right'>330</cell>
<cell>°</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Wind Speed</cell>
<cell halign='Right'>14,48</cell>
<cell>km/h</cell>
</row>
<row>
<cell>Humidity</cell>
<cell halign='Right'>52</cell>
<cell>%</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Visibility</cell>
<cell halign='Right'>9,99</cell>
<cell>km</cell>
</row>
<row>
<cell>Pressure</cell>
<cell halign='Right'>1015,92</cell>
<cell>mbar</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Pressure Trend</cell>
<cell colSpan='2' halign='Center'>Steady</cell>
</row>
</table>
</message>
</pre>
</div>
</div>
<div class="indent">
<h3>3.8 <a name="splittingtable">Splitting a table into multiple messages</a></h3>
<p class="" style="">
Since messages have a size limit, the <span class="ref" style=""><a href="http://tools.ietf.org/html/rfc6120">XMPP Core</a></span> [<a href="#nt-ID0EDDAC">2</a>] defines a minimal maximal stanza size of 10000 bytes, it might be necessary to split larger
tables into multiple messages. This is done using the <span class="strong">toBeContinued</span> element before closing the <span class="strong">table</span> element,
as is shown in the following example.
</p>
<p class="" style="">
<span class="strong">Note:</span> The <span class="strong">toBeContinued</span> element is placed last, since it might be difficult to know the final stanza size before
doing the actual XML serialization. Since any text fallback might be rendered at the top, the entire table might or might not be available in the
text fallback part. The IM client, when receiving the continuation of the table, must not assume any fallback versions of the table are at the same
position as the table part. The fallback version might be equally streamed, more advanced, or less advanced as the table version. If continuation
messages contain fallbacks they should be presented using the same logic as the previous message.
</p>
<p class="" style="">
<span class="strong">Note 2:</span> Any table and column formatting provided in previous parts will be automatically applied to the continuation of the table.
It is not necessary to repeat these. Any conflicting table or column formats provided in continuations will simply be ignored.
</p>
<p class="caption"><a name="example-8"></a>Example 8. Splitting a table into multiple messages</p>
<div class="indent">
<pre class="prettyprint">
<message from='device@clayster.com/device' to='user@clayster.com/client' type='chat' xml:lang='en'>
<body>Field Value Unit
Location Viña del Mar
Condition Fair
Condition Code 34
Temperature 18 °C
Chill 18 °C</body>
<table xmlns="urn:xmpp:tables" hspacing='5' vspacing='2' bgColor='FFFFFF' fgColor='000000' fontSizeMultiplier='1.125' fontName='Arial'>
<columnFormat bold='true'/>
<columnFormat italic='true' fontName='Courier New'/>
<columnFormat italic='true' fontName='Courier New'/>
<row bold='true' italic='false' fontName='Arial'>
<cell>Field</cell>
<cell>Value</cell>
<cell>Unit</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Location</cell>
<cell colSpan='2' halign='Center'>Viña del Mar<html xmlns='http://jabber.org/protocol/xhtml-im'>
<a href='http://weather.yahoo.com/chile/valparaiso/vina-del-mar-349873/'>Viña del Mar</a>
</html></cell>
</row>
<row>
<cell>Condition</cell>
<cell colSpan='2' halign='Center'>Fair</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Condition Code</cell>
<cell halign='Right'>34</cell>
<cell/>
</row>
<row>
<cell>Temperature</cell>
<cell halign='Right'>18</cell>
<cell>°C</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Chill</cell>
<cell halign='Right'>18</cell>
<cell>°C</cell>
</row>
<toBeContinued/>
</table>
</message>
<message from='device@clayster.com/device' to='user@clayster.com/client' type='chat' xml:lang='en'>
<body>Wind Direction 330 °
Wind Speed 14,48 km/h
Humidity 52 %
Visibility 9,99 km
Pressure 1015,92 mbar
Pressure Trend Steady</body>
<table xmlns="urn:xmpp:tables">
<row>
<cell>Wind Direction</cell>
<cell halign='Right'>330</cell>
<cell>°</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Wind Speed</cell>
<cell halign='Right'>14,48</cell>
<cell>km/h</cell>
</row>
<row>
<cell>Humidity</cell>
<cell halign='Right'>52</cell>
<cell>%</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Visibility</cell>
<cell halign='Right'>9,99</cell>
<cell>km</cell>
</row>
<row>
<cell>Pressure</cell>
<cell halign='Right'>1015,92</cell>
<cell>mbar</cell>
</row>
<row bgColor='E0E0E0'>
<cell>Pressure Trend</cell>
<cell colSpan='2' halign='Center'>Steady</cell>
</row>
</table>
</message>
</pre>
</div>
</div>
<h2>4.
<a name="support">Determining Support</a></h2>
<p class="" style="">If an entity supports the reception of events as specified herein, it MUST advertise that fact by returning a feature of "urn:xmpp:tables" in response to <span class="ref" style=""><a href="http://xmpp.org/extensions/xep-0030.html">Service Discovery</a></span> [<a href="#nt-ID0EREAC">3</a>] information requests.</p>
<p class="caption"><a name="example-9"></a>Example 9. Service discovery information request</p>
<div class="indent">
<pre class="prettyprint">
<iq type='get'
from='user1@clayster.com/client'
to='user2@clayster.com/client'
id='disco1'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
</pre>
</div>
<p class="caption"><a name="example-10"></a>Example 10. Service discovery information response</p>
<div class="indent">
<pre class="prettyprint">
<iq type='result'
from='user2@clayster.com/client'
to='user1@clayster.com/client'
id='disco1'>
<query xmlns='http://jabber.org/protocol/disco#info'>
...
<feature var='urn:xmpp:tables'/>
...
</query>
</iq>
</pre>
</div>
<p class="" style="">
In order for an application to determine whether an entity supports this protocol, where possible it SHOULD use the dynamic, presence-based profile of service discovery defined
in <span class="ref" style=""><a href="http://xmpp.org/extensions/xep-0115.html">Entity Capabilities</a></span> [<a href="#nt-ID0EIFAC">4</a>]. However, if an application has not received entity capabilities information from an entity, it SHOULD use explicit service discovery instead.
</p>
<h2>5.
<a name="rules">Business Rules</a></h2>
<p class="" style="">
The following subsections define rules how to interpret data in case of perceived inconsistencies.
</p>
<div class="indent">
<h3>5.1 <a name="sect-ID0EYFAC">Column number mismatch</a></h3>
<p class="" style="">
It is allowed to have table with different number of columns. The table is considered to have the number of columns necessary to display
the row with the maximum number of columns, or the number of column formats if that number is greater. All rows with a smaller number of
columns will be considered to have empty cells to the right, to fill up the table.
</p>
</div>
<div class="indent">
<h3>5.2 <a name="xhtmlfallback">XHTML-IM fallback</a></h3>
<p class="" style="">
The examples in the <a href="#usecases">Use Cases</a> section only contain a text fallback mechanism when sending chat messages.
It is possible to have multiple kinds of fallback mechanisms, for instance a text fallback and an XHTML-IM fallback. The IM client
is supposed to select the version that it knows how to render best. Following are some guidelines:
</p>
<ul class="" style="">
<li class="" style="">
<p class="" style="">
If the IM client does not support either XHTML-IM or tables, the text fallback is used to display the content.
</p>
</li>
<li class="" style="">
<p class="" style="">
If the IM client only supports the XHTML-IM extension, but not the table extension, it will select the XHTML-IM fallback if such is available,
otherwise the text fallback will be displayed.
</p>
</li>
<li class="" style="">
<p class="" style="">
If the IM client only supports the table extension but not the XHTML-IM extension, it will select the table content and display it.
</p>
</li>
<li class="" style="">
<p class="" style="">
If the IM client supports both the XHTML-IM extension and the table extension, the table content should be chosen in favor of the XHTML-IM
fallback, if the XHTML-IM engine in the IM client does not support the XHTML Tables Module [<a href="#nt-ID0EUHAC">5</a>]. If the XHTML Tables Module is supported by the XHTML-IM engine, the XHTML-IM content should be selected in favor of the table content
as described in this extension.
</p>
</li>
</ul>
</div>
<div class="indent">
<h3>5.3 <a name="tableformats">Table Formats</a></h3>
<p class="" style="">
The <span class="strong">table</span> element itself can contain format settings. Any formatting provided in <span class="strong">table</span> elements override any default settings
provided by the IM client.
</p>
<p class="" style="">
The <span class="strong">hSpacing</span> and <span class="strong">vSpacing</span> attributes, which are unique to the <span class="strong">table</span> element,
provide information on how much space should be inserted between cells in the table. The unit used is pixels.
</p>
</div>