List of usage examples for javax.xml.xpath XPathConstants STRING
QName STRING
To view the source code for javax.xml.xpath XPathConstants STRING.
Click Source Link
The XPath 1.0 string data type.
Maps to Java String .
From source file:Main.java
public static String getValueAsString(Document doc, XPath xpath, String value) { String id = null;/*from ww w . j av a 2 s. com*/ try { XPathExpression expr = xpath.compile(value); id = (String) expr.evaluate(doc, XPathConstants.STRING); } catch (XPathExpressionException e) { e.printStackTrace(); } return id; }
From source file:Main.java
public static String xpathString(Node node, String expression) throws XPathExpressionException { return (String) evaluateXpath(expression, node, XPathConstants.STRING, null); }
From source file:Main.java
public static String getNamespace(Document document) throws XPathExpressionException { return (String) evaluateXpath("//mapper/@namespace", document, XPathConstants.STRING, null); }
From source file:Main.java
public static final String xPathString(final Node aNode, final String anXPath) throws XPathExpressionException { return (String) xPath.compile(anXPath).evaluate(aNode, XPathConstants.STRING); }
From source file:Main.java
public static String evaluateToString(Document document, String expression) throws XPathExpressionException { return (String) evaluate(document, expression, XPathConstants.STRING); }
From source file:Main.java
public static String selectString(Document xmlDocument, String expression) throws XPathExpressionException { return (String) selectObject(xmlDocument, expression, XPathConstants.STRING); }
From source file:Main.java
public static String getFirstValueFromXPath(Element parent, String xpath) throws Exception { try {//from w w w .j av a 2s . co m XPath xPath = XPathFactory.newInstance().newXPath(); return (String) xPath.compile(xpath).evaluate(parent, XPathConstants.STRING); } catch (XPathExpressionException xpee) { throw new Exception(xpee.getMessage()); } }
From source file:Main.java
public static String selectXPathString(String Xpath, Node InNode, String nsuri, String pre) throws Exception { return (String) getNodesListXpath(Xpath, InNode, nsuri, pre, XPathConstants.STRING); }
From source file:Main.java
/** * Use the supplied XPath statement find the data. * //www. j a v a2 s . c o m */ public static String findString(Document document, String xpath) { try { return (String) _xpath.evaluate(xpath, document, XPathConstants.STRING); } catch (XPathExpressionException e) { e.printStackTrace(); } return null; }
From source file:Main.java
public static String getStringValue(final String xpathExpression, final NamespaceContext nsContext, final Node node) throws XPathExpressionException { return (String) getValue(xpathExpression, node, XPathConstants.STRING, nsContext); }