`
jarorwar
  • 浏览: 87702 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

在flex中使用外部xml做为数据源

    博客分类:
  • Flex
阅读更多

1、flex程序

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
 <mx:XML id="xmlData" source="books.xml"/>
 <mx:XMLListCollection id="books" source="{xmlData.book}"/>
 <mx:Panel layout="absolute" left="0" right="0" top="0" bottom="0">
 
  <mx:DataGrid x="347" y="136" width="406" height="195" dataProvider="{books}">
   <mx:columns>
    <mx:DataGridColumn headerText="bookname" dataField="bookname"/>
    <mx:DataGridColumn headerText="author" dataField="author"/>
    <mx:DataGridColumn headerText="price" dataField="price"/>
   </mx:columns>
  </mx:DataGrid>
 </mx:Panel>
</mx:Application>

2、xml文件:

 

<?xml version="1.0" encoding="utf-8"?>

<books>
  <!--this is a book about xml-->
  <book>
    <bookname>java &amp;&amp; java</bookname>
    <author>nobody&amp;&amp; nobody</author>
    <price>28.5</price>
  </book>
</books>

 

不知道为什么,我总是使用不明白javaeye的这个编辑器,谁知道留言给我教一下!

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics