aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorrudolf <rudolf@d688527b-c9ab-4aba-bd8d-4036d912da1d>2005-09-22 10:41:49 +0000
committerrudolf <rudolf@d688527b-c9ab-4aba-bd8d-4036d912da1d>2005-09-22 10:41:49 +0000
commitbe0e139b0e57606477ffe09b4e8169c65e3a3701 (patch)
tree90d42549b068d8df553b7df8f4f8b4c9bf447007 /common
parentd37622fc03b7be66998c8855104fe31c5b21f4a0 (diff)
downloadmoa-id-spss-be0e139b0e57606477ffe09b4e8169c65e3a3701.tar.gz
moa-id-spss-be0e139b0e57606477ffe09b4e8169c65e3a3701.tar.bz2
moa-id-spss-be0e139b0e57606477ffe09b4e8169c65e3a3701.zip
Mergen von MOA-VV Code mit bisher bestehendem Code
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@516 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'common')
-rw-r--r--common/src/at/gv/egovernment/moa/util/XPathUtils.java111
1 files changed, 5 insertions, 106 deletions
diff --git a/common/src/at/gv/egovernment/moa/util/XPathUtils.java b/common/src/at/gv/egovernment/moa/util/XPathUtils.java
index aa5a4fec5..83000d346 100644
--- a/common/src/at/gv/egovernment/moa/util/XPathUtils.java
+++ b/common/src/at/gv/egovernment/moa/util/XPathUtils.java
@@ -45,7 +45,6 @@ public class XPathUtils {
Constants.MOA_ID_CONFIG_NS_URI);
ctx.addNamespace(Constants.SL10_PREFIX, Constants.SL10_NS_URI);
ctx.addNamespace(Constants.SL11_PREFIX, Constants.SL11_NS_URI);
- ctx.addNamespace(Constants.SL12_PREFIX, Constants.SL12_NS_URI);
ctx.addNamespace(Constants.ECDSA_PREFIX, Constants.ECDSA_NS_URI);
ctx.addNamespace(Constants.PD_PREFIX, Constants.PD_NS_URI);
ctx.addNamespace(Constants.SAML_PREFIX, Constants.SAML_NS_URI);
@@ -57,6 +56,11 @@ public class XPathUtils {
Constants.DSIG_FILTER2_PREFIX,
Constants.DSIG_FILTER2_NS_URI);
ctx.addNamespace(Constants.DSIG_EC_PREFIX, Constants.DSIG_EC_NS_URI);
+ ctx.addNamespace(Constants.MD_PREFIX, Constants.MD_NS_URI);
+ ctx.addNamespace(Constants.MDP_PREFIX, Constants.MDP_NS_URI);
+ ctx.addNamespace(Constants.MVV_PREFIX, Constants.MVV_NS_URI);
+ ctx.addNamespace(Constants.STB_PREFIX, Constants.STB_NS_URI);
+ ctx.addNamespace(Constants.WRR_PREFIX, Constants.WRR_NS_URI);
NS_CONTEXT = ctx;
}
@@ -412,110 +416,5 @@ public class XPathUtils {
Attr attr = (Attr) XPathUtils.selectSingleNode(root, xpath);
return attr != null ? attr.getValue() : def;
}
-
- /**
- * Return the SecurityLayer namespace prefix of the context element.
- * If the context element has no prefix explicitely set (i.e. is specified
- * within the <code>default</code> namespace), the method sets the prefix
- * according to the value of the <code>xmlns</code> attribute of the context
- * element.
- * The returned prefix is needed for evaluating XPATH expressions.
- *
- * @param contextElement The element to get a prefix from.
- *
- * @return The string <code>sl10</code>, <code>sl11</code> or <code>sl</code>,
- * depending on the SecurityLayer namespace of the contextElement.
- *
- * throws XpathException If the element has no prefix or no valid SecurityLayer
- * namespace is used as default namespace.
- */
- public static String getSlPrefix (Element contextElement) throws XPathException {
- String slPrefix = contextElement.getPrefix();
- if (slPrefix != null) {
- return slPrefix;
- } else {
- String nameSpace = contextElement.getAttribute("xmlns");
-
- if (nameSpace.equals(Constants.SL10_NS_URI)) {
- slPrefix = Constants.SL10_PREFIX;
- } else if (nameSpace.equals(Constants.SL12_NS_URI)) {
- slPrefix = Constants.SL12_PREFIX;
- } else if (nameSpace.equals(Constants.SL11_NS_URI)) {
- slPrefix = Constants.SL11_PREFIX;
- } else {
- MessageProvider msg = MessageProvider.getInstance();
- String message = msg.getMessage("xpath.00", new Object[] { "Ungültiger SecurityLayer Namespace: \"" + nameSpace + "\"."});
- throw new XPathException(message, null);
-
- }
-
- return slPrefix;
- }
- }
-
-
- /**
- * Return the SecurityLayer namespace prefix of the context element.
- * If the context element is not the element that lies within the
- * SecurityLayer namespace. The Securitylayer namespace is derived from
- * the <code>xmlns:sl10</code>, <code>sl11</code> or <code>sl</code>
- * attribute of the context element.
- *
- * The returned prefix is needed for evaluating XPATH expressions.
- *
- * @param contextElement The element to get a prefix for the Securitylayer namespace,
- * that is used within the corresponding document.
- *
- * @return The string <code>sl10</code>, <code>sl11</code> or <code>sl</code>,
- * depending on the SecurityLayer namespace of the contextElement.
- *
- * throws XPathException If no (vlalid) SecurityLayer namespace prefix or namespace
- * is defined.
- */
- public static String getSlPrefixFromNoRoot (Element contextElement) throws XPathException {
-
- String slPrefix = checkSLnsDeclaration(contextElement, Constants.SL10_PREFIX, Constants.SL10_NS_URI);
- if (slPrefix == null) {
- slPrefix = checkSLnsDeclaration(contextElement, Constants.SL11_PREFIX, Constants.SL11_NS_URI);
- }
- if (slPrefix == null) {
- slPrefix = checkSLnsDeclaration(contextElement, Constants.SL12_PREFIX, Constants.SL12_NS_URI);
- }
-
- return slPrefix;
-
- }
-
- /**
- * Checks if the context element has an attribute <code>xmlns:slPrefix</code> and
- * if the prefix of that attribute corresponds with a valid SecurityLayer namespace.
- *
- * @param contextElement The element to be checked.
- * @param slPrefix The prefix which should be checked. Must be a valid SecurityLayer
- * namespace prefix.
- * @param slNameSpace The SecurityLayer namespace that corresponds to the specified prefix.
- *
- * @return The valid SecurityLayer prefix or <code>null</code> if this prefix is
- * not used.
- * @throws XPathException
- */
- private static String checkSLnsDeclaration(Element contextElement, String slPrefix, String slNameSpace)
- throws XPathException
- {
- String nsAtt = "xmlns:" + slPrefix;
- String nameSpace = contextElement.getAttribute(nsAtt);
- if (nameSpace == "") {
- return null;
- } else {
- // check if namespace is correct
- if (nameSpace.equals(slNameSpace)) {
- return slPrefix;
- } else {
- MessageProvider msg = MessageProvider.getInstance();
- String message = msg.getMessage("xpath.00", new Object[] { "Ungültiger SecurityLayer Namespace: \"" + nameSpace + "\"."});
- throw new XPathException(message, null);
- }
- }
- }
}