当前位置: 代码迷 >> ASP.NET >> 呵呵,刚接触到C#与xml,所以想请帮忙写个过程,多谢~
  详细解决方案

呵呵,刚接触到C#与xml,所以想请帮忙写个过程,多谢~

热度:7044   发布时间:2013-02-26 00:00:00.0
呵呵,刚接触到C#与xml,所以想请大虾帮忙写个过程,谢谢~~
RT

创建的大致的XML文档格式如下:

<root>
    <person   id= '1 '>
          <name> a </name>
          <height> 173CM </height>
    </person>
    <person   id= '2 '>
          <name> 5 </name>
          <height> 175CM </height>
    </person>
</root>

呵呵,多谢了~~~50分奉上~~~大虾笑纳~~~

------解决方案--------------------------------------------------------
XmlDocument dom = new XmlDocument(); XmlElement root= dom.CreateElement( "root "); dom.AppendChild(root); XmlElement person = dom.CreateElement( "person "); XmlAttribute at = dom.CreateAttribute( "id "); at.Value = "1 "; person.Attributes.Append(at); root.AppendChild(person); XmlElement el = dom.CreateElement( "name "); el.InnerText = "a "; person.AppendChild(el); el = dom.CreateElement( "height "); el.InnerText = "173cm "; person.AppendChild(el); Response.Write(dom.InnerXml);
  相关解决方案