• 后台XML处理


    public void GetInfo()     {         string message = @"<?xml version='1.0' encoding='utf-8' ?><BILL><HEAD><ADD KEY='FPLB' VALUE='1100' /><ADD KEY='FPBBH' VALUE='2011' /></HEAD><BODY><ITEM><OBJECT XH='2' VALUE='用户编号:88042203'  /><OBJECT XH='2' VALUE='用户编号:88042203'  /><OBJECT XH='2' VALUE='用户编号:88042203'  /><OBJECT XH='2' VALUE='用户编号:88042203'  /><OBJECT XH='3' VALUE='用户名称:张涌'  /><OBJECT XH='3' VALUE='用户名称:张涌'  /><OBJECT XH='3' VALUE='用户名称:张涌'  /><OBJECT XH='3' VALUE='用户名称:张涌'  /><OBJECT XH='4' VALUE='用户地址:水厂家属院2-2-1(厕)'  /><OBJECT XH='4' VALUE='用户地址:水厂家属院2-2-1(厕)'  /><OBJECT XH='4' VALUE='用户地址:水厂家属院2-2-1(厕)'  /><OBJECT XH='4' VALUE='用户地址:水厂家属院2-2-1(厕)'  /><OBJECT XH='1' VALUE='2014-10-16'  /><OBJECT XH='1' VALUE='2014-10-16'  /><OBJECT XH='1' VALUE='2014-10-16'  /><OBJECT XH='1' VALUE='2014-10-16'  /><OBJECT XH='20' VALUE='自来水生产和供应'  /><OBJECT XH='20' VALUE='自来水生产和供应'  /><OBJECT XH='20' VALUE='自来水生产和供应'  /><OBJECT XH='20' VALUE='自来水生产和供应'  /><OBJECT XH='5' VALUE='计费月份:201408'  /><OBJECT XH='5' VALUE='计费月份:201408'  /><OBJECT XH='5' VALUE='计费月份:201408'  /><OBJECT XH='5' VALUE='计费月份:201408'  /><OBJECT XH='10' VALUE='起数:107'  /><OBJECT XH='10' VALUE='起数:107'  /><OBJECT XH='10' VALUE='起数:107'  /><OBJECT XH='10' VALUE='起数:107'  /><OBJECT XH='11' VALUE='止数:109'  /><OBJECT XH='11' VALUE='止数:109'  /><OBJECT XH='11' VALUE='止数:109'  /><OBJECT XH='11' VALUE='止数:109'  /><OBJECT XH='21' VALUE='实用水量:2'  /><OBJECT XH='21' VALUE='实用水量:2'  /><OBJECT XH='21' VALUE='实用水量:2'  /><OBJECT XH='21' VALUE='实用水量:2'  /><OBJECT XH='6' VALUE='上次余额:0.96'  /><OBJECT XH='6' VALUE='上次余额:0.96'  /><OBJECT XH='6' VALUE='上次余额:0.96'  /><OBJECT XH='6' VALUE='上次余额:0.96'  /><OBJECT XH='7' VALUE='本次余额:0.70'  /><OBJECT XH='7' VALUE='本次余额:0.70'  /><OBJECT XH='7' VALUE='本次余额:0.70'  /><OBJECT XH='7' VALUE='本次余额:0.70'  /><OBJECT XH='15' VALUE='应收合计:8.26'  /><OBJECT XH='15' VALUE='应收合计:8.26'  /><OBJECT XH='15' VALUE='应收合计:8.26'  /><OBJECT XH='15' VALUE='应收合计:8.26'  /><OBJECT XH='16' VALUE='实收金额:8.00  金额大写: 捌元整'  /><OBJECT XH='16' VALUE='实收金额:8.00  金额大写: 捌元整'  /><OBJECT XH='16' VALUE='实收金额:8.00  金额大写: 捌元整'  /><OBJECT XH='16' VALUE='实收金额:8.00  金额大写: 捌元整'  /><OBJECT XH='17' VALUE='抄表员:申莉'  /><OBJECT XH='17' VALUE='抄表员:申莉'  /><OBJECT XH='17' VALUE='抄表员:申莉'  /><OBJECT XH='17' VALUE='抄表员:申莉'  /><OBJECT XH='18' VALUE='收银员:黄梅     抢修电话:41401412'  /><OBJECT XH='18' VALUE='收银员:黄梅     抢修电话:41401412'  /><OBJECT XH='18' VALUE='收银员:黄梅     抢修电话:41401412'  /><OBJECT XH='18' VALUE='收银员:黄梅     抢修电话:41401412'  /><OBJECT XH='9' VALUE='用水类别 '  /><OBJECT XH='9' VALUE='用水类别 '  /><OBJECT XH='9' VALUE='用水类别 '  /><OBJECT XH='9' VALUE='用水类别 '  /><OBJECT XH='12' VALUE='水   量'  /><OBJECT XH='12' VALUE='水   量'  /><OBJECT XH='12' VALUE='水   量'  /><OBJECT XH='12' VALUE='水   量'  /><OBJECT XH='13' VALUE='单   价'  /><OBJECT XH='13' VALUE='单   价'  /><OBJECT XH='13' VALUE='单   价'  /><OBJECT XH='13' VALUE='单   价'  /><OBJECT XH='14' VALUE='金   额'  /><OBJECT XH='14' VALUE='金   额'  /><OBJECT XH='14' VALUE='金   额'  /><OBJECT XH='14' VALUE='金   额'  /><OBJECT XH='19' VALUE='00010024'  /><OBJECT XH='19' VALUE='00010024'  /><OBJECT XH='19' VALUE='00010024'  /><OBJECT XH='19' VALUE='00010024'  /></ITEM><LISTITEM><OBJECT XH='1'  ROW='0'  VALUE='生活用水水费' /><OBJECT XH='1'  ROW='0'  VALUE='生活用水水费' /><OBJECT XH='1'  ROW='0'  VALUE='生活用水水费' /><OBJECT XH='1'  ROW='0'  VALUE='生活用水水费' /><OBJECT XH='2'  ROW='0'  VALUE='' /><OBJECT XH='2'  ROW='0'  VALUE='' /><OBJECT XH='2'  ROW='0'  VALUE='' /><OBJECT XH='2'  ROW='0'  VALUE='' /><OBJECT XH='3'  ROW='0'  VALUE='' /><OBJECT XH='3'  ROW='0'  VALUE='' /><OBJECT XH='3'  ROW='0'  VALUE='' /><OBJECT XH='3'  ROW='0'  VALUE='' /><OBJECT XH='4'  ROW='0'  VALUE='2' /><OBJECT XH='4'  ROW='0'  VALUE='2' /><OBJECT XH='4'  ROW='0'  VALUE='2' /><OBJECT XH='4'  ROW='0'  VALUE='2' /><OBJECT XH='5'  ROW='0'  VALUE='2.50' /><OBJECT XH='5'  ROW='0'  VALUE='2.50' /><OBJECT XH='5'  ROW='0'  VALUE='2.50' /><OBJECT XH='5'  ROW='0'  VALUE='2.50' /><OBJECT XH='6'  ROW='0'  VALUE='5.00' /><OBJECT XH='6'  ROW='0'  VALUE='5.00' /><OBJECT XH='6'  ROW='0'  VALUE='5.00' /><OBJECT XH='6'  ROW='0'  VALUE='5.00' /><OBJECT XH='1'  ROW='1'  VALUE='代收生活污水处理费' /><OBJECT XH='1'  ROW='1'  VALUE='代收生活污水处理费' /><OBJECT XH='1'  ROW='1'  VALUE='代收生活污水处理费' /><OBJECT XH='1'  ROW='1'  VALUE='代收生活污水处理费' /><OBJECT XH='2'  ROW='1'  VALUE='' /><OBJECT XH='2'  ROW='1'  VALUE='' /><OBJECT XH='2'  ROW='1'  VALUE='' /><OBJECT XH='2'  ROW='1'  VALUE='' /><OBJECT XH='3'  ROW='1'  VALUE='' /><OBJECT XH='3'  ROW='1'  VALUE='' /><OBJECT XH='3'  ROW='1'  VALUE='' /><OBJECT XH='3'  ROW='1'  VALUE='' /><OBJECT XH='4'  ROW='1'  VALUE='2' /><OBJECT XH='4'  ROW='1'  VALUE='2' /><OBJECT XH='4'  ROW='1'  VALUE='2' /><OBJECT XH='4'  ROW='1'  VALUE='2' /><OBJECT XH='5'  ROW='1'  VALUE='1.00' /><OBJECT XH='5'  ROW='1'  VALUE='1.00' /><OBJECT XH='5'  ROW='1'  VALUE='1.00' /><OBJECT XH='5'  ROW='1'  VALUE='1.00' /><OBJECT XH='6'  ROW='1'  VALUE='2.00' /><OBJECT XH='6'  ROW='1'  VALUE='2.00' /><OBJECT XH='6'  ROW='1'  VALUE='2.00' /><OBJECT XH='6'  ROW='1'  VALUE='2.00' /><OBJECT XH='1'  ROW='2'  VALUE='代收生活水资源费' /><OBJECT XH='1'  ROW='2'  VALUE='代收生活水资源费' /><OBJECT XH='1'  ROW='2'  VALUE='代收生活水资源费' /><OBJECT XH='1'  ROW='2'  VALUE='代收生活水资源费' /><OBJECT XH='2'  ROW='2'  VALUE='' /><OBJECT XH='2'  ROW='2'  VALUE='' /><OBJECT XH='2'  ROW='2'  VALUE='' /><OBJECT XH='2'  ROW='2'  VALUE='' /><OBJECT XH='3'  ROW='2'  VALUE='' /><OBJECT XH='3'  ROW='2'  VALUE='' /><OBJECT XH='3'  ROW='2'  VALUE='' /><OBJECT XH='3'  ROW='2'  VALUE='' /><OBJECT XH='4'  ROW='2'  VALUE='2' /><OBJECT XH='4'  ROW='2'  VALUE='2' /><OBJECT XH='4'  ROW='2'  VALUE='2' /><OBJECT XH='4'  ROW='2'  VALUE='2' /><OBJECT XH='5'  ROW='2'  VALUE='0.12' /><OBJECT XH='5'  ROW='2'  VALUE='0.12' /><OBJECT XH='5'  ROW='2'  VALUE='0.12' /><OBJECT XH='5'  ROW='2'  VALUE='0.12' /><OBJECT XH='6'  ROW='2'  VALUE='0.24' /><OBJECT XH='6'  ROW='2'  VALUE='0.24' /><OBJECT XH='6'  ROW='2'  VALUE='0.24' /><OBJECT XH='6'  ROW='2'  VALUE='0.24' /><OBJECT XH='1'  ROW='3'  VALUE='违约金' /><OBJECT XH='1'  ROW='3'  VALUE='违约金' /><OBJECT XH='1'  ROW='3'  VALUE='违约金' /><OBJECT XH='1'  ROW='3'  VALUE='违约金' /><OBJECT XH='2'  ROW='3'  VALUE='' /><OBJECT XH='2'  ROW='3'  VALUE='' /><OBJECT XH='2'  ROW='3'  VALUE='' /><OBJECT XH='2'  ROW='3'  VALUE='' /><OBJECT XH='3'  ROW='3'  VALUE='' /><OBJECT XH='3'  ROW='3'  VALUE='' /><OBJECT XH='3'  ROW='3'  VALUE='' /><OBJECT XH='3'  ROW='3'  VALUE='' /><OBJECT XH='4'  ROW='3'  VALUE='' /><OBJECT XH='4'  ROW='3'  VALUE='' /><OBJECT XH='4'  ROW='3'  VALUE='' /><OBJECT XH='4'  ROW='3'  VALUE='' /><OBJECT XH='5'  ROW='3'  VALUE='' /><OBJECT XH='5'  ROW='3'  VALUE='' /><OBJECT XH='5'  ROW='3'  VALUE='' /><OBJECT XH='5'  ROW='3'  VALUE='' /><OBJECT XH='6'  ROW='3'  VALUE='1.02' /><OBJECT XH='6'  ROW='3'  VALUE='1.02' /><OBJECT XH='6'  ROW='3'  VALUE='1.02' /><OBJECT XH='6'  ROW='3'  VALUE='1.02' /></LISTITEM></BODY></BILL>";

            try         {             XmlDocument xmlPrint = new XmlDocument();             xmlPrint.LoadXml(message);             string Kpr = xmlPrint.SelectNodes("BILL/BODY/ITEM/OBJECT[@XH='18']")[0].Attributes["VALUE"].Value.Split(' ')[0];             string InvoVersion = xmlPrint.SelectNodes("BILL/HEAD/ADD")[1].Attributes["VALUE"].Value;             string yhbh = xmlPrint.SelectNodes("BILL/BODY/ITEM/OBJECT[@XH='2']")[0].Attributes["VALUE"].Value;             double Je = 0.00;             int count = xmlPrint.SelectNodes("BILL/BODY/LISTITEM/OBJECT").Count;             int maxRow = Convert.ToInt32(xmlPrint.SelectNodes("BILL/BODY/LISTITEM/OBJECT")[count - 1].Attributes["ROW"].Value);             List<string> listPriceName = new List<string>();             List<string> listPrice = new List<string>();             string textFPdate = "BILL/BODY/LISTITEM/OBJECT[@ROW='{0}']";             int countItem = xmlPrint.SelectNodes("BILL/BODY/LISTITEM/OBJECT[@ROW='0']").Count;             for (int i = 0; i < maxRow+1; i++)             {                 string parameter = string.Format(textFPdate, i);                 listPriceName.Add(xmlPrint.SelectNodes(parameter)[0].Attributes["VALUE"].Value);                 listPrice.Add(xmlPrint.SelectNodes(parameter)[countItem-1].Attributes["VALUE"].Value);             }             for (int i = 0; i < listPriceName.Count; i++)             {                 if (listPriceName[i] != "违约金")                 {                     Je = Je + Convert.ToDouble(listPrice[i]);                 }             }         }         catch (Exception ex)         {             Response.Write("<Script language='javascript'>alert('" + ex.Message + "')</Script>");             return;         }

        }

  • 相关阅读:
    mysql启动失败一例
    Windows 10 执行pip list报错 UnicodeDecodeError: 'gbk' codec can't decode
    GPT转MBR
    python_查找模块的方法
    python_函数中使用*和**
    Python_单元测试工具nose
    状态迁移法
    场景分析法
    可爱的Python_课后习题_CDay0 时刻准备着!发布
    可爱的Python_课后习题_CDay−2 完成核心功能
  • 原文地址:https://www.cnblogs.com/selfimprove/p/4030300.html
Copyright © 2020-2023  润新知