Xpath读取xml

      FLASH 2005-8-18 0:45
刚刚又看到一篇关于Xpath的文章,介绍Flash MX 2004已经内含 XPath引擎,具体使用方式如下:

使用Flash MX 2004新建一空白文档

打开“类”库面板 (窗口 --> 其他面板 --> 公用库 --> 类)

将DataBindingClasses组件拖放到库(Ctrl + L)中。

添加AS:import mx.xpath.XPathAPI;
这样你就可以使用XPath API了,下面的是两个比较有用的方法:

XPathAPI.selectNodeList(node:XML,statement:String):Array

XPathAPI.selectSingleNode(node:XML,statement:String):XMLNode
以上最重要的是:XpathAPI只有同DataBinding SWC文件一起编译才可使用。必须确保DataBinding组件已经存在于fla文件的库中。

原文
http://www.richinternet.de/blog/index.cfm?entry=22368700-0603-4CC0-21D1749BDAEC4632
附例子源文件
[download=http://www.richinternet.de/blog/download/xpath.zip ]下载[/download]
标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commenttime}{commentauthor}

{CommentUrl}
{commentcontent}