flex通过HTTPService组件读取复杂结构的xml文件
弄了两天,终于把复杂的xml文件的数据根据自己的要求读出来,显示在页面上了。flex通过HTTPService组件发送请求,读取xml文件中数据,用xmllistcollection存储xml中某一部分数据,并绑定在gridview控件上。
xml,xmllist,xmllistcollection中只有xmllistcollection具有修改更新数据的功能。xmllistcollection是xmllist的集合,具有source属性,可以将某一个xmllist附给xmllistcollection的source属性。
xml代码:
<?xml version="1.0" encoding="gb2312"?>
<c>
<code>200</code>
<reportid>421</reportid>
<labid>2</labid>
<labname>牛顿第二定律</labname>
<startdate>2010-1-13 21:54:58</startdate>
<submitdate>2010-1-13 21:55:20</submitdate>
<status>1</status>
<labscore>98.63762</labscore><
lastscore>98.63762</lastscore>
<totalscore>0.0</totalscore>
<username>admin</username>
<result>
<result>
<data>
<sheetxy id="fa">
<sheet column1="力F" column2="加速度a">
<data x="0" y="0"/>
<data x="1" y="1"/>
<data x="2" y="2"/>
<data x="3" y="3"/>
<data x="4" y="4"/>
</sheet>
</sheetxy>
<sheetxy id="ma">
<sheet column1="小车质量" column2="加速度a">
</sheet>
</sheetxy>
</data>
</result>
</result>
<userinput></userinput>
</c>
主要的mxml代码:因为这是主程序的一个组件,所以只附上相关的代码
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
creationComplete="onCreationComplete()">
<mx:Script>
<!--[CDATA[
import mx.collections.XMLListCollection;
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import valueObjects.ResultData;
import mx.controls.Alert;
相关文档:
/*
* history
*
* Created on 2003-5-26
*
* 2003-06-05
* 1.增加了Log的处理信息。
* 2.抛出的异常由原来UtilException的改变成XMLException,后者继承前者。
*
* 2003-09-02 by David Yu
* 1.增加了改变一个 ......
1.在flex里面显示查询后的list集合数据
private var model:ModelConfig=ModelConfig.getOne();
ModelCong类中存放一些全局的东西要实现接口implements IModelLocator
(如public var root:String="http://192.168.1.68:8090/OA";--系统数据,
public var users:UsersVO=new UsersVO();用来存储信息的变量, ......
以下为一天的基本学习情况,包括学习和复习,模式部分前前后后也看了很多了,但是一直没能坚持看完,希望这次可以坚持下去。
模式部分我没有直接去看比较经典的《java与模式》,这书太厚容易让我坚持不下去,而是采用了程杰写的《大话设计模式》,
这书写的很有意思,也很容易理解。希望这样的书可以多些。呵呵,当然等看 ......
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Xml;
using System.Data;
public class Cls_XML
{
#region 创建xml文件
/// <summary>
/// 创建xml文件
/// ......
ZT:http://www.mobpub.net/archiver/?tid-28.html
Symbian学习笔记(15)——解析XML文件(上)
今天想分享的是如何在Symbian平台上解析XML文件,不需要第三方的东西,Symbian已经为我们提供了这个类CParser。
网上也有这方面的资料,建议参考:
[url]http://wiki.forum.nokia.com/index.php/How_to_parse_XML_fi ......