我有一个这样的xml文件,
<?xml version="1.0" encoding="utf-8" ?>
<root>
<FeaturedProductCategories>
<FeaturedProductCategory>
<FeaturedProducts>
<FeaturedProduct>
<ContentSelector datavalue_idtype="content:smartform" datavalue_displayvalue="«Smart Form:49»">49</ContentSelector>
</FeaturedProduct>
</FeaturedProducts>
</FeaturedProductCategory>
</FeaturedProductCategories>
</root>
我想像下面这样修改它,
<?xml version="1.0" encoding="utf-8" ?>
<root>
<Title>HomePage</Title>
<FeaturedProductCategories>
<FeaturedProductCategory>
<FeaturedProducts>
<FeaturedProduct>
<Products>
<Product>
<ProductTitle>Product</ProductTitle>
<ProductDate>03-08-2012 11:57:25</ProductDate>
<ProductImage>
<img src="ex1.jpg" />
</ProductImage>
<ProductThumbnailImage>
<img src="ex2.jpg" />
</ProductThumbnailImage>
<ProductCaption>Product Caption</ProductCaption>
<ProductImage>
<img src="ex3.jpg" />
</ProductImage>
<ProductThumbnailImage>
<img src="ex4.jpg" />
</ProductThumbnailImage>
<ProductCaption>Product Caption</ProductCaption>
</Product>
</Products>
</FeaturedProduct>
</FeaturedProducts>
</FeaturedProductCategory>
</FeaturedProductCategories>
</root>
所有新节点和值都将通过 C# 函数添加。现在让我们假设这些新值是静态值。
节点“FeaturedProduct”也不仅仅是一个。该名称中有很多节点。我想修改所有“FeaturedProduct”节点。