summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/common-xml/src
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-06-23 21:08:22 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-06-23 21:08:22 +0000
commit5eb5ce84cc134578aa30f492a20cc04f0f8bae08 (patch)
tree747008ee6dd5c28e307b0cc5742223488426ba2a /sca-java-2.x/trunk/modules/common-xml/src
parentb52e4adaddb503f6209aa8ea006919fd74f909b3 (diff)
Refactor the default sca namespace binding
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@957347 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/common-xml/src')
-rw-r--r--sca-java-2.x/trunk/modules/common-xml/src/main/java/org/apache/tuscany/sca/common/xml/xpath/XPathHelper.java9
1 files changed, 7 insertions, 2 deletions
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 d48f010c55..c2ce8c427d 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
@@ -86,13 +86,18 @@ public class XPathHelper {
public NamespaceContext getNamespaceContext(String expression, NamespaceContext context) {
NamespaceContextImpl nsContext = new NamespaceContextImpl(null);
+ boolean found = false;
for (String prefix : getPrefixes(expression)) {
String namespace = context.getNamespaceURI(prefix);
if (namespace != null && !XMLConstants.NULL_NS_URI.equals(namespace)) {
nsContext.register(prefix, namespace);
+ found = true;
}
- }
-
+ }
+
+ if(!found) {
+ nsContext.register("__sca", "http://docs.oasis-open.org/ns/opencsa/sca/200912");
+ }
return nsContext;
}