zoukankan      html  css  js  c++  java
  • flash读取asps返回xml格式

     protected List<TeamWorkInfos> tList = new List<TeamWorkInfos>();
        protected void Page_Load(object sender, EventArgs e)
        {
            MemberInfo[] mList = GetCacheMembers(1);
            System.Text.StringBuilder xmlnode = new System.Text.StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
    
            if (mList == null)
            {
                xmlnode.Append("<data><error>信息读取错误!请您与管理员联系!</error></data>");
                ResponseXML(xmlnode);
                return;
            }
            xmlnode.Append("<persons>");
            if (mList != null)
            {
                foreach (MemberInfo mi in mList)
                {
                    xmlnode.Append("<person>");
                    xmlnode.AppendFormat("<name>{0}</name>",mi.Nickname);
                    if (minfo.Light >= 0 && minfo.Light < 2)
                    {
                        xmlnode.AppendFormat("<qq>{0}</qq>", "星光点点");
                    }
                    else if (minfo.Light >= 2 && minfo.Light < 5)
                    {
                        xmlnode.AppendFormat("<qq>{0}</qq>", "星光闪闪");
                    }
                    else if (minfo.Light >= 5 && minfo.Light < 9)
                    {
                        xmlnode.AppendFormat("<qq>{0}</qq>", "星光灿烂");
                    }
                    else
                    {
                        xmlnode.AppendFormat("<qq>{0}</qq>", "星光璀璨");
                    }
    
                    xmlnode.AppendFormat("<email>{0}</email>", mi.TeamAge);
                    xmlnode.AppendFormat("<pub url=\"{0}\"></pub>", mi.Img);
                    xmlnode.AppendFormat("<information>{0}</information>", mi.Selfdesc);
                    xmlnode.Append("<pics>");
    
                    tList = GetCacheWorkListByusername(mi.Name);
                    foreach (TeamWorkInfos tw in tList)
                    {
                        xmlnode.AppendFormat("<pic url=\"{0}\" linkurl=\"{1}\"></pic>", tw.Listpic, tw.Url);
                    }
                    xmlnode.Append("</pics>");
                    xmlnode.AppendFormat("<ziduan1>{0}</ziduan1>", "星光亮度");
                    xmlnode.AppendFormat("<ziduan2>{0}</ziduan2>", "星年龄");
                    xmlnode.Append("</person>");
                }
            }
            xmlnode.Append("</persons>");
    
            ResponseXML(xmlnode);
        }
    
        private void ResponseXML(StringBuilder xmlnode)
        {
            System.Web.HttpContext.Current.Response.Clear();
            System.Web.HttpContext.Current.Response.ContentType = "Text/XML";
            System.Web.HttpContext.Current.Response.Expires = 0;
            System.Web.HttpContext.Current.Response.Cache.SetNoStore();
            System.Web.HttpContext.Current.Response.Write(xmlnode.ToString());
            System.Web.HttpContext.Current.Response.End();
        }
    

  • 相关阅读:
    无线传感器网络 与 OMNET++学习笔记(二) NED
    无线传感器网络 与 OMNET++学习笔记(一)
    win10:未在本地计算机上注册“microsoft.ACE.oledb.12.0”提供程序
    XML 命名空间“clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit”中不存在标记“Chart”
    白书动态规划例题和习题简解
    BZOJ 1266
    BZOJ 1001 (UVa1376, LA3661 )
    UVa 11178
    BZOJ 1787 裸LCA
    BZOJ 2440
  • 原文地址:https://www.cnblogs.com/yhdkzy/p/2055530.html
Copyright © 2011-2022 走看看