1 /*
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3 * @LastModified: Nov 2017
4 */
5 /*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements. See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License. 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.xerces.internal.dom;
23
80 * the document in a "normal" form. The actual result depends on the features being set
81 * and governing what operations actually take place. See setNormalizationFeature for details.
82 * Noticeably this method normalizes Text nodes, makes the document "namespace wellformed",
83 * according to the algorithm described below in pseudo code, by adding missing namespace
84 * declaration attributes and adding or changing namespace prefixes, updates the replacement
85 * tree of EntityReference nodes, normalizes attribute values, etc.
86 * Mutation events, when supported, are generated to reflect the changes occuring on the
87 * document.
88 * See Namespace normalization for details on how namespace declaration attributes and prefixes
89 * are normalized.
90 *
91 * NOTE: There is an initial support for DOM revalidation with XML Schema as a grammar.
92 * The tree might not be validated correctly if entityReferences, CDATA sections are
93 * present in the tree. The PSVI information is not exposed, normalized data (including element
94 * default content is not available).
95 *
96 * @xerces.experimental
97 *
98 * @author Elena Litani, IBM
99 * @author Neeraj Bajaj, Sun Microsystems, inc.
100 */
101 public class DOMNormalizer implements XMLDocumentHandler {
102
103 //
104 // constants
105 //
106 /** Debug normalize document*/
107 protected final static boolean DEBUG_ND = false;
108 /** Debug namespace fix up algorithm*/
109 protected final static boolean DEBUG = false;
110 /** Debug document handler events */
111 protected final static boolean DEBUG_EVENTS = false;
112
113 /** prefix added by namespace fixup algorithm should follow a pattern "NS" + index*/
114 protected final static String PREFIX = "NS";
115
116 //
117 // Data
118 //
119 protected DOMConfigurationImpl fConfiguration = null;
|
1 /*
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3 */
4 /*
5 * Licensed to the Apache Software Foundation (ASF) under one or more
6 * contributor license agreements. See the NOTICE file distributed with
7 * this work for additional information regarding copyright ownership.
8 * The ASF licenses this file to You under the Apache License, Version 2.0
9 * (the "License"); you may not use this file except in compliance with
10 * the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21 package com.sun.org.apache.xerces.internal.dom;
22
79 * the document in a "normal" form. The actual result depends on the features being set
80 * and governing what operations actually take place. See setNormalizationFeature for details.
81 * Noticeably this method normalizes Text nodes, makes the document "namespace wellformed",
82 * according to the algorithm described below in pseudo code, by adding missing namespace
83 * declaration attributes and adding or changing namespace prefixes, updates the replacement
84 * tree of EntityReference nodes, normalizes attribute values, etc.
85 * Mutation events, when supported, are generated to reflect the changes occuring on the
86 * document.
87 * See Namespace normalization for details on how namespace declaration attributes and prefixes
88 * are normalized.
89 *
90 * NOTE: There is an initial support for DOM revalidation with XML Schema as a grammar.
91 * The tree might not be validated correctly if entityReferences, CDATA sections are
92 * present in the tree. The PSVI information is not exposed, normalized data (including element
93 * default content is not available).
94 *
95 * @xerces.experimental
96 *
97 * @author Elena Litani, IBM
98 * @author Neeraj Bajaj, Sun Microsystems, inc.
99 * @LastModified: Nov 2017
100 */
101 public class DOMNormalizer implements XMLDocumentHandler {
102
103 //
104 // constants
105 //
106 /** Debug normalize document*/
107 protected final static boolean DEBUG_ND = false;
108 /** Debug namespace fix up algorithm*/
109 protected final static boolean DEBUG = false;
110 /** Debug document handler events */
111 protected final static boolean DEBUG_EVENTS = false;
112
113 /** prefix added by namespace fixup algorithm should follow a pattern "NS" + index*/
114 protected final static String PREFIX = "NS";
115
116 //
117 // Data
118 //
119 protected DOMConfigurationImpl fConfiguration = null;
|