Java Code Examples for javax.xml.xpath.XPathConstants#NODESET
The following examples show how to use
javax.xml.xpath.XPathConstants#NODESET .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XpathExpectationsHelper.java From spring-analysis-note with MIT License | 6 votes |
private <T> QName toQName(Class<T> expectedClass) { QName evaluationType; if (Number.class.isAssignableFrom(expectedClass)) { evaluationType = XPathConstants.NUMBER; } else if (CharSequence.class.isAssignableFrom(expectedClass)) { evaluationType = XPathConstants.STRING; } else if (Boolean.class.isAssignableFrom(expectedClass)) { evaluationType = XPathConstants.BOOLEAN; } else if (Node.class.isAssignableFrom(expectedClass)) { evaluationType = XPathConstants.NODE; } else if (NodeList.class.isAssignableFrom(expectedClass)) { evaluationType = XPathConstants.NODESET; } else { throw new IllegalArgumentException("Unexpected target class " + expectedClass + ". " + "Supported: numbers, strings, boolean, and org.w3c.Node and NodeList"); } return evaluationType; }
Example 2
Source File: XpathExpectationsHelper.java From java-technology-stack with MIT License | 6 votes |
private <T> QName toQName(Class<T> expectedClass) { QName evaluationType; if (Number.class.isAssignableFrom(expectedClass)) { evaluationType = XPathConstants.NUMBER; } else if (CharSequence.class.isAssignableFrom(expectedClass)) { evaluationType = XPathConstants.STRING; } else if (Boolean.class.isAssignableFrom(expectedClass)) { evaluationType = XPathConstants.BOOLEAN; } else if (Node.class.isAssignableFrom(expectedClass)) { evaluationType = XPathConstants.NODE; } else if (NodeList.class.isAssignableFrom(expectedClass)) { evaluationType = XPathConstants.NODESET; } else { throw new IllegalArgumentException("Unexpected target class " + expectedClass + ". " + "Supported: numbers, strings, boolean, and org.w3c.Node and NodeList"); } return evaluationType; }
Example 3
Source File: DOMHandle.java From java-client-api with Apache License 2.0 | 6 votes |
protected QName returnXPathConstant(Class<?> as) { if (as == null) { throw new IllegalArgumentException("cannot execute XPath as null"); } else if (Node.class.isAssignableFrom(as)) { return XPathConstants.NODE; } else if (NodeList.class.isAssignableFrom(as)) { return XPathConstants.NODESET; } else if (String.class.isAssignableFrom(as)) { return XPathConstants.STRING; } else if (Number.class.isAssignableFrom(as)) { return XPathConstants.NUMBER; } else if (Boolean.class.isAssignableFrom(as)) { return XPathConstants.BOOLEAN; } throw new IllegalArgumentException("cannot execute XPath as "+as.getName()); }
Example 4
Source File: XPathInfo.java From jlibs with Apache License 2.0 | 5 votes |
public void guessResultType(){ for(Map.Entry<QName, List<String>> entry: types.entrySet()){ for(String str: entry.getValue()){ if(xpath.startsWith(str)){ resultType = entry.getKey(); return; } } } resultType = XPathConstants.NODESET; }
Example 5
Source File: XPathFilter.java From storm-crawler with Apache License 2.0 | 5 votes |
public QName getReturnType() { switch (this) { case STRING: return XPathConstants.STRING; default: return XPathConstants.NODESET; } }
Example 6
Source File: XmlXPathRetrieveTest.java From butterfly with MIT License | 4 votes |
@Test(expectedExceptions = TransformationDefinitionException.class) public void emptyXPathExpressionTest() { new XmlXPathRetrieve("`", XPathConstants.NODESET); }
Example 7
Source File: XmlXPathRetrieveTest.java From butterfly with MIT License | 4 votes |
@Test(expectedExceptions = TransformationDefinitionException.class) public void nullXPathExpressionTest() { new XmlXPathRetrieve(null, XPathConstants.NODESET); }