1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements.  See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License.  You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 // $Id: XMLConstants.java 584477 2007-10-14 02:44:03Z mrglavas $
19 
20 package javax.xml;
21 
22 /**
23  * <p>Utility class to contain basic XML values as constants.</p>
24  *
25  * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a>
26  * @version $Revision: 584477 $, $Date: 2007-10-13 19:44:03 -0700 (Sat, 13 Oct 2007) $
27  * @see <a href="http://www.w3.org/TR/xml11/">Extensible Markup Language (XML) 1.1</a>
28  * @see <a href="http://www.w3.org/TR/REC-xml">Extensible Markup Language (XML) 1.0 (Second Edition)</a>
29  * @see <a href="http://www.w3.org/XML/xml-V10-2e-errata">XML 1.0 Second Edition Specification Errata</a>
30  * @see <a href="http://www.w3.org/TR/xml-names11/">Namespaces in XML 1.1</a>
31  * @see <a href="http://www.w3.org/TR/REC-xml-names">Namespaces in XML</a>
32  * @see <a href="http://www.w3.org/XML/xml-names-19990114-errata">Namespaces in XML Errata</a>
33  * @see <a href="http://www.w3.org/TR/xmlschema-1/">XML Schema Part 1: Structures</a>
34  * @since 1.5
35  **/
36 public final class XMLConstants {
37 
38     /**
39      * <p>Private constructor to prevent instantiation.</p>
40      */
XMLConstants()41     private XMLConstants() {
42     }
43 
44     /**
45      * <p>Namespace URI to use to represent that there is no Namespace.</p>
46      *
47      * <p>Defined by the Namespace specification to be "".</p>
48      *
49      * @see <a href="http://www.w3.org/TR/REC-xml-names/#defaulting">
50      * Namespaces in XML, 5.2 Namespace Defaulting</a>
51      */
52     public static final String NULL_NS_URI = "";
53 
54     /**
55      * <p>Prefix to use to represent the default XML Namespace.</p>
56      *
57      * <p>Defined by the XML specification to be "".</p>
58      *
59      * @see <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">
60      * Namespaces in XML, 3. Qualified Names</a>
61      */
62     public static final String DEFAULT_NS_PREFIX = "";
63 
64     /**
65      * <p>The official XML Namespace name URI.</p>
66      *
67      * <p>Defined by the XML specification to be
68      * "<code>http://www.w3.org/XML/1998/namespace</code>".</p>
69      *
70      * @see <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">
71      * Namespaces in XML, 3. Qualified Names</a>
72      */
73     public static final String XML_NS_URI =
74         "http://www.w3.org/XML/1998/namespace";
75 
76     /**
77      * <p>The official XML Namespace prefix.</p>
78      *
79      * <p>Defined by the XML specification to be "<code>xml</code>".</p>
80      *
81      * @see <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">
82      * Namespaces in XML, 3. Qualified Names</a>
83      */
84     public static final String XML_NS_PREFIX = "xml";
85 
86     /**
87      * <p>The official XML attribute used for specifying XML Namespace
88      * declarations, {@link #XMLNS_ATTRIBUTE
89      * XMLConstants.XMLNS_ATTRIBUTE}, Namespace name URI.</p>
90      *
91      * <p>Defined by the XML specification to be
92      * "<code>http://www.w3.org/2000/xmlns/</code>".</p>
93      *
94      * @see <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">
95      * Namespaces in XML, 3. Qualified Names</a>
96      * @see <a href="http://www.w3.org/XML/xml-names-19990114-errata/">
97      * Namespaces in XML Errata</a>
98      */
99     public static final String XMLNS_ATTRIBUTE_NS_URI =
100         "http://www.w3.org/2000/xmlns/";
101 
102     /**
103      * <p>The official XML attribute used for specifying XML Namespace
104      * declarations.</p>
105      *
106      * <p>It is <strong><em>NOT</em></strong> valid to use as a
107      * prefix.  Defined by the XML specification to be
108      * "<code>xmlns</code>".</p>
109      *
110      * @see <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">
111      * Namespaces in XML, 3. Qualified Names</a>
112      */
113     public static final String XMLNS_ATTRIBUTE = "xmlns";
114 
115     /**
116      * <p>W3C XML Schema Namespace URI.</p>
117      *
118      * <p>Defined to be "<code>http://www.w3.org/2001/XMLSchema</code>".
119      *
120      * @see <a href="http://www.w3.org/TR/xmlschema-1/#Instance_Document_Constructions">
121      *  XML Schema Part 1:
122      *  Structures, 2.6 Schema-Related Markup in Documents Being Validated</a>
123      */
124     public static final String W3C_XML_SCHEMA_NS_URI =
125         "http://www.w3.org/2001/XMLSchema";
126 
127     /**
128      * <p>W3C XML Schema Instance Namespace URI.</p>
129      *
130      * <p>Defined to be "<code>http://www.w3.org/2001/XMLSchema-instance</code>".</p>
131      *
132      * @see <a href="http://www.w3.org/TR/xmlschema-1/#Instance_Document_Constructions">
133      *  XML Schema Part 1:
134      *  Structures, 2.6 Schema-Related Markup in Documents Being Validated</a>
135      */
136     public static final String W3C_XML_SCHEMA_INSTANCE_NS_URI =
137         "http://www.w3.org/2001/XMLSchema-instance";
138 
139     /**
140      * <p>W3C XPath Datatype Namespace URI.</p>
141      *
142      * <p>Defined to be "<code>http://www.w3.org/2003/11/xpath-datatypes</code>".</p>
143      *
144      * @see <a href="http://www.w3.org/TR/xpath-datamodel">XQuery 1.0 and XPath 2.0 Data Model</a>
145      */
146     public static final String W3C_XPATH_DATATYPE_NS_URI = "http://www.w3.org/2003/11/xpath-datatypes";
147 
148     /**
149      * <p>XML Document Type Declaration Namespace URI as an arbitrary value.</p>
150      *
151      * <p>Since not formally defined by any existing standard, arbitrarily define to be "<code>http://www.w3.org/TR/REC-xml</code>".
152      */
153     public static final String XML_DTD_NS_URI = "http://www.w3.org/TR/REC-xml";
154 
155     /**
156      * <p>RELAX NG Namespace URI.</p>
157      *
158      * <p>Defined to be "<code>http://relaxng.org/ns/structure/1.0</code>".</p>
159      *
160      * @see <a href="http://relaxng.org/spec-20011203.html">RELAX NG Specification</a>
161      */
162     public static final String RELAXNG_NS_URI = "http://relaxng.org/ns/structure/1.0";
163 
164     /**
165      * <p>Feature for secure processing.</p>
166      *
167      * <ul>
168      *   <li>
169      *     <code>true</code> instructs the implementation to process XML securely.
170      *     This may set limits on XML constructs to avoid conditions such as denial of service attacks.
171      *   </li>
172      *   <li>
173      *     <code>false</code> instructs the implementation to process XML according to the letter of the XML specifications
174      *     ignoring security issues such as limits on XML constructs to avoid conditions such as denial of service attacks.
175      *   </li>
176      * </ul>
177      */
178     public static final String FEATURE_SECURE_PROCESSING = "http://javax.xml.XMLConstants/feature/secure-processing";
179 }
180