-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
220 lines (198 loc) · 6.3 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<title>SGML Parser Reader</title>
<meta name="google-site-verification" content="QHAlKcrWPVc9YWh-J9gpsVwHfc9_NTLqEAqUVaGzrwg" />
<meta name="description"
content="Simple API for SGML (SAS) is an event-driven, serial-access mechanism for accessing SGML documents with JAVA.">
<meta name="author" content="Hamdi KARRAY" />
<link rel="stylesheet" href="index.css">
</head>
<body>
<h1>Simple API for SGML</h1>
<p>Simple API for SGML (SAS) is an event-driven, serial-access mechanism for accessing SGML
documents with JAVA.<br /> Very similar to SAX it allows you to handle events :</p>
<ul>
<li>Error Handler : to handle warning, error and fatal erros</li>
<li>Declaration Handler : events related to the parsing of the SGML declaration
part</li>
<li>Definition Handler : events related to the parsing of the SGML definition part
(DTD)</li>
<li>Instance Handler : events related to the parsing of the SGML document it self</li>
</ul>
<p>Very simple to use, it allows you also to deal with the SGML document as XML document
:</p>
<ul>
<li>
<p>Convert from SGML to XML with many options</p>
</li>
<li>
<p>Convert from XML back to SGML</p>
<ul>
<li>infine allows converting from SGML to SGML</li>
<li>transparency : dealing only with XML</li>
</ul>
</li>
<li>
<p>Transforming SGML with XSLT transform for various engine like SAXON API (directly
as a source or throw extension function)</p>
</li>
<li>
<p>Thread SAFE : very usefull for big data</p>
</li>
</ul>
<h2>Usage</h2>
<p>Like SAX, we need to declare a Reader :</p>
<pre><code>final SASParserFactory factory = SASParserFactory.newInstance();
factory.setValidating(true);
final CatalogResolver catalogResolver = new CatalogResolver();
catalogResolver.addCatalog("file:/d:/sgml/sgml.catalog");
SASParser parser = factory.newSASParser();
Reader reader = parser.getSGMLReader();
reader.setEntityResolver(catalogResolver);
</code></pre>
<p>This is a catalog sample :</p>
<pre><code>
SGMLDECL "docbook.dec"
PUBLIC "ISO 8879-1986//ENTITIES Added Latin 1//EN" "entities/Isolat1.ent"
DOCTYPE BOOK "doctypes/book.dtd"
</code></pre>
<p>
<strong>The SGMLDECL and the DOCTYPE entries are mandatory.</strong>
</p>
<p>For dealing with SGML events :</p>
<pre><code>reader.setInstanceHandler(new InstanceHandler() {
@Override
public void startElement(String[] grpList, String qName) throws SASException {
}
@Override
public void startElement(String qName) throws SASException {
}
@Override
public void startDocument() throws SASException {
}
@Override
public void startContent() throws SASException {
}
@Override
public void setDocumentLocator(Locator locator) {
}
@Override
public void processingInstruction(String content) throws SASException {
}
@Override
public void endElement(String[] grpList, String qName) throws SASException {
}
@Override
public void endElement(String qName) throws SASException {
}
@Override
public void endDocument() throws SASException {
}
@Override
public void emptyStartElement() throws SASException {
}
@Override
public void emptyEndElement() throws SASException {
}
@Override
public void comment(String string) throws SASException {
}
@Override
public void characters(char[] ch, int start, int length) throws SASException {
}
@Override
public void attribute(String qName, String value) throws SASException {
}
});
reader.parse(new InputSource("file:/d:/sgml/file.sgm"));
</code></pre>
<p>or more simple for converting to XML document :</p>
<pre><code>
XMLReader xr = reader.asXMLReader();
Source src = new SAXSource(xr, new InputSource("file:/d:/sgml/file.sgm"));
Result res = new StreamResult("file:/d:/sgml/file.xml");
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.transform(src, res);
</code></pre>
<p>We can configure the SASParserFactory :</p>
<pre><code>factory.setFeature(SASParserFeatures.QUANTITY_CHECKING, true);
factory.setFeature(SASParserFeatures.CAPACITY_CHECKING, false);
factory.setFeature(SASParserFeatures.ID_REF_CHECKING, true);
</code></pre>
<h2>Version</h2>
<h3>Home Edition</h3>
<p>See the <a
href="https://hamdikarray.github.io/simple-api-for-sgml-dist/docs/he/apidocs/index.html"
>documentation</a></p>
<p>This is an evaluation version with some features desactivated :</p>
<ul>
<li>Fully java support for SAS like support, conversion in XML, parsing SGML
declarartion and DTD definition</li>
<li>Some SGML declaration features not supported : DATATAG, RANK</li>
<li>Somme DTD features not supported : USEMAP, PIENTITY, STARTAGENTITY, ENDTAGENTITY and
MSENTITY</li>
<li>Some instance handler event deactivated for entities and attrbutes : all event fired
as character event or ignored</li>
<li>Limited time evaluation : Evaluation licenses must not be used for production work.
On about 1% of time, it will insert random asterisks into serialized output.</li>
</ul>
<h3>Professional Edition</h3>
<p>See the <a
href="https://hamdikarray.github.io/simple-api-for-sgml-dist/docs/pe/apidocs/index.html"
>documentation</a></p>
<p>adds a number of features to HE version :</p>
<ul>
<li>All SGML declaration features supported</li>
<li>All DTD features supported</li>
<li>Fully instance handler event support</li>
</ul>
<h3>Entreprise Edition (coming soon)</h3>
<p>The fully-featured product with in addition :</p>
<ul>
<li>SGML reader and writer support : <ul>
<li>Directly for performance</li>
<li>Transparency with XML support</li>
</ul>
</li>
<li>DTD canonizing</li>
<li>...</li>
</ul>
<h2>Evaluation</h2>
<p>For PE or EE version, please create an issue with the following informations :</p>
<table>
<thead>
<tr>
<th>Information</th>
<th> </th>
</tr>
</thead>
<tbody>
<tr>
<td>* First Name</td>
<td> </td>
</tr>
<tr>
<td>* Last Name</td>
<td> </td>
</tr>
<tr>
<td>Company</td>
<td> </td>
</tr>
<tr>
<td>* Country</td>
<td> </td>
</tr>
<tr>
<td>* Email</td>
<td> </td>
</tr>
<tr>
<td>Phone</td>
<td> </td>
</tr>
</tbody>
</table>
</body>
</html>