forked from mvolkmann/mvolkmann.github.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.html
More file actions
executable file
·105 lines (101 loc) · 10.1 KB
/
Copy pathexample.html
File metadata and controls
executable file
·105 lines (101 loc) · 10.1 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
<?xml version="1.0"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>BOX Example</title>
<link rel="stylesheet" type="text/css" href="box.css"/>
</head>
<body>
<div class="title">Example</div>
<p>
BOX represents each node in the DOM tree of an XML document by a
type code followed by either a text value or an index to a text value.
If the text value is being encountered for the first time,
such as the name of the root element, then the text is used.
If the text value has been seen before, such as any element end tag,
an index to that text is used.
The first unique text value gets an index of zero, the second gets
an index of one, and so on.
</p>
<p>
<a href="boxTypeCodes.html">BOX type codes</a>
come in increments of ten from 0 to 90.
They represent all the node types BOX can handle.
For example, the code for the start of an element is 40.
If the text which is the name of the element has not been encountered yet
then the type code will be followed by that text.
If the text has been encountered before
then the code will be 41, 42 or 44,
based on the number of bytes required to hold the index to the text.
If the index will fit in one byte then 41 is used.
For two bytes, 42 is used. For four bytes, 44 is used.
</p>
<p>
The attributes of an element, including namespace declarations,
are encoded before the element whose start tags contains them.
Reasons for this are explained in the <a href="example.html">FAQ</a>.
</p>
<p>
Here's a side-by-side example of XML and BOX.
BOX type codes look like <span class="boxTypeCode">this</span>.
Note that multiple <i>whitespace</i> text values only appear
when the whitespace characters and/or number of them differ.
"pi" stands for processing instruction.
Integer values are written in big endian order.
Text values are written in ASCII or UTF-8 as indicated by the first byte.
</p>
<!-- The following table was generated by BOXDOMEncoderImpl.java. -->
<table border='1'>
<tr><th>XML</th><th>BOX</th></tr>
<tr><td valign='top'>n/a</td><td>'A' for ASCII</td></tr>
<tr><td valign='top'><?xml-stylesheet type="text/xsl" href="family.xsl"?></td><td><span class="boxTypeCode">70</span> (pi target)<hr/>14 (length)<hr/>"xml-stylesheet" (index=0)<hr/><span class="boxTypeCode">80</span> (pi value)<hr/>33 (length)<hr/>"type="text/xsl" href="family.xsl"" (index=1)</td></tr>
<tr><td valign='top'><!-- This is a test document for the BOX package. --></td><td><span class="boxTypeCode">20</span> (comment)<hr/>46 (length)<hr/>" This is a test document for the BOX package. " (index=2)</td></tr>
<tr><td valign='top'><family xmlns="http://www.ociweb.com/geneology" xmlns:kids="http://www.ociweb.com/kids"></td><td><span class="boxTypeCode">50</span> (namespace prefix)<hr/>0 (length)<hr/>"" (index=3)<hr/><span class="boxTypeCode">60</span> (namespace uri)<hr/>31 (length)<hr/>"http://www.ociweb.com/geneology" (index=4)<hr/><span class="boxTypeCode">50</span> (namespace prefix)<hr/>4 (length)<hr/>"kids" (index=5)<hr/><span class="boxTypeCode">60</span> (namespace uri)<hr/>26 (length)<hr/>"http://www.ociweb.com/kids" (index=6)<hr/><span class="boxTypeCode">40</span> (element start)<hr/>6 (length)<hr/>"family" (index=7)</td></tr>
<tr><td valign='top'><i>whitespace</i></td><td><span class="boxTypeCode">90</span> (text)<hr/>3 (length)<hr/><i>whitespace</i> (index=8)</td></tr>
<tr><td valign='top'><father age="40" occupation="software engineer"></td><td><span class="boxTypeCode">0</span> (attribute name)<hr/>3 (length)<hr/>"age" (index=9)<hr/><span class="boxTypeCode">10</span> (attribute value)<hr/>2 (length)<hr/>"40" (index=10)<hr/><span class="boxTypeCode">0</span> (attribute name)<hr/>10 (length)<hr/>"occupation" (index=11)<hr/><span class="boxTypeCode">10</span> (attribute value)<hr/>17 (length)<hr/>"software engineer" (index=12)<hr/><span class="boxTypeCode">40</span> (element start)<hr/>6 (length)<hr/>"father" (index=13)</td></tr>
<tr><td valign='top'><i>whitespace</i></td><td><span class="boxTypeCode">90</span> (text)<hr/>5 (length)<hr/><i>whitespace</i> (index=14)</td></tr>
<tr><td valign='top'><name></td><td><span class="boxTypeCode">40</span> (element start)<hr/>4 (length)<hr/>"name" (index=15)</td></tr>
<tr><td valign='top'>Mark&<</td><td><span class="boxTypeCode">90</span> (text)<hr/>6 (length)<hr/>"Mark&<" (index=16)</td></tr>
<tr><td valign='top'></name></td><td><span class="boxTypeCode">30</span> (end of element)</td></tr>
<tr><td valign='top'><i>whitespace</i></td><td><span class="boxTypeCode">91</span> (text)<hr/>8 (index)</td></tr>
<tr><td valign='top'></father></td><td><span class="boxTypeCode">30</span> (end of element)</td></tr>
<tr><td valign='top'><i>whitespace</i></td><td><span class="boxTypeCode">91</span> (text)<hr/>8 (index)</td></tr>
<tr><td valign='top'><mother age="40"></td><td><span class="boxTypeCode">1</span> (attribute name)<hr/>9 (index)<hr/><span class="boxTypeCode">11</span> (attribute value)<hr/>10 (index)<hr/><span class="boxTypeCode">40</span> (element start)<hr/>6 (length)<hr/>"mother" (index=17)</td></tr>
<tr><td valign='top'><i>whitespace</i></td><td><span class="boxTypeCode">91</span> (text)<hr/>14 (index)</td></tr>
<tr><td valign='top'><name></td><td><span class="boxTypeCode">41</span> (element start)<hr/>15 (index)</td></tr>
<tr><td valign='top'>Tami</td><td><span class="boxTypeCode">90</span> (text)<hr/>4 (length)<hr/>"Tami" (index=18)</td></tr>
<tr><td valign='top'></name></td><td><span class="boxTypeCode">30</span> (end of element)</td></tr>
<tr><td valign='top'><i>whitespace</i></td><td><span class="boxTypeCode">91</span> (text)<hr/>8 (index)</td></tr>
<tr><td valign='top'></mother></td><td><span class="boxTypeCode">30</span> (end of element)</td></tr>
<tr><td valign='top'><i>whitespace</i></td><td><span class="boxTypeCode">91</span> (text)<hr/>8 (index)</td></tr>
<tr><td valign='top'><kids:daughter age="16"></td><td><span class="boxTypeCode">1</span> (attribute name)<hr/>9 (index)<hr/><span class="boxTypeCode">10</span> (attribute value)<hr/>2 (length)<hr/>"16" (index=19)<hr/><span class="boxTypeCode">40</span> (element start)<hr/>13 (length)<hr/>"kids:daughter" (index=20)</td></tr>
<tr><td valign='top'><i>whitespace</i></td><td><span class="boxTypeCode">91</span> (text)<hr/>14 (index)</td></tr>
<tr><td valign='top'><!-- An excellent artist! --></td><td><span class="boxTypeCode">20</span> (comment)<hr/>22 (length)<hr/>" An excellent artist! " (index=21)</td></tr>
<tr><td valign='top'><i>whitespace</i></td><td><span class="boxTypeCode">91</span> (text)<hr/>14 (index)</td></tr>
<tr><td valign='top'><?homework class="math"?></td><td><span class="boxTypeCode">70</span> (pi target)<hr/>8 (length)<hr/>"homework" (index=22)<hr/><span class="boxTypeCode">80</span> (pi value)<hr/>12 (length)<hr/>"class="math"" (index=23)</td></tr>
<tr><td valign='top'><i>whitespace</i></td><td><span class="boxTypeCode">91</span> (text)<hr/>14 (index)</td></tr>
<tr><td valign='top'><name></td><td><span class="boxTypeCode">41</span> (element start)<hr/>15 (index)</td></tr>
<tr><td valign='top'>Amanda</td><td><span class="boxTypeCode">90</span> (text)<hr/>6 (length)<hr/>"Amanda" (index=24)</td></tr>
<tr><td valign='top'></name></td><td><span class="boxTypeCode">30</span> (end of element)</td></tr>
<tr><td valign='top'><i>whitespace</i></td><td><span class="boxTypeCode">91</span> (text)<hr/>8 (index)</td></tr>
<tr><td valign='top'></kids:daughter></td><td><span class="boxTypeCode">30</span> (end of element)</td></tr>
<tr><td valign='top'><i>whitespace</i></td><td><span class="boxTypeCode">91</span> (text)<hr/>8 (index)</td></tr>
<tr><td valign='top'><kids:son xmlns="http://www.ociweb.com/children" kids:age="14"></td><td><span class="boxTypeCode">51</span> (namespace prefix)<hr/>3 (index)<hr/><span class="boxTypeCode">60</span> (namespace uri)<hr/>30 (length)<hr/>"http://www.ociweb.com/children" (index=25)<hr/><span class="boxTypeCode">0</span> (attribute name)<hr/>8 (length)<hr/>"kids:age" (index=26)<hr/><span class="boxTypeCode">10</span> (attribute value)<hr/>2 (length)<hr/>"14" (index=27)<hr/><span class="boxTypeCode">40</span> (element start)<hr/>8 (length)<hr/>"kids:son" (index=28)</td></tr>
<tr><td valign='top'><i>whitespace</i></td><td><span class="boxTypeCode">91</span> (text)<hr/>14 (index)</td></tr>
<tr><td valign='top'><!-- An excellent chess player! --></td><td><span class="boxTypeCode">20</span> (comment)<hr/>28 (length)<hr/>" An excellent chess player! " (index=29)</td></tr>
<tr><td valign='top'><i>whitespace</i></td><td><span class="boxTypeCode">91</span> (text)<hr/>14 (index)</td></tr>
<tr><td valign='top'><name></td><td><span class="boxTypeCode">41</span> (element start)<hr/>15 (index)</td></tr>
<tr><td valign='top'>Jeremy</td><td><span class="boxTypeCode">90</span> (text)<hr/>6 (length)<hr/>"Jeremy" (index=30)</td></tr>
<tr><td valign='top'></name></td><td><span class="boxTypeCode">30</span> (end of element)</td></tr>
<tr><td valign='top'><i>whitespace</i></td><td><span class="boxTypeCode">91</span> (text)<hr/>8 (index)</td></tr>
<tr><td valign='top'></kids:son></td><td><span class="boxTypeCode">30</span> (end of element)</td></tr>
<tr><td valign='top'><i>whitespace</i></td><td><span class="boxTypeCode">91</span> (text)<hr/>8 (index)</td></tr>
<tr><td valign='top'><empty></td><td><span class="boxTypeCode">40</span> (element start)<hr/>5 (length)<hr/>"empty" (index=31)</td></tr>
<tr><td valign='top'></empty></td><td><span class="boxTypeCode">30</span> (end of element)</td></tr>
<tr><td valign='top'><i>whitespace</i></td><td><span class="boxTypeCode">90</span> (text)<hr/>1 (length)<hr/><i>whitespace</i> (index=32)</td></tr>
<tr><td valign='top'></family></td><td><span class="boxTypeCode">30</span> (end of element)</td></tr>
</table>
</body>
</html>