public String getPrefix(String namespaceURI) { Iterator<String> prefixIterator = getPrefixes(namespaceURI); if (prefixIterator.hasNext()) { return getPrefixes(namespaceURI).next(); } return null; }
/** * Executes the given xpath and returns the result with the type specified. */ public static Object executeXPath(Node document, String xpathExpression, Map<String, String> namespaceMapping, QName result) throws XPathException, MarshallingException { NamespaceMapContext mapContext = new NamespaceMapContext(namespaceMapping); try { XPathFactory xPathfactory = XPathFactory.newInstance(); XPath xpath = xPathfactory.newXPath(); xpath.setNamespaceContext(mapContext); XPathExpression expr = xpath.compile(xpathExpression); return executeXPath(document, expr, result); } catch (XPathExpressionException e) { throw new XPathException("Xpath(" + xpathExpression + ") cannot be compiled", e); } catch (Exception e) { throw new MarshallingException("Exception unmarshalling XML.", e); } }
public static Object executeXPath(Node document, String xpathExpression, Map<String, String> namespaceMapping, QName result) throws XPathException, MarshallingException { NamespaceMapContext mapContext = new NamespaceMapContext(namespaceMapping); try { XPathFactory xPathfactory = XPathFactory.newInstance(); XPath xpath = xPathfactory.newXPath(); xpath.setNamespaceContext(mapContext); XPathExpression expr = xpath.compile(xpathExpression); return executeXPath(document, expr, result); } catch (XPathExpressionException e) { throw new XPathException("Xpath(" + xpathExpression + ") cannot be compiled", e); } catch (Exception e) { throw new MarshallingException("Exception unmarshalling XML.", e); } }
/** * Executes the given xpath and returns the result with the type specified. */ public static Object executeXPath(Node document, String xpathExpression, Map<String, String> namespaceMapping, QName result) throws XPathException, MarshallingException { NamespaceMapContext mapContext = new NamespaceMapContext(namespaceMapping); try { XPathFactory xPathfactory = XPathFactory.newInstance(); XPath xpath = xPathfactory.newXPath(); xpath.setNamespaceContext(mapContext); XPathExpression expr = xpath.compile(xpathExpression); return executeXPath(document, expr, result); } catch (XPathExpressionException e) { throw new XPathException("Xpath(" + xpathExpression + ") cannot be compiled", e); } catch (Exception e) { throw new MarshallingException("Exception unmarshalling XML.", e); } }
public String getPrefix(String namespaceURI) { Iterator<String> prefixIterator = getPrefixes(namespaceURI); if (prefixIterator.hasNext()) { return getPrefixes(namespaceURI).next(); } return null; }
NamespaceMapContext nsContext = new NamespaceMapContext(namespaces); this.xpathEngine.setNamespaceContext(nsContext); try
public String getPrefix(String namespaceURI) { Iterator<String> prefixIterator = getPrefixes(namespaceURI); if (prefixIterator.hasNext()) { return getPrefixes(namespaceURI).next(); } return null; }
NamespaceMapContext nsContext = new NamespaceMapContext(namespaces); this.xpathEngine.setNamespaceContext(nsContext); try