XML写入数据的问题。。如何接收起行这个操作呢?。。来挑战一下。。呵呵
一个TextBox用来接收数据。。。例如一篇文章。。文章的话就必然会有另起一行的啦。。
那么些数据如何保存在XML文件里呢???
我的一个操作
XmlDocument xdoc = new XmlDocument;
xdoc.Load( Server.MapPath( "db.xml" ));
XmlElement parentNode = xdoc.CreateElement( "guest" );
xdoc.DocumentElement.PrependChild( parentNode );
XmlElement commentNode = xdoc.CreateElement("comment");
XmlComment commentText= xdoc.CreateComment(comment.Text);//comment.Text为TextBox接收到的数据
parentNode.AppendChild( commentNode );
commentNode.AppendChild(commentText);
xdoc.Save( Server.MapPath( "db.xml" ));
我输出这些数据的时候失败了。。。另起一行的地方没有起行的。。只是多了个空格。。真郁闷。。
求高手指点。。
主要是输入数据的时候应该如何保存。。和输出的时候如何操作的问题了。。。