Shellway Blog 关注前端设计,关注互联网发展趋势

022008/100/9

Flash的XPathAPI类(二)

XPathAPI.getEvalString()方法

译自:flash官方文档 XPathAPI.pdf,译者:Shellway

可用性 (Availability)
自Flash Player 6 (6.0.79.0).

版本 (Edition)
Flash MX 2004.

用法 (Usage)
XPathAPI.getEvalString(node, path)

参数 (Parameters)

node     一个XML节点;语句执行开始处的父DOM节点的索引;
An XML node; a reference to the DOM node that is the parent node from which the statement executes.

path      一个识别XML节点树路径的字符串;
A string identifying the path through the XML node hierarchy.

返回值 (Returns)
一个字符串,表示从父节点访问路径参数指定的的值所需的代码。
A string that represents the code required to access the value specified by the path parameter from the parent node.

描述 (Description)
方法;针对指定节点,获取交互得到的估值字符串;
Method; for a specified node, gets the corresponding evaluation string.

示例 (Example)
下面的示例代码会在输出面板中显示用于指定节点的估值字符串:
The following example displays the corresponding evaluation string used for a specified node
in the Output panel:

//导入XPathAPI类。
import mx.xpath.XPathAPI;

var rssfeed_xml:XML = new XML();
rssfeed_xml.ignoreWhite = true;
rssfeed_xml.onLoad = function(success:Boolean) {
trace("onload...");
if (success) {
trace("success...");
// 获取/rss/channel/item中的所有 tittle节点。
// Retrieve all title notes within /rss/channel/item.
var thePath_str:String = "/rss/channel/item";
//获取用于查找的估值字符串。
// Get the evaluation string used for the search.
var myEvalString_str:String = XPathAPI.getEvalString(this.firstChild,
thePath_str);
trace("getEvalString: " + myEvalString_str);
} else {
trace("error loading XML");
}
};
rssfeed_xml.load("http://www.flash-mx.com/news/index.xml");
<!-- JiaThis Button BEGIN --> <div id="ckepop"> <a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank">分享到:</a> <a title="分享到QQ空间" class="jiathis_button_qzone">QQ空间</a> <a title="分享到人人网" class="jiathis_button_renren">人人网</a> <a title="分享到开心网" class="jiathis_button_kaixin001">开心网</a> <a title="分享到新浪微博" class="jiathis_button_tsina">新浪微博</a> </div> <script type="text/javascript" src="http://v1.jiathis.com/code/jia.js" charset="utf-8"></script> <!-- JiaThis Button END -->



以下文章您或许也感兴趣

coded by nessus
评论 (0) 引用 (0)

还没有评论.


Leave a comment

(required)


*

还没有引用.