zoukankan      html  css  js  c++  java
  • 用response输出XML dodo

    string strXML = "<?xml version=\"1.0\"?>";
                    strXML+="<books><bookdata id=\"1\">";
               
         strXML+="<title>C# premier</title>";
         strXML += "<year>2005</year>";
         strXML+="<publisher> Qinghua University Press</publisher>";
         strXML+="<Author>hou </Author>";
         strXML+="<pagers>500 </pagers>";
         strXML+="<description> c# fundation knowledge</description>";
         strXML+="<Price>50.00</Price>";
       strXML+="</bookdata>";

       strXML+="<bookdata id=\"2\">";
         strXML+="<title>xml premier</title>";
         strXML+="<year>2005</year>";
         strXML+="<publisher> Peking University Press</publisher>";
         strXML+="<Author>Leo </Author>";
         strXML+="<pagers>400 </pagers>";
         strXML+="<description> xml fundation knowledge</description>";
         strXML+="<Price>45.00</Price>";
      strXML+="</bookdata>";

       strXML+="<bookdata id=\"3\">";
         strXML+="<title>UML</title>";
         strXML+="<year>2005</year>";
         strXML+="<publisher> Peking University Press</publisher>";
        strXML+=" <Author>James </Author>";
        strXML+=" <pagers>650 </pagers>";
        strXML+=" <description>UML fundation knowledge</description>";
        strXML += " <Price>85.00</Price>";
      strXML+=" </bookdata></books>";

                Response.ContentType = "text/xml";
                Response.Charset = "UTF-8";
                System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
                doc.LoadXml(strXML);
                doc.Save(Response.OutputStream);
                Response.End();


    读取现有的xml:

     Response.ContentType = "text/xml";
                Response.Charset = "UTF-8";
                System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
                string strPath = @"~/login/xmlfile";
                doc.Load(Server.MapPath(strPath + "/books.xml"));//requests.xml是服务器上xml文件  
                Response.Write(doc.DocumentElement.OuterXml);  
                 Response.End();

    本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/wsdgqs/archive/2008/03/31/2233662.aspx

  • 相关阅读:
    elementui表单输入框部分校验--判断
    vue学习如何引入js,封装操作localStorage本地储存的方法
    vue组件传值 递增次数传递bug修复
    vue深度监听之手机格式344
    vue-------滑动验证
    vue get/post请求如何携带cookie的问题
    elementui的dialog组件踩坑
    WebStorm License Activation (WebStorm许可证激活)
    input 标签实现带提示文字的输入框
    隐藏 input 标签的边框
  • 原文地址:https://www.cnblogs.com/zgqys1980/p/1585052.html
Copyright © 2011-2022 走看看