- 浏览: 1045459 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (538)
- 奇文共赏 (36)
- spring (13)
- hibernate (10)
- AOP/Aspectj (9)
- spring security (7)
- lucence (5)
- compass (3)
- jbmp (2)
- jboss rule(drools) (0)
- birt (1)
- jasper (1)
- cxf (3)
- flex (98)
- webgis (6)
- 设计模式 (1)
- 代码重构 (2)
- log4j (1)
- tomcat (9)
- 神品音乐 (1)
- 工作计划 (2)
- appfuse (1)
- svn (4)
- 寻章摘句 (3)
- eclipse (10)
- arcgis api for flex (1)
- 算法 (5)
- opengis-cs (1)
- bug心得 (13)
- 图标 (1)
- software&key (14)
- java (17)
- 搞笑视频 (13)
- sqlserver (9)
- postgresql (1)
- postgis (0)
- geoserver (5)
- 日子 (50)
- 水晶报表 (1)
- 绝对电影 (3)
- Alternativa3D (1)
- 酷站大全 (10)
- c++ (5)
- oracle (17)
- oracle spatial (25)
- flashbuilder4 (3)
- TweenLite (1)
- DailyBuild (6)
- 华山论贱 (5)
- 系统性能 (5)
- 经典古文 (6)
- SOA/SCA/OSGI (6)
- jira (2)
- Hadoop生态圈(hadoop/hbase/pig/hive/zookeeper) (37)
- 风水 (1)
- linux操作基础 (17)
- 经济 (4)
- 茶 (3)
- JUnit (1)
- C# dotNet (1)
- netbeans (1)
- Java2D (1)
- QT4 (1)
- google Test/Mock/AutoTest (3)
- maven (1)
- 3d/OSG (1)
- Eclipse RCP (3)
- CUDA (1)
- Access control (0)
- http://linux.chinaunix.net/techdoc/beginner/2008/01/29/977725.shtml (1)
- redis (1)
最新评论
-
dove19900520:
朋友,你确定你的标题跟文章内容对应???
tomcat控制浏览器不缓存 -
wussrc:
我只想说牛逼,就我接触过的那点云计算的东西,仔细想想还真是这么 ...
别样解释云计算,太TM天才跨界了 -
hw_imxy:
endpoint="/Hello/messagebr ...
flex+java代码分两个工程 -
gaohejie:
rsrsdgrfdh坎坎坷坷
Flex 与 Spring 集成 -
李涤尘:
谢谢。不过说得有点太罗嗦了。
Oracle数据库数据的导入及导出(转)
http://joshblog.net/2007/05/17/filter-xml-data-with-e4x-in-flash-part-2/
If you haven't read my first post about filtering data with E4X, go check it out now. Today, I'll expand on it to add a few more options that you have at your disposal when working with XML in ActionScript 3.
The following is a simple XHTML document that I will reference in the examples below:
Consider a situation where you want to retrieve all the paragraphs from an XHTML document. Each paragraph could be nested in DIVs, lists, tables, or anything. If we want to retrieve an XMLList of every paragraph in that document, we need to use E4X's .. operator. A single dot only allows you to access direct children of a node, but this operator allows you to drill-down into the hierarchy of every descendant in an XML object to access grandchildren and more.
You can combine this new operator with the filtering methods I introduced last time to build some pretty complex queries. The following example retrieves the URLs from all the anchors (links) in unordered lists with the class "links". Notice that I must use the attribute() function because class is an ActionScript keyword.
Of course, we don't need to access attributes through the complete hierarchy of their containing elements. Consider a situation where you want want a list of all the values of "class" attributes in an XHTML document. This attribute could appear on almost every element in the document. In most cases, you can directly reference the attribute with the @ symbol.
However, like the previous example, we can't access the "class" attribute as easily because it's an ActionScript keyword. Instead, let's use the decendants() function, which returns every element (not limited to direct children) that is below an XML node, along with the attribute() function to get the "class" attributes. The query will be a little more complex, but I don't think it's unwieldy.
You'll notice that the query returns every single class attribute in the document, including duplicates. For instance, there are two anchors in document that I have given the class "josh" because they happen to point to sites that have content created by me (this blog, and my employer, Yahoo!). What if I want a list containing only unique items? In other words, how can I get results where the "josh" class only appears once?
Unfortunately, E4X doesn't provide a native way to retrieve a list with only unique values. That's unfortunate because I've found that it's a common requirement. Based on my previous knowledge of combining E4X with ActionScript (remember the trace() call from my last post?), I built the following query that should do the job:
That snippet calls a simple function addUniqueValue() which I've included below.
As I demonstrated last time, code within parentheses in an E4X query basically runs in a loop for every item in an XMLList. I've used this to my advantage to call a function for each item in the list that checks to see if has been included in the filtered list. Once the full query finishes, an XMLList with unique items has been placed into the filteredClasses variable.
By the way, did you notice that XMLLists support the += operator to append additional items? I didn't know that until I just tried it. Nice.
That should cover everything you need to know to go crazy with E4X. Keep in mind that E4X can be a bit slow if written poorly, and it's important to optimize your queries for large datasets. If you need to filter your data, like I did to get unique values, remember that you can call ActionScript functions and assign values within the parentheses. Finally, don't forget about the attribute() and child() functions. They're very useful for using dynamic strings in your queries. E4X rocks.
If you haven't read my first post about filtering data with E4X, go check it out now. Today, I'll expand on it to add a few more options that you have at your disposal when working with XML in ActionScript 3.
The following is a simple XHTML document that I will reference in the examples below:
var html:XML = <html> <body> <ul class="links"> <li><a href="http://www.yahoo.com/" class="josh">Yahoo!</a></li> <li><a href="http://www.adobe.com/">Adobe</a></li> <li><a href="http://www.zeuslabs.us/" class="josh">Zeus Labs</a></li> </ul> <div id="intro"> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p> </div> <p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> </body> </html>;
Consider a situation where you want to retrieve all the paragraphs from an XHTML document. Each paragraph could be nested in DIVs, lists, tables, or anything. If we want to retrieve an XMLList of every paragraph in that document, we need to use E4X's .. operator. A single dot only allows you to access direct children of a node, but this operator allows you to drill-down into the hierarchy of every descendant in an XML object to access grandchildren and more.
var paragraphs:XMLList = html..p;
You can combine this new operator with the filtering methods I introduced last time to build some pretty complex queries. The following example retrieves the URLs from all the anchors (links) in unordered lists with the class "links". Notice that I must use the attribute() function because class is an ActionScript keyword.
var urls:XMLList = html..ul.(attribute("class") == "links")..a.@href;
Of course, we don't need to access attributes through the complete hierarchy of their containing elements. Consider a situation where you want want a list of all the values of "class" attributes in an XHTML document. This attribute could appear on almost every element in the document. In most cases, you can directly reference the attribute with the @ symbol.
var classes:XMLList = html..@class; //error for "class"
However, like the previous example, we can't access the "class" attribute as easily because it's an ActionScript keyword. Instead, let's use the decendants() function, which returns every element (not limited to direct children) that is below an XML node, along with the attribute() function to get the "class" attributes. The query will be a little more complex, but I don't think it's unwieldy.
var classes:XMLList = html.descendants().attribute("class");
You'll notice that the query returns every single class attribute in the document, including duplicates. For instance, there are two anchors in document that I have given the class "josh" because they happen to point to sites that have content created by me (this blog, and my employer, Yahoo!). What if I want a list containing only unique items? In other words, how can I get results where the "josh" class only appears once?
Unfortunately, E4X doesn't provide a native way to retrieve a list with only unique values. That's unfortunate because I've found that it's a common requirement. Based on my previous knowledge of combining E4X with ActionScript (remember the trace() call from my last post?), I built the following query that should do the job:
var filteredClasses:XMLList = new XMLList(); html.descendants().(filteredClasses = addUniqueValue(attribute("class"), filteredClasses));
That snippet calls a simple function addUniqueValue() which I've included below.
private function addUniqueValue(value:Object, list:XMLList):XMLList { if(!list.contains(value)) { list += value; } return list; }
As I demonstrated last time, code within parentheses in an E4X query basically runs in a loop for every item in an XMLList. I've used this to my advantage to call a function for each item in the list that checks to see if has been included in the filtered list. Once the full query finishes, an XMLList with unique items has been placed into the filteredClasses variable.
By the way, did you notice that XMLLists support the += operator to append additional items? I didn't know that until I just tried it. Nice.
That should cover everything you need to know to go crazy with E4X. Keep in mind that E4X can be a bit slow if written poorly, and it's important to optimize your queries for large datasets. If you need to filter your data, like I did to get unique values, remember that you can call ActionScript functions and assign values within the parentheses. Finally, don't forget about the attribute() and child() functions. They're very useful for using dynamic strings in your queries. E4X rocks.
发表评论
-
ActionScript 3.0 性能优化小知识
2010-07-30 14:12 1032http://xinsync.xju.edu.cn/in ... -
Flex企业级UI权限控制
2010-07-28 16:14 1302http://www.pin5i.com/showtopic- ... -
flex4中PopUpManager在module中有问题
2010-06-24 11:10 3142flex4中module加载module后flex4中 a ... -
Flex 开发: 类的反射
2010-06-24 10:56 1269http://www.ibm.com/developerwor ... -
Problems with ByteArray.writeObject()
2010-05-19 21:47 1725http://www.actionscript.org/for ... -
利用 E4X解决 XML 处理的性能问题
2010-05-19 21:11 1752http://www.blogjava.net/rosen/a ... -
正在安装的adobe flash player版本不是最新的版本
2010-04-22 09:56 2457打开注册表编辑器,定位到HKEY_LOCAL_MACHINE\ ... -
AS3 优化 之 FOR内循环
2010-02-10 15:39 1564写游戏只要有思路,就能实现,但这也只是从功能角度出发,能不能有 ... -
flex模块切换时导致对象不正确序列化的解决办法
2009-12-02 09:08 1628http://lkfnn.iteye.com/blog/506 ... -
漂亮的登陆
2009-11-19 16:32 1160http://dougmccune.com/360Flex_A ... -
Download all 177 Flash Effects Source Files .fla
2009-11-13 09:27 1223http://www.jeffjoneslive.com/Fl ... -
flex如何接受其他页面Post过来的数据
2009-10-10 11:15 2558问题描述: 有个程序需要调用我的flex页面,需要给我传 ... -
Change font size in the whole app with Ctrl+/-
2009-10-09 10:06 1202http://feedproxy.google.com/~r/ ... -
flex delete关键词和类成员
2009-10-09 09:01 1408flash中delete关键词用来移除定义的变量,并不能从内存 ... -
Flex HTTPService如何给后台传递参数
2009-10-09 08:56 1525http://blog.csdn.net/joeyshi/ar ... -
FLEX Builder compiler arguments 的设置
2009-09-28 08:20 1656http://flash.9ria.com/thread-18 ... -
12 Best Adobe AIR Applications for Web Designers
2009-09-25 08:20 107812 Best Adobe AIR Applications ... -
做网页如何改变IE地址栏的显示IE图标
2009-09-23 16:55 2701这个问题的解决其实在flex之外 修改index.templa ... -
Flex设置html(页面标题)title问题
2009-09-23 15:31 3287如果你是一个整体系统用了同一个标题:可以修改模板页index. ... -
flex中文问题,访问中文路径问题
2009-09-23 14:36 1202本文最先发表在本人个 ...
相关推荐
Two modern topics in Kalman filtering are new additions to this Third Edition of Kalman Filtering with Real-Time Appli- cations. Interval Kalman Filtering (Chapter 10) is added to ex- pand the ...
3. 瞬态效应与长期模式的区分:在模型更新时,需要有效区分哪些变化是短期的,哪些变化是长期且有意义的,这通常需要更复杂的数据处理和模式识别技术。 4. 数据的全面利用:在处理动态数据时,重要的是能够利用所有...
Adaptive Filtering Primer with Matlab Adaptive Filtering Primer with Matlab Adaptive Filtering Primer with Matlab Adaptive Filtering Primer with Matlab
ACC-SO(3)-Constrained Kalman Filtering with Application to Attitude
《SuRF: 实践性范围查询过滤与快速简洁的Trie》是关于一种新的数据结构SuRF(Succinct Range Filter)的研究论文。SuRF旨在解决传统Bloom Filter无法同时高效处理单键查找和范围查询的问题。文章由来自卡内基梅隆...
In spite of its importance, the mathematical theory of Kalman filtering and its implications are not well understood even among many applied mathematicians and engineers. In fact, most practitioners ...
is of critical importance in the Gaussian mixture probability hypothesis density (PHD) and cardinalized PHD (CPHD) filters. In addition, these two filters require that the process noise and ...
3. 卡尔曼滤波器的扩展和非线性扩展:线性卡尔曼滤波器仅适用于线性系统,因此当面对实际的非线性问题时,需要对卡尔曼滤波器进行扩展,使其能够处理非线性系统。扩展卡尔曼滤波器是通过泰勒级数展开和线性近似来...
《Fundamental Limitations in Filtering and Control》一书由María M. Seron、Julio H. Braslavsky和Graham C. Goodwin共同撰写,首次由Springer-Verlag London Limited出版于1997年。本书系统地探讨了滤波与控制...
从提供的文件信息来看,文章的标题为"Decentralized Quantized Kalman Filtering With Scalable Communication Cost",这表明文章主要讨论的是关于分布式量化卡尔曼滤波算法以及其可扩展通信成本的研究。根据描述,...
Optimal_filtering_with_Kalman_filters_and_smoother 本文档总结了Kalman滤波器和平滑器在 Matlab 工具箱 EKF/UKF 中的应用,旨在提供一个关于Kalman滤波器的详细指南。 kalman滤波器的优点 Kalman滤波器是一种...
Kalman Filtering: Theory and Practice Using MATLAB, Fourth Edition is an ideal textbook in advanced undergraduate and beginning graduate courses in stochastic processes and Kalman filtering....
【标题】中所提到的“Optimal Kalman Filtering for System with Unknown Inputs”意味着这篇文章将探讨在存在未知输入的情况下的卡尔曼滤波器的最优滤波算法。描述中提到的方法与传统的固定未知量估计方法不同,...
3. 卡尔曼滤波的实时应用第四版(Kalman Filtering with Real-Time Applications 4th Edition):这本书是查尔斯·K·崔(Charles K. Chui)教授和陈关荣(Guanrong Chen)教授共同编写的。第四版中增加了两个现代...
自适应滤波 matlab;著者 alexander ramadan
This book presents a unified view of filtering techniques with a special focus on watelet analysis in finance and economics.