又有问题了。

DTWUJP 2007-11-23 04:50:34
<?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的书。谢谢大家了。
...全文
69 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
liuyun1987 2007-11-23
  • 打赏
  • 举报
回复
xmldocument doc = new xmldocument();
doc.load("sample.xml");
xmlnodelist nodes = doc.getelementsbytagname("name");
nodes[0].innertext = "newvalue";
doc.save("sample.xml");
symbol441 2007-11-23
  • 打赏
  • 举报
回复
参考一下


<?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....");


DTWUJP 2007-11-23
  • 打赏
  • 举报
回复
能给个代码吗?
cpio 2007-11-23
  • 打赏
  • 举报
回复

可以用SelectNodes方法把所有的这种节点找出来

然后修改值

110,536

社区成员

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

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

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