出现这样的错误,怎么解决??????!!

pontus 2004-12-10 12:58:52
错误信息:“0”字符(十六进制值 0x30)不能以名称作为开头。 行 3,位置 15。


---相应代码部分--

[WebMethod]
public void MSend(string strFrom,string strTo,string strContent)
{
string xmlUrl=Server.MapPath("Message.xml");
XmlDocument xmlDoc=GetXmlDoc(xmlUrl);
XmlNode root=xmlDoc.DocumentElement;
int id=1;
if(root.HasChildNodes)
{
id=Convert.ToInt32(root.LastChild.Attributes["id"].Value)+1;
}
XmlElement xe=xmlDoc.CreateElement("Message");
xe.SetAttribute("id",id.ToString());
root.AppendChild(xe);
XmlElement xe1=xmlDoc.CreateElement("From");
xe1.InnerText=strFrom;
xe.AppendChild(xe1);
XmlElement xe2=xmlDoc.CreateElement("To");
xe2.InnerText=strTo;
xe.AppendChild(xe2);
XmlElement xe3=xmlDoc.CreateElement("Content");
xe3.InnerText=strContent;
xe.AppendChild(xe3);
xmlDoc.Save(xmlUrl);
}
...全文
88 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
nutpp 2005-09-03
  • 打赏
  • 举报
回复
没人回答就接分
pontus 2004-12-10
  • 打赏
  • 举报
回复
找到原因了
pontus 2004-12-10
  • 打赏
  • 举报
回复
upup

110,568

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧