Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxp/src/javax/xml/XMLConstants.java
32285 views
/*1* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.xml;2627/**28* <p>Utility class to contain basic XML values as constants.</p>29*30* @author <a href="mailto:[email protected]">Jeff Suttor</a>31* @version $Revision: 1.8 $, $Date: 2010/05/25 16:19:45 $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/XML/xml-names-19990114-errata">Namespaces in XML Errata</a>38* @see <a href="http://www.w3.org/TR/xmlschema-1/">XML Schema Part 1: Structures</a>39* @since 1.540**/4142public final class XMLConstants {4344/**45* <p>Private constructor to prevent instantiation.</p>46*/47private XMLConstants() {48}4950/**51* <p>Namespace URI to use to represent that there is no Namespace.</p>52*53* <p>Defined by the Namespace specification to be "".</p>54*55* @see <a href="http://www.w3.org/TR/REC-xml-names/#defaulting">56* Namespaces in XML, 5.2 Namespace Defaulting</a>57*/58public static final String NULL_NS_URI = "";5960/**61* <p>Prefix to use to represent the default XML Namespace.</p>62*63* <p>Defined by the XML specification to be "".</p>64*65* @see <a66* href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">67* Namespaces in XML, 3. Qualified Names</a>68*/69public static final String DEFAULT_NS_PREFIX = "";7071/**72* <p>The official XML Namespace name URI.</p>73*74* <p>Defined by the XML specification to be75* "{@code http://www.w3.org/XML/1998/namespace}".</p>76*77* @see <a78* href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">79* Namespaces in XML, 3. Qualified Names</a>80*/81public static final String XML_NS_URI =82"http://www.w3.org/XML/1998/namespace";8384/**85* <p>The official XML Namespace prefix.</p>86*87* <p>Defined by the XML specification to be "{@code xml}".</p>88*89* @see <a90* href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">91* Namespaces in XML, 3. Qualified Names<</a>92*/93public static final String XML_NS_PREFIX = "xml";9495/**96* <p>The official XML attribute used for specifying XML Namespace97* declarations, {@link #XMLNS_ATTRIBUTE98* XMLConstants.XMLNS_ATTRIBUTE}, Namespace name URI.</p>99*100* <p>Defined by the XML specification to be101* "{@code http://www.w3.org/2000/xmlns/}".</p>102*103* @see <a104* href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">105* Namespaces in XML, 3. Qualified Names</a>106* @see <a107* href="http://www.w3.org/XML/xml-names-19990114-errata">108* Namespaces in XML Errata</a>109*/110public static final String XMLNS_ATTRIBUTE_NS_URI =111"http://www.w3.org/2000/xmlns/";112113/**114* <p>The official XML attribute used for specifying XML Namespace115* declarations.</p>116*117* <p>It is <strong><em>NOT</em></strong> valid to use as a118* prefix. Defined by the XML specification to be119* "{@code xmlns}".</p>120*121* @see <a122* href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">123* Namespaces in XML, 3. Qualified Names</a>124*/125public static final String XMLNS_ATTRIBUTE = "xmlns";126127/**128* <p>W3C XML Schema Namespace URI.</p>129*130* <p>Defined to be "{@code http://www.w3.org/2001/XMLSchema}".131*132* @see <a href=133* "http://www.w3.org/TR/xmlschema-1/#Instance_Document_Constructions">134* XML Schema Part 1:135* Structures, 2.6 Schema-Related Markup in Documents Being Validated</a>136*/137public static final String W3C_XML_SCHEMA_NS_URI =138"http://www.w3.org/2001/XMLSchema";139140/**141* <p>W3C XML Schema Instance Namespace URI.</p>142*143* <p>Defined to be "{@code http://www.w3.org/2001/XMLSchema-instance}".</p>144*145* @see <a href=146* "http://www.w3.org/TR/xmlschema-1/#Instance_Document_Constructions">147* XML Schema Part 1:148* Structures, 2.6 Schema-Related Markup in Documents Being Validated</a>149*/150public static final String W3C_XML_SCHEMA_INSTANCE_NS_URI =151"http://www.w3.org/2001/XMLSchema-instance";152153/**154* <p>W3C XPath Datatype Namespace URI.</p>155*156* <p>Defined to be "{@code http://www.w3.org/2003/11/xpath-datatypes}".</p>157*158* @see <a href="http://www.w3.org/TR/xpath-datamodel">XQuery 1.0 and XPath 2.0 Data Model</a>159*/160public static final String W3C_XPATH_DATATYPE_NS_URI = "http://www.w3.org/2003/11/xpath-datatypes";161162/**163* <p>XML Document Type Declaration Namespace URI as an arbitrary value.</p>164*165* <p>Since not formally defined by any existing standard, arbitrarily define to be "{@code http://www.w3.org/TR/REC-xml}".166*/167public static final String XML_DTD_NS_URI = "http://www.w3.org/TR/REC-xml";168169/**170* <p>RELAX NG Namespace URI.</p>171*172* <p>Defined to be "{@code http://relaxng.org/ns/structure/1.0}".</p>173*174* @see <a href="http://relaxng.org/spec-20011203.html">RELAX NG Specification</a>175*/176public static final String RELAXNG_NS_URI = "http://relaxng.org/ns/structure/1.0";177178/**179* <p>Feature for secure processing.</p>180*181* <ul>182* <li>183* {@code true} instructs the implementation to process XML securely.184* This may set limits on XML constructs to avoid conditions such as denial of service attacks.185* </li>186* <li>187* {@code false} instructs the implementation to process XML in accordance with the XML specifications188* ignoring security issues such as limits on XML constructs to avoid conditions such as denial of service attacks.189* </li>190* </ul>191*/192public static final String FEATURE_SECURE_PROCESSING = "http://javax.xml.XMLConstants/feature/secure-processing";193194195/**196* <p>Property: accessExternalDTD</p>197*198* <p>199* Restrict access to external DTDs and external Entity References to the protocols specified.200* If access is denied due to the restriction of this property, a runtime exception that201* is specific to the context is thrown. In the case of {@link javax.xml.parsers.SAXParser}202* for example, {@link org.xml.sax.SAXException} is thrown.203* </p>204*205* <p>206* <b>Value: </b> a list of protocols separated by comma. A protocol is the scheme portion of a207* {@link java.net.URI}, or in the case of the JAR protocol, "jar" plus the scheme portion208* separated by colon.209* A scheme is defined as:210*211* <blockquote>212* scheme = alpha *( alpha | digit | "+" | "-" | "." )<br>213* where alpha = a-z and A-Z.<br><br>214*215* And the JAR protocol:<br>216*217* jar[:scheme]<br><br>218*219* Protocols including the keyword "jar" are case-insensitive. Any whitespaces as defined by220* {@link java.lang.Character#isSpaceChar } in the value will be ignored.221* Examples of protocols are file, http, jar:file.222*223* </blockquote>224*</p>225*226*<p>227* <b>Default value:</b> The default value is implementation specific and therefore not specified.228* The following options are provided for consideration:229* <blockquote>230* <UL>231* <LI>an empty string to deny all access to external references;</LI>232* <LI>a specific protocol, such as file, to give permission to only the protocol;</LI>233* <LI>the keyword "all" to grant permission to all protocols.</LI>234*</UL><br>235* When FEATURE_SECURE_PROCESSING is enabled, it is recommended that implementations236* restrict external connections by default, though this may cause problems for applications237* that process XML/XSD/XSL with external references.238* </blockquote>239* </p>240*241* <p>242* <b>Granting all access:</b> the keyword "all" grants permission to all protocols.243* </p>244* <p>245* <b>System Property:</b> The value of this property can be set or overridden by246* system property {@code javax.xml.accessExternalDTD}.247* </p>248*249* <p>250* <b>${JAVA_HOME}/lib/jaxp.properties:</b> This configuration file is in standard251* {@link java.util.Properties} format. If the file exists and the system property is specified,252* its value will be used to override the default of the property.253* </p>254*255* <p>256*257* </p>258* @since 1.7259*/260public static final String ACCESS_EXTERNAL_DTD = "http://javax.xml.XMLConstants/property/accessExternalDTD";261262/**263* <p>Property: accessExternalSchema</p>264*265* <p>266* Restrict access to the protocols specified for external reference set by the267* schemaLocation attribute, Import and Include element. If access is denied268* due to the restriction of this property, a runtime exception that is specific269* to the context is thrown. In the case of {@link javax.xml.validation.SchemaFactory}270* for example, org.xml.sax.SAXException is thrown.271* </p>272* <p>273* <b>Value:</b> a list of protocols separated by comma. A protocol is the scheme portion of a274* {@link java.net.URI}, or in the case of the JAR protocol, "jar" plus the scheme portion275* separated by colon.276* A scheme is defined as:277*278* <blockquote>279* scheme = alpha *( alpha | digit | "+" | "-" | "." )<br>280* where alpha = a-z and A-Z.<br><br>281*282* And the JAR protocol:<br>283*284* jar[:scheme]<br><br>285*286* Protocols including the keyword "jar" are case-insensitive. Any whitespaces as defined by287* {@link java.lang.Character#isSpaceChar } in the value will be ignored.288* Examples of protocols are file, http, jar:file.289*290* </blockquote>291*</p>292*293*<p>294* <b>Default value:</b> The default value is implementation specific and therefore not specified.295* The following options are provided for consideration:296* <blockquote>297* <UL>298* <LI>an empty string to deny all access to external references;</LI>299* <LI>a specific protocol, such as file, to give permission to only the protocol;</LI>300* <LI>the keyword "all" to grant permission to all protocols.</LI>301*</UL><br>302* When FEATURE_SECURE_PROCESSING is enabled, it is recommended that implementations303* restrict external connections by default, though this may cause problems for applications304* that process XML/XSD/XSL with external references.305* </blockquote>306* </p>307* <p>308* <b>Granting all access:</b> the keyword "all" grants permission to all protocols.309* </p>310*311* <p>312* <b>System Property:</b> The value of this property can be set or overridden by313* system property {@code javax.xml.accessExternalSchema}314* </p>315*316* <p>317* <b>${JAVA_HOME}/lib/jaxp.properties:</b> This configuration file is in standard318* java.util.Properties format. If the file exists and the system property is specified,319* its value will be used to override the default of the property.320*321* @since 1.7322* </p>323*/324public static final String ACCESS_EXTERNAL_SCHEMA = "http://javax.xml.XMLConstants/property/accessExternalSchema";325326/**327* <p>Property: accessExternalStylesheet</p>328*329* <p>330* Restrict access to the protocols specified for external references set by the331* stylesheet processing instruction, Import and Include element, and document function.332* If access is denied due to the restriction of this property, a runtime exception333* that is specific to the context is thrown. In the case of constructing new334* {@link javax.xml.transform.Transformer} for example,335* {@link javax.xml.transform.TransformerConfigurationException}336* will be thrown by the {@link javax.xml.transform.TransformerFactory}.337* </p>338* <p>339* <b>Value:</b> a list of protocols separated by comma. A protocol is the scheme portion of a340* {@link java.net.URI}, or in the case of the JAR protocol, "jar" plus the scheme portion341* separated by colon.342* A scheme is defined as:343*344* <blockquote>345* scheme = alpha *( alpha | digit | "+" | "-" | "." )<br>346* where alpha = a-z and A-Z.<br><br>347*348* And the JAR protocol:<br>349*350* jar[:scheme]<br><br>351*352* Protocols including the keyword "jar" are case-insensitive. Any whitespaces as defined by353* {@link java.lang.Character#isSpaceChar } in the value will be ignored.354* Examples of protocols are file, http, jar:file.355*356* </blockquote>357*</p>358*359*<p>360* <b>Default value:</b> The default value is implementation specific and therefore not specified.361* The following options are provided for consideration:362* <blockquote>363* <UL>364* <LI>an empty string to deny all access to external references;</LI>365* <LI>a specific protocol, such as file, to give permission to only the protocol;</LI>366* <LI>the keyword "all" to grant permission to all protocols.</LI>367*</UL><br>368* When FEATURE_SECURE_PROCESSING is enabled, it is recommended that implementations369* restrict external connections by default, though this may cause problems for applications370* that process XML/XSD/XSL with external references.371* </blockquote>372* </p>373* <p>374* <b>Granting all access:</b> the keyword "all" grants permission to all protocols.375* </p>376*377* <p>378* <b>System Property:</b> The value of this property can be set or overridden by379* system property {@code javax.xml.accessExternalStylesheet}380* </p>381*382* <p>383* <b>${JAVA_HOME}/lib/jaxp.properties: </b> This configuration file is in standard384* java.util.Properties format. If the file exists and the system property is specified,385* its value will be used to override the default of the property.386*387* @since 1.7388*/389public static final String ACCESS_EXTERNAL_STYLESHEET = "http://javax.xml.XMLConstants/property/accessExternalStylesheet";390391}392393394