1 /*
2 * Copyright (c) 2012, 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.xalan.internal.xsltc.compiler;
22
41 import java.util.Objects;
42 import java.util.Properties;
43 import java.util.jar.Attributes;
44 import java.util.jar.JarEntry;
45 import java.util.jar.JarOutputStream;
46 import java.util.jar.Manifest;
47 import javax.xml.XMLConstants;
48 import javax.xml.catalog.CatalogFeatures;
49 import jdk.xml.internal.JdkXmlFeatures;
50 import jdk.xml.internal.JdkXmlUtils;
51 import jdk.xml.internal.SecuritySupport;
52 import org.xml.sax.InputSource;
53 import org.xml.sax.XMLReader;
54
55 /**
56 * @author Jacek Ambroziak
57 * @author Santiago Pericas-Geertsen
58 * @author G. Todd Miller
59 * @author Morten Jorgensen
60 * @author John Howard (johnh@schemasoft.com)
61 * @LastModified: Oct 2017
62 */
63 public final class XSLTC {
64
65 // A reference to the main stylesheet parser object.
66 private Parser _parser;
67
68 // A reference to an external XMLReader (SAX parser) passed to us
69 private XMLReader _reader = null;
70
71 // A reference to an external SourceLoader (for use with include/import)
72 private SourceLoader _loader = null;
73
74 // A reference to the stylesheet being compiled.
75 private Stylesheet _stylesheet;
76
77 // Counters used by various classes to generate unique names.
78 // private int _variableSerial = 1;
79 private int _modeSerial = 1;
80 private int _stylesheetSerial = 1;
81 private int _stepPatternSerial = 1;
158 private ClassLoader _extensionClassLoader;
159
160 /**
161 * HashMap with the loaded classes
162 */
163 private final Map<String, Class<?>> _externalExtensionFunctions;
164
165 /**
166 * Catalog features
167 */
168 CatalogFeatures _catalogFeatures;
169
170 /**
171 * CDATA chunk size
172 */
173 int _cdataChunkSize;
174
175 /**
176 * XSLTC compiler constructor
177 */
178 public XSLTC(JdkXmlFeatures featureManager) {
179 _overrideDefaultParser = featureManager.getFeature(
180 JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
181 _parser = new Parser(this, _overrideDefaultParser);
182 _xmlFeatures = featureManager;
183 _extensionClassLoader = null;
184 _externalExtensionFunctions = new HashMap<>();
185 }
186
187 /**
188 * Set the state of the secure processing feature.
189 */
190 public void setSecureProcessing(boolean flag) {
191 _isSecureProcessing = flag;
192 }
193
194 /**
195 * Return the state of the secure processing feature.
196 */
197 public boolean isSecureProcessing() {
198 return _isSecureProcessing;
199 }
200
201 /**
|
1 /*
2 * Copyright (c) 2012, 2019, 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.xalan.internal.xsltc.compiler;
22
41 import java.util.Objects;
42 import java.util.Properties;
43 import java.util.jar.Attributes;
44 import java.util.jar.JarEntry;
45 import java.util.jar.JarOutputStream;
46 import java.util.jar.Manifest;
47 import javax.xml.XMLConstants;
48 import javax.xml.catalog.CatalogFeatures;
49 import jdk.xml.internal.JdkXmlFeatures;
50 import jdk.xml.internal.JdkXmlUtils;
51 import jdk.xml.internal.SecuritySupport;
52 import org.xml.sax.InputSource;
53 import org.xml.sax.XMLReader;
54
55 /**
56 * @author Jacek Ambroziak
57 * @author Santiago Pericas-Geertsen
58 * @author G. Todd Miller
59 * @author Morten Jorgensen
60 * @author John Howard (johnh@schemasoft.com)
61 * @LastModified: July 2019
62 */
63 public final class XSLTC {
64
65 // A reference to the main stylesheet parser object.
66 private Parser _parser;
67
68 // A reference to an external XMLReader (SAX parser) passed to us
69 private XMLReader _reader = null;
70
71 // A reference to an external SourceLoader (for use with include/import)
72 private SourceLoader _loader = null;
73
74 // A reference to the stylesheet being compiled.
75 private Stylesheet _stylesheet;
76
77 // Counters used by various classes to generate unique names.
78 // private int _variableSerial = 1;
79 private int _modeSerial = 1;
80 private int _stylesheetSerial = 1;
81 private int _stepPatternSerial = 1;
158 private ClassLoader _extensionClassLoader;
159
160 /**
161 * HashMap with the loaded classes
162 */
163 private final Map<String, Class<?>> _externalExtensionFunctions;
164
165 /**
166 * Catalog features
167 */
168 CatalogFeatures _catalogFeatures;
169
170 /**
171 * CDATA chunk size
172 */
173 int _cdataChunkSize;
174
175 /**
176 * XSLTC compiler constructor
177 */
178 public XSLTC(JdkXmlFeatures featureManager, boolean hasListener) {
179 _overrideDefaultParser = featureManager.getFeature(
180 JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
181 _parser = new Parser(this, _overrideDefaultParser, hasListener);
182 _xmlFeatures = featureManager;
183 _extensionClassLoader = null;
184 _externalExtensionFunctions = new HashMap<>();
185 }
186
187 /**
188 * Set the state of the secure processing feature.
189 */
190 public void setSecureProcessing(boolean flag) {
191 _isSecureProcessing = flag;
192 }
193
194 /**
195 * Return the state of the secure processing feature.
196 */
197 public boolean isSecureProcessing() {
198 return _isSecureProcessing;
199 }
200
201 /**
|