XmlTextReader例子

 

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;
using System.Xml.Schema;

public partial class selector : System.Web.UI.Page
{
    
protected void Page_Load(object sender, EventArgs e)
    
{

    }
 
    
ValidationEvtCallBack

    
protected void btnAnalyze_ServerClick(object sender, EventArgs e)
    
{
        
declare variables

        
        
try

 

    }


    
}


 
posted @ 2008-04-19 12:38 Robot·H 阅读(77) 评论(1)  编辑 收藏 所属分类: .NetFramework

  回复  引用  查看    
#1楼 [楼主]2008-04-19 12:38 | Robot·H      
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using System.Xml;
using System.IO;
using System.Security;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{


}
protected void btnCreate_Click(object sender, EventArgs e)
{
#region //filepath
string filepath = "c:\\temp\\XmlTest"+Session.SessionID+".xml"; // \\
Response.Write(filepath);
#endregion

#region instance XmlTExtWrite new XmlTextWriter(string,Encoding)
XmlTextWriter xtw = new XmlTextWriter(filepath, System.Text.Encoding.UTF8);
xtw.Formatting = Formatting.Indented;
xtw.Indentation = 3;
#endregion
//ArgumentException,UnauthorizedAccesException,IOException,DirectoyNotFopund,SecurityException,
#region WriteStartDocument
xtw.WriteStartDocument();
#endregion

#region root element
xtw.WriteStartElement("DocumentCategorization", "urn:xmlabs-com-cat");

#endregion

//statistics
xtw.WriteStartElement("GlobalCount");
xtw.WriteAttributeString("Elements", "2");
xtw.WriteAttributeString("Commponets", "1");
xtw.WriteAttributeString("CDATA", "4");
//clientPath
xtw.WriteStartElement("ClientPath");
xtw.WriteString(filepath);
xtw.WriteEndElement();



xtw.WriteEndElement();

xtw.WriteEndElement();
xtw.Flush();
xtw.Close();

}
}


标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      


相关链接: