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><thing/></td>
<td>/thing</td>
</tr><tr><td colspan="2"><hr></td>
</tr><tr>
<td><thing><subthing/></thing></td>
<td>/thing/subthing</td>
</tr><tr><td colspan="2"><hr></td>
</tr><tr>
<td><thing>stuff</thing></td>
<td>/thing=stuff</td>
</tr><tr><td colspan="2"><hr></td>
</tr><tr>
<td>
<thing><br>
<span class="items">
<subthing>substuff</subthing><br>
stuff<br>
</span>
</thing><br>
</td>
<td>
/thing/subthing=substuff<br>
/thing=stuff<br>
</td>
</tr><tr><td colspan="2"><hr></td>
</tr><tr>
<td>
<person><br>
<span class="items">
<name>Juan Doé</name><br>
<occupation>Zillionaire</occupation><br>
<pet>Dogcow</pet><br>
<address><br>
<span class="items">
123 Camino Real<br>
<city>El Dorado</city><br>
<state>AZ</state><br>
<zip>12345</zip><br>
</span>
</address><br>
<important/><br>
</span>
</person><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>
<collection><br>
<span class="items">
<group><br>
<span class="items">
<thing>stuff</thing><br>
<thing>stuff</thing><br>
</span>
</group><br>
</span>
</collection><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>
<collection><br>
<span class="items">
<group><br>
<span class="items">
<thing>stuff</thing><br>
</span>
</group><br>
<group><br>
<span class="items">
<thing>stuff</thing><br>
</span>
</group><br>
</span>
</collection><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>
<thing><br>
<span class="items">
stuff<br>
<br>
more stuff<br>
&lt;other stuff&gt;
</span>
</thing><br>
</td>
<td>
/thing=stuff<br>
/thing=<br>
/thing=more stuff<br>
/thing=<other stuff><br>
</td>
</tr><tr><td colspan="2"><hr></td>
</tr><tr>
<td><thing flag="value">stuff</thing></td>
<td>
/thing/@flag=value<br>
/thing=stuff<br>
</td>
</tr><tr><td colspan="2"><hr></td>
</tr><tr>
<td>
<?processing instruction?><br>
<thing/>
</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)).
-->
|