summaryrefslogtreecommitdiff
path: root/external/jaxp/source/org/xml/sax/package.html
blob: ee8582c3069f60c0ffc6a499612e8715d697309a (plain)
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
<html><head>
<!-- $Id: package.html,v 1.1.1.1 2003-02-01 02:10:43 cbj Exp $ -->
</head><body>

<p> This package provides the core SAX APIs.
Some SAX1 APIs are deprecated to encourage integration of
namespace-awareness into designs of new applications
and into maintainance of existing infrastructure. </p>

<p>See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
for more information about SAX.</p>


<h2> SAX2 Standard Feature Flags </h2>

<p> One of the essential characteristics of SAX2 is that it added
feature flags which can be used to examine and perhaps modify
parser modes, in particular modes such as validation.
Since features are identified by (absolute) URIs, anyone
can define such features.   
Currently defined standard feature URIs have the prefix
<code>http://xml.org/sax/features/</code> before an identifier such as
<code>validation</code>.  Turn features on or off using
<em>setFeature</em>.  Those standard identifiers are: </p>


<table border="1" cellpadding="3" cellspacing="0" width="100%">
    <tr align="center" bgcolor="#ccccff">
	<th>Feature ID</th>
	<th>Default</th>
	<th>Description</th>
	</tr>

    <tr>
	<td>external-general-entities</td>
	<td><em>unspecified</em></td>
	<td> Reports whether this parser processes external
	    general entities; always true if validating</td>
	</tr>

    <tr>
	<td>external-parameter-entities</td>
	<td><em>unspecified</em></td>
	<td> Reports whether this parser processes external
	    parameter entities; always true if validating</td>
	</tr>

    <tr>
	<td>is-standalone</td>
	<td><em>none</em></td>
	<td> May be examined only during a parse, after the
	    <em>startDocument()</em> callback has been made; read-only.
	    The value is true if the document specified the
	    "standalone" flag in its XML declaration,
	    and otherwise is false. </td>
	</tr>

    <tr>
	<td>lexical-handler/parameter-entities</td>
	<td><em>unspecified</em></td>
	<td> true indicates that the LexicalHandler will report the
	    beginning and end of parameter entities
	    </td>
	</tr>

    <tr>
	<td>namespaces</td>
	<td>true</td>
	<td> true indicates namespace URIs and unprefixed local names
	    for element and attribute names will be available </td>
	</tr>

    <tr>
	<td>namespace-prefixes</td>
	<td>false</td>
	<td> true indicates XML 1.0 names (with prefixes) and attributes
	    (including <em>xmlns*</em> attributes) will be available </td>
	</tr>

    <tr>
	<td>resolve-dtd-uris</td>
	<td><em>true</em></td>
	<td> A value of "true" indicates that system IDs in declarations will
	    be absolutized (relative to their base URIs) before reporting.
	    (That is the default behavior for all SAX2 XML parsers.)
	    A value of "false" indicates those IDs will not be absolutized;
	    parsers will provide the base URI from
	    <em>Locator.getSystemId()</em>.
	    This applies to system IDs passed in <ul>
		<li><em>DTDHandler.notationDecl()</em>,
		<li><em>DTDHandler.unparsedEntityDecl()</em>, and
		<li><em>DeclHandler.externalEntityDecl()</em>.
	    </ul>
	    It does not apply to <em>EntityResolver.resolveEntity()</em>,
	    which is not used to report declarations, or to
	    <em>LexicalHandler.startDTD()</em>, which already provides
	    the non-absolutized URI.
	    </td>
	</tr>

    <tr>
	<td>string-interning</td>
	<td><em>unspecified</em></td>
	<td> true if all XML names (for elements, prefixes, attributes,
	    entities, notations, and local names),
	    as well as Namespace URIs, will have been interned
	    using <em>java.lang.String.intern</em>. This supports fast
	    testing of equality/inequality against string constants.</td>
	</tr>

    <tr>
	<td>use-attributes2</td>
	<td><em>unspecified</em></td>
	<td> Returns true if the <em>Attributes</em> objects passed by
	    this parser in <em>ContentHandler.startElement()</em>
	    implement the <a href="ext/Attributes2.html"
	    ><em>org.xml.sax.ext.Attributes2</em></a> interface.
	    That interface exposes additional information,
	    such as whether the attribute was specified in the
	    source text rather than defaulted.
	    </td>
	</tr>

    <tr>
	<td>use-locator2</td>
	<td><em>unspecified</em></td>
	<td> Returns true if the <em>Locator</em> objects passed by
	    this parser in <em>ContentHandler.setDocumentLocator()</em>
	    implement the <a href="ext/Locator2.html"
	    ><em>org.xml.sax.ext.Locator2</em></a> interface.
	    That interface exposes additional entity information,
	    such as the character encoding and XML version used.
	    </td>
	</tr>

    <tr>
	<td>use-entity-resolver2</td>
	<td><em>true</em> (when recognized)</td>
	<td> Returns true if, when <em>setEntityResolver</em> is given
	    an object implementing the <a href="ext/EntityResolver2.html"
	    ><em>org.xml.sax.ext.EntityResolver2</em></a> interface,
	    those new methods will be used.
	    Returns false to indicate that those methods will not be used.
	    </td>
	</tr>

    <tr>
	<td>validation</td>
	<td><em>unspecified</em></td>
	<td> controls whether the parser is reporting all validity
	    errors; if true, all external entities will be read.  </td>
	</tr>

</table>

<p> Support for the default values of the
<em>namespaces</em> and <em>namespace-prefixes</em>
properties is required.
</p>

<p> For default values not specified by SAX2,
each XMLReader implementation specifies its default,
or may choose not to expose the feature flag.
Unless otherwise specified here,
implementations may support changing current values
of these standard feature flags, but not while parsing.
</p>

<h2> SAX2 Standard Handler and Property IDs </h2>

<p> For parser interface characteristics that are described
as objects, a separate namespace is defined.  The
objects in this namespace are again identified by URI, and
the standard property URIs have the prefix
<code>http://xml.org/sax/properties/</code> before an identifier such as
<code>lexical-handler</code> or
<code>dom-node</code>.  Manage those properties using
<em>setProperty()</em>.  Those identifiers are: </p>

<table border="1" cellpadding="3" cellspacing="0" width="100%">
    <tr align="center" bgcolor="#ccccff">
	<th>Property ID</th>
	<th>Description</th>
	</tr>

    <tr>
	<td>declaration-handler</td>
	<td> Used to see most DTD declarations except those treated
	    as lexical ("document element name is ...") or which are
	    mandatory for all SAX parsers (<em>DTDHandler</em>).
	    The Object must implement <a href="ext/DeclHandler.html"
	    ><em>org.xml.sax.ext.DeclHandler</em></a>.
	    </td>
	</tr>

    <tr>
	<td>dom-node</td>
	<td> For "DOM Walker" style parsers, which ignore their
	    <em>parser.parse()</em> parameters, this is used to
	    specify the DOM (sub)tree being walked by the parser.
	    The Object must implement the
	    <em>org.w3c.dom.Node</em> interface.
	    </td>
	</tr>

    <tr>
	<td>lexical-handler</td>
	<td> Used to see some syntax events that are essential in some
	    applications:  comments, CDATA delimeters, selected general
	    entity inclusions, and the start and end of the DTD
	    (and declaration of document element name).
	    The Object must implement <a href="ext/LexicalHandler.html"
	    ><em>org.xml.sax.ext.LexicalHandler</em></a>.
	    </td>
	</tr>

    <tr>
	<td>xml-string</td>
	<td> Readable only during a parser callback, this exposes a <b>TBS</b>
	    chunk of characters responsible for the current event. </td>
	</tr>

</table>

<p> All of these standard properties are optional;
XMLReader implementations need not support them.
</p>

</body></html>