问题如题,
不知道是哪个地方出了问题??后台向XML中添加新结点的cs代码如下: XmlDocument xmlDoc=new XmlDocument(); 
xmlDoc.Load(Server.MapPath("")+@"\XMLFile1.xml"); 
XmlNode root=xmlDoc.SelectSingleNode("NewDataSet");
XmlElement xeUserNote=xmlDoc.CreateElement("UserNote");
                            XmlElement xeUserName=xmlDoc.CreateElement("UserName");
xeUserName.InnerText=userName.Text;
xeUserNote.AppendChild(xeUserName);
XmlElement xeUserEmail=xmlDoc.CreateElement("UserEmail");
xeUserEmail.InnerText=userEmail.Text;
xeUserNote.AppendChild(xeUserEmail);
XmlElement xeNoteContent=xmlDoc.CreateElement("NoteContent");
xeNoteContent.InnerText=userNote.Value;
               (运行到下面这句代码时出错,提示未将对象引用到对象的实例)                   xeUserNote.AppendChild(xeNoteContent); root.AppendChild(xeUserNote);
xmlDoc.Save(Server.MapPath("")+@"\XMLFile1.xml");
------------------------------------------aspx中添加XML控件的代码如下:<asp:Xml ID="xmlReadNote" Runat="server" DocumentSource="XMLFile1.xml" TransformSource="XSLTFile1.xsl" />
-----------------------------------------
xml文件如下:<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet href="XSLTFile1.xsl" type="text/xsl" ?>
<NewDataSet xmlns="http://tempuri.org/XMLFile1.xsd" xmlId="1">
<UserNote noteId="1">
<UserName>rapboy</UserName>
<UserEmail>[email protected]</UserEmail>
<NoteContent>这里是评论的具体内容~</NoteContent>
</UserNote>
</NewDataSet>
-----------------------------------------
xsd文件如下:<?xml version="1.0"?>
<xs:schema id="shema_userNote" targetNamespace="http://tempuri.org/XMLFile1.xsd" xmlns:mstns="http://tempuri.org/XMLFile1.xsd" xmlns="http://tempuri.org/XMLFile1.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified">
  <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:Locale="zh-CN" msdata:EnforceConstraints="False">
    <xs:complexType>
    <xs:attribute name="xmlId" use="optional" type="integer"></xs:attribute>
      <xs:choice maxOccurs="unbounded">
        <xs:element name="UserNote">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="UserName" type="xs:string" minOccurs="0" />
              <xs:element name="UserEmail" type="xs:string" minOccurs="0" />
              <xs:element name="NoteContent" type="xs:string" minOccurs="0" />
            </xs:sequence>
            <xs:attribute name="noteId" use="optional" type="integer"/>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>
------------------------------------------
xsl文件如下:<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="NewDataSet/UserNote">
<table cellSpacing="0" cellPadding="0" width="500" align="center" border="0">
<tbody>
<tr height="22">
<td align="center" background="images/top2.gif"></td>
</tr>
</tbody>
</table>
<table class="table1" cellSpacing="3" cellPadding="0" width="500" align="center" border="0">
<tbody>
<tr>
<td>用户名:</td>
<td align="center"><xsl:value-of select="UserName"/></td>
</tr>
<tr>
<td>E-mail:</td>
<td align="center"><xsl:value-of select="UserEmail"/></td>
</tr>
</tbody>
</table>
<table class="table2" cellSpacing="0" cellPadding="0" align="center" border="0" width="500">
<tbody>
<tr>
                      <td align="center" colSpan="2"><xsl:value-of select="NoteContent"/></td>
</tr>
</tbody>
</table>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
-------------------------------------------请各位高手帮帮忙,谢谢各位了,初学XML~~