src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathImpl.java

Print this page




   3  */
   4 /*
   5  * Copyright 1999-2004 The Apache Software Foundation.
   6  *
   7  * Licensed under the Apache License, Version 2.0 (the "License");
   8  * you may not use this file except in compliance with the License.
   9  * You may obtain a copy of the License at
  10  *
  11  *     http://www.apache.org/licenses/LICENSE-2.0
  12  *
  13  * Unless required by applicable law or agreed to in writing, software
  14  * distributed under the License is distributed on an "AS IS" BASIS,
  15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16  * See the License for the specific language governing permissions and
  17  * limitations under the License.
  18  */
  19 // $Id: XPathImpl.java,v 1.2 2005/08/16 22:41:08 jeffsuttor Exp $
  20 
  21 package com.sun.org.apache.xpath.internal.jaxp;
  22 
  23 import javax.xml.namespace.QName;

  24 import javax.xml.namespace.NamespaceContext;
  25 import javax.xml.xpath.XPathExpressionException;

  26 import javax.xml.xpath.XPathConstants;



  27 import javax.xml.xpath.XPathFunctionResolver;
  28 import javax.xml.xpath.XPathVariableResolver;
  29 import javax.xml.xpath.XPathExpression;
  30 import com.sun.org.apache.xpath.internal.*;
  31 import com.sun.org.apache.xpath.internal.objects.XObject;
  32 import com.sun.org.apache.xalan.internal.utils.FeatureManager;
  33 import org.w3c.dom.Document;
  34 import org.xml.sax.InputSource;
  35 import javax.xml.transform.TransformerException;
  36 import javax.xml.xpath.XPathEvaluationResult;
  37 
  38 /**
  39  * The XPathImpl class provides implementation for the methods defined  in
  40  * javax.xml.xpath.XPath interface. This provides simple access to the results
  41  * of an XPath expression.
  42  *
  43  * @author  Ramesh Mandava
  44  *
  45  * Updated 12/04/2014:
  46  * New methods: evaluateExpression
  47  * Refactored to share code with XPathExpressionImpl.
  48  */
  49 public class XPathImpl extends XPathImplUtil implements javax.xml.xpath.XPath {
  50 
  51     // Private variables
  52     private XPathVariableResolver origVariableResolver;
  53     private XPathFunctionResolver origFunctionResolver;
  54     private NamespaceContext namespaceContext=null;
  55 
  56     XPathImpl(XPathVariableResolver vr, XPathFunctionResolver fr) {
  57         this(vr, fr, false, true, new FeatureManager());
  58     }
  59 
  60     XPathImpl(XPathVariableResolver vr, XPathFunctionResolver fr,
  61             boolean featureSecureProcessing, boolean useServiceMechanism,
  62             FeatureManager featureManager) {
  63         this.origVariableResolver = this.variableResolver = vr;
  64         this.origFunctionResolver = this.functionResolver = fr;
  65         this.featureSecureProcessing = featureSecureProcessing;
  66         this.useServiceMechanism = useServiceMechanism;
  67         this.featureManager = featureManager;
  68     }
  69 
  70 
  71     //-Override-
  72     public void setXPathVariableResolver(XPathVariableResolver resolver) {
  73         requireNonNull(resolver, "XPathVariableResolver");
  74         this.variableResolver = resolver;
  75     }
  76 
  77     //-Override-
  78     public XPathVariableResolver getXPathVariableResolver() {
  79         return variableResolver;
  80     }
  81 
  82     //-Override-




   3  */
   4 /*
   5  * Copyright 1999-2004 The Apache Software Foundation.
   6  *
   7  * Licensed under the Apache License, Version 2.0 (the "License");
   8  * you may not use this file except in compliance with the License.
   9  * You may obtain a copy of the License at
  10  *
  11  *     http://www.apache.org/licenses/LICENSE-2.0
  12  *
  13  * Unless required by applicable law or agreed to in writing, software
  14  * distributed under the License is distributed on an "AS IS" BASIS,
  15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16  * See the License for the specific language governing permissions and
  17  * limitations under the License.
  18  */
  19 // $Id: XPathImpl.java,v 1.2 2005/08/16 22:41:08 jeffsuttor Exp $
  20 
  21 package com.sun.org.apache.xpath.internal.jaxp;
  22 
  23 import com.sun.org.apache.xpath.internal.*;
  24 import com.sun.org.apache.xpath.internal.objects.XObject;
  25 import javax.xml.namespace.NamespaceContext;
  26 import javax.xml.namespace.QName;
  27 import javax.xml.transform.TransformerException;
  28 import javax.xml.xpath.XPathConstants;
  29 import javax.xml.xpath.XPathEvaluationResult;
  30 import javax.xml.xpath.XPathExpression;
  31 import javax.xml.xpath.XPathExpressionException;
  32 import javax.xml.xpath.XPathFunctionResolver;
  33 import javax.xml.xpath.XPathVariableResolver;
  34 import jdk.xml.internal.JdkXmlFeatures;



  35 import org.w3c.dom.Document;
  36 import org.xml.sax.InputSource;


  37 
  38 /**
  39  * The XPathImpl class provides implementation for the methods defined  in
  40  * javax.xml.xpath.XPath interface. This provides simple access to the results
  41  * of an XPath expression.
  42  *
  43  * @author  Ramesh Mandava
  44  *
  45  * Updated 12/04/2014:
  46  * New methods: evaluateExpression
  47  * Refactored to share code with XPathExpressionImpl.
  48  */
  49 public class XPathImpl extends XPathImplUtil implements javax.xml.xpath.XPath {
  50 
  51     // Private variables
  52     private XPathVariableResolver origVariableResolver;
  53     private XPathFunctionResolver origFunctionResolver;
  54     private NamespaceContext namespaceContext=null;
  55 
  56     XPathImpl(XPathVariableResolver vr, XPathFunctionResolver fr) {
  57         this(vr, fr, false, true, new JdkXmlFeatures(false));
  58     }
  59 
  60     XPathImpl(XPathVariableResolver vr, XPathFunctionResolver fr,
  61             boolean featureSecureProcessing, boolean useServiceMechanism,
  62             JdkXmlFeatures featureManager) {
  63         this.origVariableResolver = this.variableResolver = vr;
  64         this.origFunctionResolver = this.functionResolver = fr;
  65         this.featureSecureProcessing = featureSecureProcessing;
  66         this.useServiceMechanism = useServiceMechanism;
  67         this.featureManager = featureManager;
  68     }
  69 
  70 
  71     //-Override-
  72     public void setXPathVariableResolver(XPathVariableResolver resolver) {
  73         requireNonNull(resolver, "XPathVariableResolver");
  74         this.variableResolver = resolver;
  75     }
  76 
  77     //-Override-
  78     public XPathVariableResolver getXPathVariableResolver() {
  79         return variableResolver;
  80     }
  81 
  82     //-Override-