public void ModifyXML(string inputAsset, string test, string version)
{
File.Create(Constants.XMLDoc).Close();
XmlReader xReader = XmlReader.Create(xmlDoc);
while (!xReader.EOF)
{
if (xReader.Name != "Asset")
{
xReader.ReadToFollowing("Asset");
}
//If we have not reached the end of the file
if (!xReader.EOF)
{
XElement asset = (XElement)XElement.ReadFrom(xReader);
string branchName = (string)asset.Attribute("Name");
if (branchName == inputAsset)
{
}
}
}
}
大家好,所以我目前正在尝试在我的输入不为空时编辑 XML 文档。我的 XML 如下所示:
<Properties>
<Assets>
<Asset Name="" Version="">
<TestCase Name="" Version="" SubVersion="" />
<TestCase Name="" Version="" SubVersion="" />
<TestCase Name="" Version="" SubVersion="" />
<TestCase Name="" Version="" SubVersion="" />
</Asset>
<Asset Name="" Version="">
<TestCase Name="" Version="" SubVersion="" />
<TestCase Name="" Version="" SubVersion="" />
<TestCase Name="" Version="" SubVersion="" />
<TestCase Name="" Version="" SubVersion="" />
</Asset>
</Assets>
</Properties>
因此,可能的编辑类型就像当前测试用例的更改,例如版本值或子版本或名称,甚至向资产添加新测试用例或在需要时添加全新资产。我该怎么办?