当前位置: 首页>>代码示例>>Java>>正文


Java BaseXPath.evaluate方法代码示例

本文整理汇总了Java中org.jaxen.BaseXPath.evaluate方法的典型用法代码示例。如果您正苦于以下问题:Java BaseXPath.evaluate方法的具体用法?Java BaseXPath.evaluate怎么用?Java BaseXPath.evaluate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jaxen.BaseXPath的用法示例。


在下文中一共展示了BaseXPath.evaluate方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testLangFunctionAppliedToDocument

import org.jaxen.BaseXPath; //导入方法依赖的package包/类
public void testLangFunctionAppliedToDocument() 
  throws JaxenException {
    
    BaseXPath xpath = new DOMXPath("lang('fr')");
    Element a = doc.createElementNS("", "a");
    Element b = doc.createElementNS("", "b");
    b.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:lang", "fr-CA");
    doc.appendChild(a);
    a.appendChild(b);
    Element x2 = doc.createElementNS("", "x");
    Element x3 = doc.createElementNS("", "x");
    Element x4 = doc.createElementNS("", "x");
    a.appendChild(x4);
    b.appendChild(x2);
    b.appendChild(x3);
    x2.appendChild(doc.createTextNode("fr"));
    x3.appendChild(doc.createTextNode("3"));
    x4.appendChild(doc.createTextNode("4"));
    
    Boolean result = (Boolean) xpath.evaluate(doc);
    assertEquals(Boolean.FALSE, result);
    
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:24,代码来源:LangTest.java

示例2: testNaNIsFalse

import org.jaxen.BaseXPath; //导入方法依赖的package包/类
public void testNaNIsFalse() 
  throws JaxenException {
    
    BaseXPath xpath = new DOMXPath("not(0 div 0)");
    Object result = xpath.evaluate(null);
    assertEquals(Boolean.TRUE, result);
    
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:9,代码来源:NotTest.java

示例3: testNaNIsFalse

import org.jaxen.BaseXPath; //导入方法依赖的package包/类
public void testNaNIsFalse() 
  throws JaxenException {
    
    BaseXPath xpath = new DOMXPath("boolean(0 div 0)");
    Object result = xpath.evaluate(null);
    assertEquals(Boolean.FALSE, result);
    
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:9,代码来源:BooleanTest.java

示例4: testCountRootElement

import org.jaxen.BaseXPath; //导入方法依赖的package包/类
public void testCountRootElement() 
  throws JaxenException {
    
    BaseXPath xpath = new DOMXPath("count(/*)");
    Double result = (Double) xpath.evaluate(doc);
    assertEquals(1.0, result.doubleValue(), 0.00001);
    
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:9,代码来源:CountTest.java

示例5: testStringLengthFunctionOperatesOnContextNode

import org.jaxen.BaseXPath; //导入方法依赖的package包/类
public void testStringLengthFunctionOperatesOnContextNode() 
  throws JaxenException {
    
    BaseXPath xpath = new DOMXPath("string-length()");
    Double result = (Double) xpath.evaluate( doc );
    assertEquals(0, result.intValue());
    
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:9,代码来源:StringLengthTest.java

示例6: testStringLengthFunctionCountsUnicodeCharactersNotJavaChars

import org.jaxen.BaseXPath; //导入方法依赖的package包/类
public void testStringLengthFunctionCountsUnicodeCharactersNotJavaChars() 
  throws JaxenException {
   
    BaseXPath xpath = new DOMXPath("string-length('\uD834\uDD00')");
    Double result = (Double) xpath.evaluate( doc );
    assertEquals(1, result.intValue());
    
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:9,代码来源:StringLengthTest.java

示例7: testStringLengthFunctionWithMalformedString

import org.jaxen.BaseXPath; //导入方法依赖的package包/类
public void testStringLengthFunctionWithMalformedString() 
  throws JaxenException {
   
    BaseXPath xpath = new DOMXPath("string-length('\uD834A\uDD00')");
    try {
        xpath.evaluate( doc );
        fail("Allowed Malformed string");
    }
    catch (FunctionCallException ex) {
        assertNotNull(ex.getMessage());
    }
    
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:14,代码来源:StringLengthTest.java

示例8: testFloor

import org.jaxen.BaseXPath; //导入方法依赖的package包/类
public void testFloor() throws JaxenException {
    
    BaseXPath xpath = new DOMXPath("floor(1.5)");
    
    Object result = xpath.evaluate(doc);
    assertEquals(1, ((Double) result).doubleValue(), 0.0001);
    
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:9,代码来源:FloorTest.java

示例9: testNegativeFloor

import org.jaxen.BaseXPath; //导入方法依赖的package包/类
public void testNegativeFloor() throws JaxenException {
    
    BaseXPath xpath = new DOMXPath("floor(-1.5)");
    
    Object result = xpath.evaluate(doc);
    assertEquals(-2, ((Double) result).doubleValue(), 0.0001);
    
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:9,代码来源:FloorTest.java

示例10: testEvaluateString

import org.jaxen.BaseXPath; //导入方法依赖的package包/类
public void testEvaluateString() throws JaxenException {
    
    BaseXPath xpath = new DOMXPath("string(/*)");
    
    doc.appendChild(doc.createElement("root"));
    String stringValue = (String) xpath.evaluate(doc);
    assertEquals("", stringValue);
    
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:10,代码来源:BaseXPathTest.java

示例11: testEvaluateWithMultiNodeAnswer

import org.jaxen.BaseXPath; //导入方法依赖的package包/类
public void testEvaluateWithMultiNodeAnswer() throws JaxenException {
    
    BaseXPath xpath = new DOMXPath("(/descendant-or-self::node())");
    
    doc.appendChild(doc.createElement("root"));
    List result = (List) xpath.evaluate(doc);
    assertEquals(2, result.size());
    
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:10,代码来源:BaseXPathTest.java

示例12: testCeiling

import org.jaxen.BaseXPath; //导入方法依赖的package包/类
public void testCeiling() throws JaxenException {
    
    BaseXPath xpath = new DOMXPath("ceiling(1.5)");
    
    Object result = xpath.evaluate(doc);
    assertEquals(2, ((Double) result).doubleValue(), 0.0001);
    
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:9,代码来源:CeilingTest.java

示例13: testNegativeCeiling

import org.jaxen.BaseXPath; //导入方法依赖的package包/类
public void testNegativeCeiling() throws JaxenException {
    
    BaseXPath xpath = new DOMXPath("ceiling(-1.5)");
    
    Object result = xpath.evaluate(doc);
    assertEquals(-1, ((Double) result).doubleValue(), 0.0001);
    
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:9,代码来源:CeilingTest.java


注:本文中的org.jaxen.BaseXPath.evaluate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。