2020
2121package com .sun .org .apache .xpath .internal .jaxp ;
2222
23+ import com .sun .org .apache .xerces .internal .utils .XMLSecurityPropertyManager ;
2324import com .sun .org .apache .xml .internal .utils .WrappedRuntimeException ;
2425import com .sun .org .apache .xpath .internal .objects .XObject ;
2526import javax .xml .namespace .QName ;
3233import javax .xml .xpath .XPathFunctionResolver ;
3334import javax .xml .xpath .XPathVariableResolver ;
3435import jdk .xml .internal .JdkXmlFeatures ;
36+ import jdk .xml .internal .XMLSecurityManager ;
3537import org .w3c .dom .Document ;
3638import org .xml .sax .InputSource ;
3739
3840/**
3941 * The XPathExpression interface encapsulates a (compiled) XPath expression.
4042 *
4143 * @author Ramesh Mandava
42- * @LastModified: May 2022
44+ * @LastModified: Nov 2025
4345 */
4446public class XPathExpressionImpl extends XPathImplUtil implements XPathExpression {
4547
@@ -49,21 +51,26 @@ public class XPathExpressionImpl extends XPathImplUtil implements XPathExpressio
4951 * from the context.
5052 */
5153 protected XPathExpressionImpl () {
52- this (null , null , null , null , false , new JdkXmlFeatures (false ));
54+ this (null , null , null , null , false , new JdkXmlFeatures (true ),
55+ new XMLSecurityManager (true ),
56+ new XMLSecurityPropertyManager ());
5357 };
5458
5559 protected XPathExpressionImpl (com .sun .org .apache .xpath .internal .XPath xpath ,
5660 JAXPPrefixResolver prefixResolver ,
5761 XPathFunctionResolver functionResolver ,
5862 XPathVariableResolver variableResolver ) {
5963 this (xpath , prefixResolver , functionResolver , variableResolver ,
60- false , new JdkXmlFeatures (false ));
64+ false , new JdkXmlFeatures (true ),
65+ new XMLSecurityManager (true ),
66+ new XMLSecurityPropertyManager ());
6167 };
6268
6369 protected XPathExpressionImpl (com .sun .org .apache .xpath .internal .XPath xpath ,
6470 JAXPPrefixResolver prefixResolver ,XPathFunctionResolver functionResolver ,
6571 XPathVariableResolver variableResolver , boolean featureSecureProcessing ,
66- JdkXmlFeatures featureManager ) {
72+ JdkXmlFeatures featureManager , XMLSecurityManager xmlSecMgr ,
73+ XMLSecurityPropertyManager xmlSecPropMgr ) {
6774 this .xpath = xpath ;
6875 this .prefixResolver = prefixResolver ;
6976 this .functionResolver = functionResolver ;
@@ -72,6 +79,8 @@ protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
7279 this .overrideDefaultParser = featureManager .getFeature (
7380 JdkXmlFeatures .XmlFeature .JDK_OVERRIDE_PARSER );
7481 this .featureManager = featureManager ;
82+ this .xmlSecMgr = xmlSecMgr ;
83+ this .xmlSecPropMgr = xmlSecPropMgr ;
7584 };
7685
7786 public void setXPath (com .sun .org .apache .xpath .internal .XPath xpath ) {
0 commit comments