summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk')
-rw-r--r--sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java5
-rw-r--r--sca-java-2.x/trunk/modules/common-xml/src/main/java/org/apache/tuscany/sca/common/xml/xpath/XPathHelper.java14
2 files changed, 16 insertions, 3 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
index e35eed338a..1908994578 100644
--- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
+++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
@@ -259,10 +259,11 @@ public class PolicySetProcessor extends BaseStAXArtifactProcessor implements StA
if ( !prefix.equals(XMLConstants.DEFAULT_NS_PREFIX))
return prefix;
}
+
// We have to have some prefix here to use before the function name. Otherwise the
// XPathFunctionResolver will never be called.
- NamespaceContextImpl nsImpl = (NamespaceContextImpl) nsContext;
- nsImpl.register("sca_internal", SCA11_NS);
+ xpathHelper.registerPrefix("sca_internal", SCA11_NS, nsContext);
+
return "sca_internal";
}
diff --git a/sca-java-2.x/trunk/modules/common-xml/src/main/java/org/apache/tuscany/sca/common/xml/xpath/XPathHelper.java b/sca-java-2.x/trunk/modules/common-xml/src/main/java/org/apache/tuscany/sca/common/xml/xpath/XPathHelper.java
index a65bd5fe15..d48f010c55 100644
--- a/sca-java-2.x/trunk/modules/common-xml/src/main/java/org/apache/tuscany/sca/common/xml/xpath/XPathHelper.java
+++ b/sca-java-2.x/trunk/modules/common-xml/src/main/java/org/apache/tuscany/sca/common/xml/xpath/XPathHelper.java
@@ -91,11 +91,23 @@ public class XPathHelper {
if (namespace != null && !XMLConstants.NULL_NS_URI.equals(namespace)) {
nsContext.register(prefix, namespace);
}
- }
+ }
+
return nsContext;
}
/**
+ * Registers a prefix in an existing NamespaceContext
+ * @param prefix
+ * @param namespace
+ * @param context
+ */
+ public void registerPrefix(String prefix, String namespace, NamespaceContext context) {
+ NamespaceContextImpl nsContext = (NamespaceContextImpl) context;
+ nsContext.register(prefix, namespace);
+ }
+
+ /**
* Parse the XPath expression to collect all the prefixes for namespaces
* @param expression
* @return A collection of prefixes