尝试插入xml值 [英] Trying to insert xml values
本文介绍了尝试插入xml值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试插入XML值,但是它不起作用.
有人可以帮我吗?
这是我的代码:
I am trying to insert XML values, but it is not working.
Can any one help me?
This is my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
XmlTextReader reader = new XmlTextReader("C:\\Documents and Settings\\azhar\\Desktop\\flashrecorder.xml");
XmlNodeType type;
while (reader.Read())
{
type = reader.NodeType;
if (type == XmlNodeType.Element)
{
if (reader.Name == "")
{
reader.Read();
TextBox1.Text = reader.Value;
}
if (reader.Name == "")
{
reader.Read();
ListBox1.Items.Add(reader.Value);
}
reader.Close();
}
}
}
}
这是XML文件:
This is XML file:
<CONFIG>
<SETTINGS>
<PLAYER_SETTINGS Name="License" Value="6b100nwghzms2cqk8v5prdjyf7t493"/>
<PLAYER_SETTINGS Name="SiteURL" Value="http://irrex.ctco.lv:81/videocapture/"/>
<PLAYER_SETTINGS Name="ServerURL" Value="rtmp://10.101.101.2:1935/oflaDemo/"/>
<PLAYER_SETTINGS Name="FPS" Value="10" />
<PLAYER_SETTINGS Name="AudioRate" Value="11"/>
<PLAYER_SETTINGS Name="VideoWidth" Value="320"/>
<PLAYER_SETTINGS Name="VideoHeight" Value="240"/>
<PLAYER_SETTINGS Name="VideoCompression" Value="85"/>
<PLAYER_SETTINGS Name="AudioGain" Value="50"/>
<PLAYER_SETTINGS Name="SaveScript" Value="http://irr.ctco.lv/agjbrs/SaveVideoFile.aspx"/>
<PLAYER_SETTINGS Name="AudioActivity" Value="50"/>
<PLAYER_SETTINGS Name="VideoActivity" Value="50"/>
<PLAYER_SETTINGS Name="MaxRecordingTime" Value="50"/>
<PLAYER_SETTINGS Name="Color" Value="0x000077"/>
<PLAYER_SETTINGS Name="EmbedURL" Value="http://irrex.ctco.lv/videocapture/player.swf"/>
<PLAYER_SETTINGS Name="ShareURL" Value="http://irrex.ctco.lv/videocapture/share.aspx"/>
<PLAYER_SETTINGS Name="LogoURL" Value="http://irrrx.ctco.lv/videocapture/logo.jpg"/>
<PLAYER_SETTINGS Name="RedirectURL" Value="http://irrex.ctco.lv/agjbrs/Videorecorder.aspx?from=save"/>
<PLAYER_SETTINGS Name="ShowLinkButton" Value="false"/>
</SETTINGS>
<MSG>
<ERROR Name="Saving" Value="Saving file to the database..."/>
<ERROR Name="SaveSuccess" Value="The file has been saved successfully"/>
<ERROR Name="SaveError" Value="There was an error saving the file.Plz Check File size"/>
<ERROR Name="NoMic" Value="You do not have a microphone installed"/>
<ERROR Name="NoCam" Value="You do not have a camera installed"/>
<ERROR Name="MaxRecordingTime" Value="Time limit"/>
</MSG>
</CONFIG>
推荐答案
使用xdocument
请参见将xml子节点读取到我的sql数据库中 [ ^ ]
use xdocument
see reading xml child nodes to my sql database[^]
这篇关于尝试插入xml值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文