File: ref.html

package info (click to toggle)
xml2 0.5-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 440 kB
  • sloc: sh: 800; ansic: 595; makefile: 16
file content (205 lines) | stat: -rw-r--r-- 5,688 bytes parent folder | download
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
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title>xml2: Reference</title>
    <link rel="stylesheet" type="text/css" href="style.css">
  </head>
  <body>
 
    <h1>XML/Unix Processing Tools Documentation</h1>

    <h3>Usage</h3>

    <p>There are six tools.  They are all simple filters, reading information
    from standard input in one format and writing the same information to
    standard output in a different format.</p>

    <table>
    <tbody><tr><th>Tool name</th><th>Input</th><th>Output</th>
    </tr><tr><td>xml2</td>     <td>XML</td>  <td>Flat</td>
    </tr><tr><td>html2</td>    <td>HTML</td> <td>Flat</td>
    </tr><tr><td>csv2</td>     <td>CSV</td> <td>Flat</td>
    </tr><tr><td>2xml</td>     <td>Flat</td> <td>XML</td>
    </tr><tr><td>2html</td>    <td>Flat</td> <td>HTML</td>
    </tr><tr><td>2csv</td>     <td>Flat</td> <td>CSV</td>
    </tr></tbody></table>

    <p>The ``Flat'' format is specific to these tools.  It is a syntax for
    representing structured markup in a way that makes it easy to process with
    line-oriented tools.  The same format is used for HTML, XML, and CSV; in
    fact, you can think of <em>html2</em> as converting HTML to XHTML and
    running <em>xml2</em> on the result; likewise <em>2html</em> and
    <em>2xml</em>.</p>

    <p>CSV (comma-separated value) files are less expressive than XML or HTML
    (CSV has no hierarchy), so <em>xml2 | 2csv</em> is a lossy conversion.</p>

    <h3>File Format</h3>

    <p>To use these tools effectively, it's important to understand the ``Flat''
    format.  Unfortunately, I'm lazy and sloppy; rather than provide a precise 
    definition of the relationship between XML and ``Flat'', I will simply 
    give you a pile of examples and hope you can generalize correctly.
    (Good luck!)</p>

    <table>
    <tbody><tr><th>XML</th><th>Flat equivalent</th>

    </tr><tr>
    <td>&lt;thing/&gt;</td>
    <td>/thing</td>

    </tr><tr><td colspan="2"><hr></td>
    </tr><tr>
    <td>&lt;thing&gt;&lt;subthing/&gt;&lt;/thing&gt;</td>
    <td>/thing/subthing</td>

    </tr><tr><td colspan="2"><hr></td>
    </tr><tr>
    <td>&lt;thing&gt;stuff&lt;/thing&gt;</td>
    <td>/thing=stuff</td>

    </tr><tr><td colspan="2"><hr></td>
    </tr><tr>
    <td>
      &lt;thing&gt;<br>
    <span class="items">
      &lt;subthing&gt;substuff&lt;/subthing&gt;<br>
      stuff<br>
    </span>
      &lt;/thing&gt;<br>
    </td>
    <td>
      /thing/subthing=substuff<br>
      /thing=stuff<br>
    </td>

    </tr><tr><td colspan="2"><hr></td>
    </tr><tr>
    <td>
      &lt;person&gt;<br>
    <span class="items">
      &lt;name&gt;Juan Doé&lt;/name&gt;<br>
      &lt;occupation&gt;Zillionaire&lt;/occupation&gt;<br>
      &lt;pet&gt;Dogcow&lt;/pet&gt;<br>
      &lt;address&gt;<br>
    <span class="items">
        123 Camino Real<br>
        &lt;city&gt;El Dorado&lt;/city&gt;<br>
        &lt;state&gt;AZ&lt;/state&gt;<br>
        &lt;zip&gt;12345&lt;/zip&gt;<br>
    </span>
      &lt;/address&gt;<br>
      &lt;important/&gt;<br>
    </span>
      &lt;/person&gt;<br>
    </td>
    <td>
      /person/name=Juan Doé<br>
      /person/occupation=Zillionaire<br>
      /person/pet=Dogcow<br>
      /person/address=123 Camino Real<br>
      /person/address/city=El Dorado<br>
      /person/address/state=AZ<br>
      /person/address/zip=12345<br>
      /person/important
    </td>

    </tr><tr><td colspan="2"><hr></td>
    </tr><tr>
    <td>
      &lt;collection&gt;<br>
    <span class="items">
        &lt;group&gt;<br>
    <span class="items">
          &lt;thing&gt;stuff&lt;/thing&gt;<br>
          &lt;thing&gt;stuff&lt;/thing&gt;<br>
    </span>
        &lt;/group&gt;<br>
    </span>
      &lt;/collection&gt;<br>
    </td>
    <td>
      /collection/group/thing=stuff<br>
      /collection/group/thing<br>
      /collection/group/thing=stuff<br>
    </td>

    </tr><tr><td colspan="2"><hr></td>
    </tr><tr>
    <td>
      &lt;collection&gt;<br>
    <span class="items">
        &lt;group&gt;<br>
    <span class="items">
          &lt;thing&gt;stuff&lt;/thing&gt;<br>
    </span>
        &lt;/group&gt;<br>
        &lt;group&gt;<br>
    <span class="items">
          &lt;thing&gt;stuff&lt;/thing&gt;<br>
    </span>
        &lt;/group&gt;<br>
    </span>
      &lt;/collection&gt;<br>
    </td>
    <td>
      /collection/group/thing=stuff<br>
      /collection/group<br>
      /collection/group/thing=stuff<br>
    </td>

    </tr><tr><td colspan="2"><hr></td>
    </tr><tr>
    <td>
      &lt;thing&gt;<br>
    <span class="items">
        stuff<br>
        <br>
        more stuff<br>
        &amp;lt;other stuff&amp;gt;
    </span>
      &lt;/thing&gt;<br>
    </td>
    <td>
      /thing=stuff<br>
      /thing=<br>
      /thing=more stuff<br>
      /thing=&lt;other stuff&gt;<br>
    </td>

    </tr><tr><td colspan="2"><hr></td>
    </tr><tr>
    <td>&lt;thing flag="value"&gt;stuff&lt;/thing&gt;</td>
    <td>
      /thing/@flag=value<br>
      /thing=stuff<br>
    </td>

    </tr><tr><td colspan="2"><hr></td>
    </tr><tr>
    <td>
      &lt;?processing instruction?&gt;<br>
      &lt;thing/&gt;
    </td><td>
      /?processing=instruction<br>
      /thing<br>
    </td>

    </tr></tbody></table>

    <p>(TO DO: Add equivalent examples for CSV files.)</p>

    <hr>
    <a href="">XML/Unix Processing Tools</a>
  


</body></html>
<!--
     FILE ARCHIVED ON 03:46:55 Aug 12, 2016 AND RETRIEVED FROM THE
     INTERNET ARCHIVE ON 06:30:49 Feb 10, 2024.
     JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.

     ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
     SECTION 108(a)(3)).
-->