diff --git a/xmltest/.vscode/launch.json b/xmltest/.vscode/launch.json new file mode 100644 index 0000000..f83c818 --- /dev/null +++ b/xmltest/.vscode/launch.json @@ -0,0 +1,25 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": ".NET Core Launch (console)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + "program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/xmltest.dll", + "args": [], + "cwd": "${workspaceFolder}", + "console": "internalConsole", + "stopAtEntry": false + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach", + "processId": "${command:pickProcess}" + } + ] +} \ No newline at end of file diff --git a/xmltest/.vscode/tasks.json b/xmltest/.vscode/tasks.json new file mode 100644 index 0000000..99e21ea --- /dev/null +++ b/xmltest/.vscode/tasks.json @@ -0,0 +1,42 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/xmltest.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/xmltest.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "${workspaceFolder}/xmltest.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/xmltest/Program.cs b/xmltest/Program.cs new file mode 100644 index 0000000..eb289e5 --- /dev/null +++ b/xmltest/Program.cs @@ -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); + } + } + } + } +} \ No newline at end of file diff --git a/xmltest/xmltest.csproj b/xmltest/xmltest.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/xmltest/xmltest.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + +