CL_XPathEvaluator::evaluate
源码中例子
CL_File file(cl_text("test.xml"), CL_File::open_existing, CL_File::access_read);
CL_DomDocument document;
document.load(file);
CL_XPathEvaluator evaluator;
// CL_XPathObject result = evaluator.evaluate("6 mod 4", document);
// CL_XPathObject result = evaluator.evaluate("/root/child/childchild", document);
// CL_XPathObject result = evaluator.evaluate("/child::root/child::child/child::childchild", document);
// CL_XPathObject result = evaluator.evaluate("child::root/child::child/child::childchild", document);
// CL_XPathObject result = evaluator.evaluate("child::root/child::child[@foo]/child::childchild", document);
// CL_XPathObject result = evaluator.evaluate("child::root/child::child[child::foobar]/child::childchild", document);
// CL_XPathObject result = evaluator.evaluate("child::root/child::child[2]/child::childchild", document);
// CL_XPathObject result = evaluator.evaluate("root//childchild", document);
// CL_XPathObject result = evaluator.evaluate("root/child[@foo]/childchild", document);
// CL_XPathObject result = evaluator.evaluate("root/child[@foo=\"barism\"]/childchild", document);
// CL_XPathObject result = evaluator.evaluate("root/child[childchild=\"Test6\"]/foobar", document);
// CL_XPathObject result = evaluator.evaluate("root/child[@age!=10]/foobar", document);
// CL_XPathObject result = evaluator.evaluate("root/child[@age>27]/foobar", document);
// CL_XPathObject result = evaluator.evaluate("root/com:child/foobar", document);
支持2元运算符的+-*/算法和mod,div(/),and,or,=,!=,>,>=,<,<=等.
xml路径中通过[]来附加条件,带@符号为属性项.属性项条件判断中不支持>,<,>=,<=.当支持=,!=.
posted on 2010-06-21 10:03
我风 阅读(419)
评论(0) 编辑 收藏 引用 所属分类:
ClanLib