1 /*
2 * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
3 * @LastModified: Sep 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 * $Id: Include.java,v 1.8 2007/04/09 21:30:41 joehw Exp $
23 */
25 package com.sun.org.apache.xalan.internal.xsltc.compiler;
26
27 import com.sun.org.apache.xalan.internal.XalanConstants;
28 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
29 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
30 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
31 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
32 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
33 import com.sun.org.apache.xml.internal.utils.SystemIDResolver;
34 import java.util.Iterator;
35 import javax.xml.XMLConstants;
36 import jdk.xml.internal.SecuritySupport;
37 import org.xml.sax.InputSource;
38 import org.xml.sax.XMLReader;
39
40 /**
41 * @author Jacek Ambroziak
42 * @author Morten Jorgensen
43 * @author Erwin Bolwidt <ejb@klomp.org>
44 * @author Gunnlaugur Briem <gthb@dimon.is>
45 */
46 final class Include extends TopLevelElement {
47
48 private Stylesheet _included = null;
49
50 public Stylesheet getIncludedStylesheet() {
51 return _included;
52 }
53
54 public void parseContents(final Parser parser) {
55 XSLTC xsltc = parser.getXSLTC();
56 Stylesheet context = parser.getCurrentStylesheet();
57
58 String docToLoad = getAttribute("href");
59 try {
60 if (context.checkForLoop(docToLoad)) {
61 final ErrorMsg msg = new ErrorMsg(ErrorMsg.CIRCULAR_INCLUDE_ERR,
62 docToLoad, this);
63 parser.reportError(Constants.FATAL, msg);
64 return;
|
1 /*
2 * Copyright (c) 2007, 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 * $Id: Include.java,v 1.8 2007/04/09 21:30:41 joehw Exp $
22 */
24 package com.sun.org.apache.xalan.internal.xsltc.compiler;
25
26 import com.sun.org.apache.xalan.internal.XalanConstants;
27 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
28 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
29 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
30 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
31 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
32 import com.sun.org.apache.xml.internal.utils.SystemIDResolver;
33 import java.util.Iterator;
34 import javax.xml.XMLConstants;
35 import jdk.xml.internal.SecuritySupport;
36 import org.xml.sax.InputSource;
37 import org.xml.sax.XMLReader;
38
39 /**
40 * @author Jacek Ambroziak
41 * @author Morten Jorgensen
42 * @author Erwin Bolwidt <ejb@klomp.org>
43 * @author Gunnlaugur Briem <gthb@dimon.is>
44 * @LastModified: Sep 2017
45 */
46 final class Include extends TopLevelElement {
47
48 private Stylesheet _included = null;
49
50 public Stylesheet getIncludedStylesheet() {
51 return _included;
52 }
53
54 public void parseContents(final Parser parser) {
55 XSLTC xsltc = parser.getXSLTC();
56 Stylesheet context = parser.getCurrentStylesheet();
57
58 String docToLoad = getAttribute("href");
59 try {
60 if (context.checkForLoop(docToLoad)) {
61 final ErrorMsg msg = new ErrorMsg(ErrorMsg.CIRCULAR_INCLUDE_ERR,
62 docToLoad, this);
63 parser.reportError(Constants.FATAL, msg);
64 return;
|