Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.xml/share/classes/javax/xml/XMLConstants.java
40948 views
1
/*
2
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package javax.xml;
27
28
/**
29
* <p>Utility class to contain basic XML values as constants.
30
*
31
* @author Jeff Suttor
32
* @see <a href="http://www.w3.org/TR/xml11/">Extensible Markup Language (XML) 1.1</a>
33
* @see <a href="http://www.w3.org/TR/REC-xml">Extensible Markup Language (XML) 1.0 (Second Edition)</a>
34
* @see <a href="http://www.w3.org/XML/xml-V10-2e-errata">XML 1.0 Second Edition Specification Errata</a>
35
* @see <a href="http://www.w3.org/TR/xml-names11/">Namespaces in XML 1.1</a>
36
* @see <a href="http://www.w3.org/TR/REC-xml-names">Namespaces in XML</a>
37
* @see <a href="http://www.w3.org/TR/xmlschema-1/">XML Schema Part 1: Structures</a>
38
* @since 1.5
39
**/
40
41
public final class XMLConstants {
42
43
/**
44
* Private constructor to prevent instantiation.
45
*/
46
private XMLConstants() {
47
}
48
49
/**
50
* Namespace URI to use to represent that there is no Namespace.
51
*
52
* <p>Defined by the Namespace specification to be "".
53
*
54
* @see <a href="http://www.w3.org/TR/REC-xml-names/#defaulting">
55
* Namespaces in XML, 5.2 Namespace Defaulting</a>
56
*/
57
public static final String NULL_NS_URI = "";
58
59
/**
60
* Prefix to use to represent the default XML Namespace.
61
*
62
* <p>Defined by the XML specification to be "".
63
*
64
* @see <a
65
* href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">
66
* Namespaces in XML, 3. Qualified Names</a>
67
*/
68
public static final String DEFAULT_NS_PREFIX = "";
69
70
/**
71
* The official XML Namespace name URI.
72
*
73
* <p>Defined by the XML specification to be
74
* "{@code http://www.w3.org/XML/1998/namespace}".
75
*
76
* @see <a
77
* href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">
78
* Namespaces in XML, 3. Qualified Names</a>
79
*/
80
public static final String XML_NS_URI =
81
"http://www.w3.org/XML/1998/namespace";
82
83
/**
84
* The official XML Namespace prefix.
85
*
86
* <p>Defined by the XML specification to be "{@code xml}".
87
*
88
* @see <a
89
* href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">
90
* Namespaces in XML, 3. Qualified Names</a>
91
*/
92
public static final String XML_NS_PREFIX = "xml";
93
94
/**
95
* The official XML attribute used for specifying XML Namespace
96
* declarations, {@link #XMLNS_ATTRIBUTE
97
* XMLConstants.XMLNS_ATTRIBUTE}, Namespace name URI.
98
*
99
* <p>Defined by the XML specification to be
100
* "{@code http://www.w3.org/2000/xmlns/}".
101
*
102
* @see <a
103
* href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">
104
* Namespaces in XML, 3. Qualified Names</a>
105
*/
106
public static final String XMLNS_ATTRIBUTE_NS_URI =
107
"http://www.w3.org/2000/xmlns/";
108
109
/**
110
* The official XML attribute used for specifying XML Namespace
111
* declarations.
112
*
113
* <p>It is <strong><em>NOT</em></strong> valid to use as a
114
* prefix. Defined by the XML specification to be
115
* "{@code xmlns}".
116
*
117
* @see <a
118
* href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">
119
* Namespaces in XML, 3. Qualified Names</a>
120
*/
121
public static final String XMLNS_ATTRIBUTE = "xmlns";
122
123
/**
124
* W3C XML Schema Namespace URI.
125
*
126
* <p>Defined to be "{@code http://www.w3.org/2001/XMLSchema}".
127
*
128
* @see <a href=
129
* "http://www.w3.org/TR/xmlschema-1/#Instance_Document_Constructions">
130
* XML Schema Part 1:
131
* Structures, 2.6 Schema-Related Markup in Documents Being Validated</a>
132
*/
133
public static final String W3C_XML_SCHEMA_NS_URI =
134
"http://www.w3.org/2001/XMLSchema";
135
136
/**
137
* W3C XML Schema Instance Namespace URI.
138
*
139
* <p>Defined to be "{@code http://www.w3.org/2001/XMLSchema-instance}".
140
*
141
* @see <a href=
142
* "http://www.w3.org/TR/xmlschema-1/#Instance_Document_Constructions">
143
* XML Schema Part 1:
144
* Structures, 2.6 Schema-Related Markup in Documents Being Validated</a>
145
*/
146
public static final String W3C_XML_SCHEMA_INSTANCE_NS_URI =
147
"http://www.w3.org/2001/XMLSchema-instance";
148
149
/**
150
* W3C XPath Datatype Namespace URI.
151
*
152
* <p>Defined to be "{@code http://www.w3.org/2003/11/xpath-datatypes}".
153
*
154
* @see <a href="http://www.w3.org/TR/xpath-datamodel">XQuery 1.0 and XPath 2.0 Data Model</a>
155
*/
156
public static final String W3C_XPATH_DATATYPE_NS_URI = "http://www.w3.org/2003/11/xpath-datatypes";
157
158
/**
159
* XML Document Type Declaration Namespace URI as an arbitrary value.
160
*
161
* <p>Since not formally defined by any existing standard, arbitrarily define to be "{@code http://www.w3.org/TR/REC-xml}".
162
*/
163
public static final String XML_DTD_NS_URI = "http://www.w3.org/TR/REC-xml";
164
165
/**
166
* RELAX NG Namespace URI.
167
*
168
* <p>Defined to be "{@code http://relaxng.org/ns/structure/1.0}".
169
*
170
* @see <a href="http://relaxng.org/spec-20011203.html">RELAX NG Specification</a>
171
*/
172
public static final String RELAXNG_NS_URI = "http://relaxng.org/ns/structure/1.0";
173
174
/**
175
* Feature for secure processing.
176
*
177
* <ul>
178
* <li>
179
* {@code true} instructs the implementation to process XML securely.
180
* This may set limits on XML constructs to avoid conditions such as denial of service attacks.
181
* </li>
182
* <li>
183
* {@code false} instructs the implementation to process XML in accordance with the XML specifications
184
* ignoring security issues such as limits on XML constructs to avoid conditions such as denial of service attacks.
185
* </li>
186
* </ul>
187
*/
188
public static final String FEATURE_SECURE_PROCESSING = "http://javax.xml.XMLConstants/feature/secure-processing";
189
190
191
/**
192
* Property: accessExternalDTD
193
*
194
* <p>
195
* Restrict access to external DTDs and external Entity References to the protocols specified.
196
* If access is denied due to the restriction of this property, a runtime exception that
197
* is specific to the context is thrown. In the case of {@link javax.xml.parsers.SAXParser}
198
* for example, {@link org.xml.sax.SAXException} is thrown.
199
*
200
* <p>
201
* <b>Value: </b> a list of protocols separated by comma. A protocol is the scheme portion of a
202
* {@link java.net.URI}, or in the case of the JAR protocol, "jar" plus the scheme portion
203
* separated by colon.
204
* A scheme is defined as:
205
*
206
* <blockquote>
207
* scheme = alpha *( alpha | digit | "+" | "-" | "." )<br>
208
* where alpha = a-z and A-Z.<br><br>
209
*
210
* And the JAR protocol:<br>
211
*
212
* jar[:scheme]<br><br>
213
*
214
* Protocols including the keyword "jar" are case-insensitive. Any whitespaces as defined by
215
* {@link java.lang.Character#isSpaceChar } in the value will be ignored.
216
* Examples of protocols are file, http, jar:file.
217
*
218
* </blockquote>
219
*
220
*<p>
221
* <b>Default value:</b> The default value is implementation specific and therefore not specified.
222
* The following options are provided for consideration:
223
* <blockquote>
224
* <UL>
225
* <LI>an empty string to deny all access to external references;</LI>
226
* <LI>a specific protocol, such as file, to give permission to only the protocol;</LI>
227
* <LI>the keyword "all" to grant permission to all protocols.</LI>
228
* </UL><br>
229
* When FEATURE_SECURE_PROCESSING is enabled, it is recommended that implementations
230
* restrict external connections by default, though this may cause problems for applications
231
* that process XML/XSD/XSL with external references.
232
* </blockquote>
233
*
234
* <p>
235
* <b>Granting all access:</b> the keyword "all" grants permission to all protocols.
236
*
237
* <p>
238
* <b>System Property:</b> The value of this property can be set or overridden by
239
* system property {@code javax.xml.accessExternalDTD}.
240
*
241
*
242
* <p>
243
* <b>jaxp.properties:</b> This configuration file is in standard
244
* {@link java.util.Properties} format and typically located in the {@code conf}
245
* directory of the Java installation. If the file exists and the system
246
* property is specified, its value will be used to override the default
247
* of the property.
248
*
249
*
250
* @since 1.7
251
*/
252
public static final String ACCESS_EXTERNAL_DTD = "http://javax.xml.XMLConstants/property/accessExternalDTD";
253
254
/**
255
* <p>Property: accessExternalSchema</p>
256
*
257
* <p>
258
* Restrict access to the protocols specified for external reference set by the
259
* schemaLocation attribute, Import and Include element. If access is denied
260
* due to the restriction of this property, a runtime exception that is specific
261
* to the context is thrown. In the case of {@link javax.xml.validation.SchemaFactory}
262
* for example, org.xml.sax.SAXException is thrown.
263
*
264
* <p>
265
* <b>Value:</b> a list of protocols separated by comma. A protocol is the scheme portion of a
266
* {@link java.net.URI}, or in the case of the JAR protocol, "jar" plus the scheme portion
267
* separated by colon.
268
* A scheme is defined as:
269
*
270
* <blockquote>
271
* scheme = alpha *( alpha | digit | "+" | "-" | "." )<br>
272
* where alpha = a-z and A-Z.<br><br>
273
*
274
* And the JAR protocol:<br>
275
*
276
* jar[:scheme]<br><br>
277
*
278
* Protocols including the keyword "jar" are case-insensitive. Any whitespaces as defined by
279
* {@link java.lang.Character#isSpaceChar } in the value will be ignored.
280
* Examples of protocols are file, http, jar:file.
281
*
282
* </blockquote>
283
*
284
* <p>
285
* <b>Default value:</b> The default value is implementation specific and therefore not specified.
286
* The following options are provided for consideration:
287
* <blockquote>
288
* <UL>
289
* <LI>an empty string to deny all access to external references;</LI>
290
* <LI>a specific protocol, such as file, to give permission to only the protocol;</LI>
291
* <LI>the keyword "all" to grant permission to all protocols.</LI>
292
* </UL><br>
293
* When FEATURE_SECURE_PROCESSING is enabled, it is recommended that implementations
294
* restrict external connections by default, though this may cause problems for applications
295
* that process XML/XSD/XSL with external references.
296
* </blockquote>
297
*
298
* <p>
299
* <b>Granting all access:</b> the keyword "all" grants permission to all protocols.
300
*
301
* <p>
302
* <b>System Property:</b> The value of this property can be set or overridden by
303
* system property {@code javax.xml.accessExternalSchema}
304
*
305
* <p>
306
* <b>jaxp.properties:</b> This configuration file is in standard
307
* {@link java.util.Properties} format and typically located in the {@code conf}
308
* directory of the Java installation. If the file exists and the system
309
* property is specified, its value will be used to override the default
310
* of the property.
311
*
312
* @since 1.7
313
*/
314
public static final String ACCESS_EXTERNAL_SCHEMA = "http://javax.xml.XMLConstants/property/accessExternalSchema";
315
316
/**
317
* Property: accessExternalStylesheet
318
*
319
* <p>
320
* Restrict access to the protocols specified for external references set by the
321
* stylesheet processing instruction, Import and Include element, and document function.
322
* If access is denied due to the restriction of this property, a runtime exception
323
* that is specific to the context is thrown. In the case of constructing new
324
* {@link javax.xml.transform.Transformer} for example,
325
* {@link javax.xml.transform.TransformerConfigurationException}
326
* will be thrown by the {@link javax.xml.transform.TransformerFactory}.
327
*
328
* <p>
329
* <b>Value:</b> a list of protocols separated by comma. A protocol is the scheme portion of a
330
* {@link java.net.URI}, or in the case of the JAR protocol, "jar" plus the scheme portion
331
* separated by colon.
332
* A scheme is defined as:
333
*
334
* <blockquote>
335
* scheme = alpha *( alpha | digit | "+" | "-" | "." )<br>
336
* where alpha = a-z and A-Z.<br><br>
337
*
338
* And the JAR protocol:<br>
339
*
340
* jar[:scheme]<br><br>
341
*
342
* Protocols including the keyword "jar" are case-insensitive. Any whitespaces as defined by
343
* {@link java.lang.Character#isSpaceChar } in the value will be ignored.
344
* Examples of protocols are file, http, jar:file.
345
*
346
* </blockquote>
347
*
348
* <p>
349
* <b>Default value:</b> The default value is implementation specific and therefore not specified.
350
* The following options are provided for consideration:
351
* <blockquote>
352
* <UL>
353
* <LI>an empty string to deny all access to external references;</LI>
354
* <LI>a specific protocol, such as file, to give permission to only the protocol;</LI>
355
* <LI>the keyword "all" to grant permission to all protocols.</LI>
356
* </UL><br>
357
* When FEATURE_SECURE_PROCESSING is enabled, it is recommended that implementations
358
* restrict external connections by default, though this may cause problems for applications
359
* that process XML/XSD/XSL with external references.
360
* </blockquote>
361
*
362
* <p>
363
* <b>Granting all access:</b> the keyword "all" grants permission to all protocols.
364
*
365
* <p>
366
* <b>System Property:</b> The value of this property can be set or overridden by
367
* system property {@code javax.xml.accessExternalStylesheet}
368
*
369
* <p>
370
* <b>jaxp.properties:</b> This configuration file is in standard
371
* {@link java.util.Properties} format and typically located in the {@code conf}
372
* directory of the Java installation. If the file exists and the system
373
* property is specified, its value will be used to override the default
374
* of the property.
375
*
376
* @since 1.7
377
*/
378
public static final String ACCESS_EXTERNAL_STYLESHEET = "http://javax.xml.XMLConstants/property/accessExternalStylesheet";
379
380
381
/**
382
* Feature: useCatalog
383
*
384
* <p>
385
* Instructs XML processors to use XML Catalogs to resolve entity references.
386
* Catalogs may be set through JAXP factories, system properties, or
387
* jaxp.properties by using the {@code javax.xml.catalog.files} property
388
* defined in {@link javax.xml.catalog.CatalogFeatures}.
389
* The following code enables Catalog on SAX parser:
390
* <pre>{@code
391
* SAXParserFactory spf = SAXParserFactory.newInstance();
392
* spf.setFeature(XMLConstants.USE_CATALOG, true);
393
* SAXParser parser = spf.newSAXParser();
394
* parser.setProperty(CatalogFeatures.Feature.FILES.getPropertyName(), "catalog.xml");
395
* }</pre>
396
*
397
* <p>
398
* <b>Value:</b> a boolean. If the value is true, and a catalog is set,
399
* the XML parser will resolve external references using
400
* {@link javax.xml.catalog.CatalogResolver}. If the value is false,
401
* XML Catalog is ignored even if one is set. The default value is true.
402
*
403
* <p>
404
* <b>System Property:</b> The value of this property can be set or overridden by
405
* system property {@code javax.xml.useCatalog}
406
*
407
* <p>
408
* <b>jaxp.properties:</b> This configuration file is in standard
409
* {@link java.util.Properties} format and typically located in the {@code conf}
410
* directory of the Java installation. If the file exists and the system
411
* property is specified, its value will be used to override the default
412
* value of the property.
413
*
414
* @since 9
415
*/
416
public static final String USE_CATALOG = "http://javax.xml.XMLConstants/feature/useCatalog";
417
418
}
419
420