<?xml   version="1.0"   encoding="utf-8"?> 
<Report   xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition"   xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"> 
    <BottomMargin> 1cm </BottomMargin> 
    <RightMargin> 1cm </RightMargin> 
    <PageWidth> 25.2cm </PageWidth> 
    <rd:DrawGrid> true </rd:DrawGrid> 
    <InteractiveWidth> 21cm </InteractiveWidth> 
    <rd:GridSpacing> 0.25cm </rd:GridSpacing> 
    <rd:SnapToGrid> true </rd:SnapToGrid> 
    <Body> 
        <ColumnSpacing> 1cm </ColumnSpacing> 
        <ReportItems> 
            <Textbox   Name="TxtF14Value"> 
                <Left> 6.5cm </Left> 
                <Top> 6.5cm </Top> 
                <ZIndex> 49 </ZIndex> 
                <Width> 2.53968cm </Width> 
                <Style> 
                    <TextAlign> Right </TextAlign> 
                    <PaddingLeft> 2pt </PaddingLeft> 
                    <PaddingBottom> 2pt </PaddingBottom> 
                    <PaddingRight> 2pt </PaddingRight> 
                    <PaddingTop> 2pt </PaddingTop> 
                </Style> 
                <CanGrow> true </CanGrow> 
                <Height> 0.63492cm </Height> 
                <Value> 89.567 </Value> 
            </Textbox> 
            <Textbox   Name="TxtF14"> 
                <Left> 6.5cm </Left> 
                <Top> 5.75cm </Top> 
                <ZIndex> 48 </ZIndex> 
                <Width> 2.53968cm </Width> 
                <Style> 
                    <TextAlign> Center </TextAlign> 
                    <PaddingLeft> 2pt </PaddingLeft> 
                    <PaddingBottom> 2pt </PaddingBottom> 
                    <FontFamily> 宋体 </FontFamily> 
                    <VerticalAlign> Middle </VerticalAlign> 
                    <PaddingRight> 2pt </PaddingRight> 
                    <PaddingTop> 2pt </PaddingTop> 
                </Style> 
                <CanGrow> true </CanGrow> 
                <Height> 0.63492cm </Height> 
                <Value> 货   重(吨) </Value> 
            </Textbox> 

如何将//default:Body/default:ReportItems/default:Textbox中所有Textbox的Value全部写成空字符串.
有什么简单的写法吗?另现在对XML一窍不通,请各位推荐一本关于XML的书。谢谢大家了。

解决方案 »

  1.   


    可以用SelectNodes方法把所有的这种节点找出来然后修改值
      

  2.   

    参考一下
    <?xml version="1.0"?>
    <!-- A fragment of a book store inventory database -->
    <bookstore xmlns:bk="urn:samples">
      <book genre="novel" publicationdate="1997" bk:ISBN="1-861001-57-8">
        <title>Pride And Prejudice</title>
        <author>
          <first-name>Jane</first-name>
          <last-name>Austen</last-name>
        </author>
        <price>24.95</price>
      </book>
      <book genre="novel" publicationdate="1992" bk:ISBN="1-861002-30-1">
        <title>The Handmaid's Tale</title>
        <author>
          <first-name>Margaret</first-name>
          <last-name>Atwood</last-name>
        </author>
        <price>29.95</price>
      </book>
      <book genre="novel" publicationdate="1991" bk:ISBN="1-861001-57-6">
        <title>Emma</title>
        <author>
          <first-name>Jane</first-name>
          <last-name>Austen</last-name>
        </author>
        <price>19.95</price>
      </book>
      <book genre="novel" publicationdate="1982" bk:ISBN="1-861001-45-3">
        <title>Sense and Sensibility</title>
        <author>
          <first-name>Jane</first-name>
          <last-name>Austen</last-name>
        </author>
        <price>19.95</price>
      </book>
    </bookstore>XmlDocument doc = new XmlDocument();
        doc.Load("booksort.xml");    XmlNodeList nodeList;
        XmlNode root = doc.DocumentElement;    nodeList=root.SelectNodes("descendant::book[author/last-name='Austen']");
     
        //Change the price on the books.
        foreach (XmlNode book in nodeList)
        {
          book.LastChild.InnerText="15.95";
        }    Console.WriteLine("Display the modified XML document....");
      

  3.   

      xmldocument   doc   =   new   xmldocument();   
      doc.load("sample.xml");   
      xmlnodelist   nodes   =   doc.getelementsbytagname("name");   
      nodes[0].innertext   =   "newvalue";   
      doc.save("sample.xml");