add xmltest solution
this is temporary.
This commit is contained in:
parent
bf9814cfd0
commit
de633792a5
4 changed files with 115 additions and 0 deletions
40
xmltest/Program.cs
Normal file
40
xmltest/Program.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using System.Net;
|
||||
using System.Linq;
|
||||
|
||||
|
||||
namespace xmltest
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
string xmlcontent = null;
|
||||
|
||||
using (var wc = new WebClient())
|
||||
{
|
||||
xmlcontent = wc.DownloadString("https://www.nvidia.com/Download/API/lookupValueSearch.aspx?TypeID=3");
|
||||
}
|
||||
var xDoc = XDocument.Parse(xmlcontent);
|
||||
|
||||
var names = xDoc.Descendants("Name");
|
||||
foreach (var name in names)
|
||||
{
|
||||
string sname = name.Value.ToString();
|
||||
if (sname == "GeForce RTX 2080")
|
||||
{
|
||||
string value = name.Parent.Value;
|
||||
int index = value.IndexOf(sname);
|
||||
string cleanValue = (index < 0)
|
||||
? value
|
||||
: value.Remove(index, sname.Length);
|
||||
|
||||
Console.WriteLine(cleanValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in a new issue