public static SynapseXPath getSynapseXPath(OMElement elem, String expression) throws JaxenException { if (expression == null) { handleException("XPath expression cannot be null"); } SynapseXPath xpath = new SynapseXPath(expression); OMElementUtils.addNameSpaces(xpath, elem, log); return xpath; }
public static SynapseXPath getSynapseXPath(OMElement elem, String expression) throws JaxenException { if (expression == null) { handleException("XPath expression cannot be null"); } SynapseXPath xpath = new SynapseXPath(expression); OMElementUtils.addNameSpaces(xpath, elem, log); return xpath; }
public static SynapseXPath getSynapseXPath(OMElement elem, QName attribName) throws JaxenException { SynapseXPath xpath = null; OMAttribute xpathAttrib = elem.getAttribute(attribName); if (xpathAttrib != null && xpathAttrib.getAttributeValue() != null) { xpath = new SynapseXPath(xpathAttrib.getAttributeValue()); OMElementUtils.addNameSpaces(xpath, elem, log); } else { handleException("Couldn't find the XPath attribute with the QName : " + attribName.toString() + " in the element : " + elem.toString()); } return xpath; }
public static SynapseXPath getSynapseXPath(OMElement elem, QName attribName) throws JaxenException { SynapseXPath xpath = null; OMAttribute xpathAttrib = elem.getAttribute(attribName); if (xpathAttrib != null && xpathAttrib.getAttributeValue() != null) { try { xpath = new SynapseXPath(xpathAttrib.getAttributeValue()); } catch (org.jaxen.XPathSyntaxException ex) { /* Try and see whether the expression can be compiled with XPath 2.0 * This will only be done if the failover DOM XPath 2.0 is enabled */ if (Boolean.parseBoolean(SynapsePropertiesLoader.loadSynapseProperties(). getProperty(SynapseConstants.FAIL_OVER_DOM_XPATH_PROCESSING))) { if (log.isDebugEnabled()) { log.debug("Trying to compile the expression in XPath 2.0:" + xpathAttrib.getAttributeValue()); } xpath = new SynapseXPath(xpathAttrib.getAttributeValue(), elem); } else { throw ex; } } OMElementUtils.addNameSpaces(xpath, elem, log); xpath.addNamespacesForFallbackProcessing(elem); } else { handleException("Couldn't find the XPath attribute with the QName : " + attribName.toString() + " in the element : " + elem.toString()); } return xpath; }