1 /*
2  * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
3  */
4 /*
5  * Licensed to the Apache Software Foundation (ASF) under one
6  * or more contributor license agreements. See the NOTICE file
7  * distributed with this work for additional information
8  * regarding copyright ownership. The ASF licenses this file
9  * to you under the Apache License, Version 2.0 (the  "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *     http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 package com.sun.org.apache.xml.internal.serializer.dom3;
23 
24 import com.sun.org.apache.xerces.internal.impl.Constants;
25 
26 /**
27  * DOM Constants used by the DOM Level 3 LSSerializer implementation.
28  *
29  * @xsl.usage internal
30  * @LastModified: Jan 2021
31  */
32 public final class DOMConstants {
33     //
34     // Constants: DOM Level 3 feature ids
35     //
36     public static final String DOM3_REC_URL = "http://www.w3.org/TR/DOM-Level-3-LS";
37 
38     public static final String XERCES_URL = "http://xml.apache.org/xerces-2j";
39 
40     public static final String ORACLE_URL = "http://www.oracle.com/xml";
41 
42     // The namespace used to qualified DOM Level 3 DOMConfiguration parameters
43     public static final String S_DOM3_PROPERTIES_NS = "{"
44             + DOMConstants.DOM3_REC_URL + "}";
45 
46     public static final String S_XERCES_PROPERTIES_NS = "{"
47             + DOMConstants.XERCES_URL + "}";
48 
49     // The namespace used for the JDK-only parameters
50     public static final String S_JDK_PROPERTIES_NS = "{" + ORACLE_URL + "}";
51 
52     // xmlns namespaces
53     private static final String XMLNS_URI = "http://www.w3.org/2000/xmlns/";
54 
55     // namespace prefix
56     private static final String XMLNS_PREFIX = "xmlns";
57 
58     // ************************************************************************
59     // DOM Level 3 DOM Configuration parameter names
60     // ************************************************************************
61     // DOM Level 3 parameters defined in Core
62     public static final String DOM_CANONICAL_FORM = "canonical-form"; // Unsupported, we only appear to support this
63 
64     public static final String DOM_CDATA_SECTIONS = "cdata-sections";
65 
66     public static final String DOM_CHECK_CHAR_NORMALIZATION = "check-character-normalization"; // Unsupported
67 
68     public static final String DOM_COMMENTS = "comments";
69 
70     public static final String DOM_DATATYPE_NORMALIZATION = "datatype-normalization"; // Unsupported
71 
72     public static final String DOM_ELEMENT_CONTENT_WHITESPACE = "element-content-whitespace";
73 
74     public static final String DOM_ENTITIES = "entities";
75 
76     public static final String DOM_INFOSET = "infoset";
77 
78     public static final String DOM_NAMESPACES = "namespaces";
79 
80     public static final String DOM_NAMESPACE_DECLARATIONS = "namespace-declarations";
81 
82     public static final String DOM_NORMALIZE_CHARACTERS = "normalize-characters"; // Unsupported
83 
84     public static final String DOM_SPLIT_CDATA = "split-cdata-sections";
85 
86     public static final String DOM_VALIDATE_IF_SCHEMA = "validate-if-schema"; // Unsopported
87 
88     public static final String DOM_VALIDATE = "validate"; // Unsopported
89 
90     public static final String DOM_WELLFORMED = "well-formed";
91 
92     // DOM Level 3 Save
93     public static final String DOM_DISCARD_DEFAULT_CONTENT = "discard-default-content";
94 
95     public static final String DOM_FORMAT_PRETTY_PRINT = "format-pretty-print";
96 
97     public static final String DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS = "ignore-unknown-character-denormalizations"; // Unsupported
98 
99     public static final String DOM_XMLDECL = "xml-declaration";
100 
101     // DOM Properties
102     public static final String DOM_ERROR_HANDLER = "error-handler";
103 
104     public static final String DOM_SCHEMA_TYPE = "schema-type"; // Unsupported
105 
106     public static final String DOM_SCHEMA_LOCATION = "schema-location"; // Unsupported
107 
108     // ************************************************************************
109 
110     // XSL Output properties
111     // The xsl:output 'indent' property used in LSSerializer
112     public static final String S_XSL_OUTPUT_INDENT = "indent";
113 
114     // The xsl:output 'indent' property used in LSSerializer
115     public static final String S_XSL_OUTPUT_ENCODING = "encoding";
116 
117     // The xsl:output 'omit-xml-declaration' property used in LSSerializer
118     public static final String S_XSL_OUTPUT_OMIT_XML_DECL = "omit-xml-declaration";
119 
120     // The xerces serializer specific 'omit-xml-declaration' property used in LSSerializer
121     public static final String S_XML_VERSION = "xml-version";
122 
123     /**
124      * Indicates that the serializer should treat the output as a standalone document.
125      * The JDK specific standalone property controls whether a newline should be
126      * added after the XML header.
127      *
128      * @see similar property ORACLE_IS_STANDALONE in OutputPropertiesFactory.
129      */
130     public static final String S_IS_STANDALONE = "isStandalone";
131 
132     // Fully-qualified property name with the JDK Impl prefix
133     public static final String FQ_IS_STANDALONE =
134             Constants.ORACLE_JAXP_PROPERTY_PREFIX + S_IS_STANDALONE;
135 
136     // The property with namespace as the internal DOMConfiguration format
137     public static final String NS_IS_STANDALONE = S_JDK_PROPERTIES_NS + S_IS_STANDALONE;
138 
139     // Corresponding System property
140     public static final String SP_IS_STANDALONE = "jdk.xml.isStandalone";
141 
142     //
143     public static final String S_XSL_VALUE_ENTITIES = "com/sun/org/apache/xml/internal/serializer/XMLEntities";
144 
145     // Parameter values
146     public static final String DOM3_EXPLICIT_TRUE = "explicit:yes";
147 
148     public static final String DOM3_DEFAULT_TRUE = "default:yes";
149 
150     public static final String DOM3_EXPLICIT_FALSE = "explicit:no";
151 
152     public static final String DOM3_DEFAULT_FALSE = "default:no";
153 
154     // DOM Exceptions
155     public static final String DOM_EXCEPTION_FEATURE_NOT_FOUND = "FEATURE_NOT_FOUND";
156 
157     public static final String DOM_EXCEPTION_FEATURE_NOT_SUPPORTED = "FEATURE_NOT_SUPPORTED";
158 
159     public static final String DOM_LSEXCEPTION_SERIALIZER_ERR = "SERIALIZER_ERROR";
160 
161 }
162