-
Notifications
You must be signed in to change notification settings - Fork 0
ReaderNode
涼月蒼菜 edited this page Sep 24, 2020
·
3 revisions
Get the node as SavannahXmlNode.
<?xml version="1.0" encoding="UTF-8"?>
<ServerSettings>
<property name="ServerName" value="My Game Host">
Whatever you want the name of the server to be.
</property>
<property name="ServerName2" value="My Game Host">
Whatever you want the name of the server to be.
</property>
<property name="ServerDescription" value="A 7 Days to Die server">
Whatever you want the server description to be, will be shown in the server browser.
</property>
<property name="ServerWebsiteURL" value="">
Website URL for the server, will be shown in the serverbrowser as a clickable link.
</property>
</ServerSettings>
var root = reader.GetAllNodes();
Console.WriteLine(root.TagName);
Console.WriteLine(root.ChildNodes.FirstOrDefault()?.TagName);
> ServerSettings
> property
Get some nodes as IEnumerable<SavannahXmlNode>.
var nodes = reader.GetNodes("/ServerSettings/property[contains(@name, 'ServerName')]");
foreach (var node in nodes)
Console.WriteLine(node.Attributes.FirstOrDefault()?.Value);
ServerName
ServerName2
var node = reader.GetNode("/ServerSettings/property[contains(@name, 'ServerName')]");
Console.WriteLine(node.Attributes.FirstOrDefault()?.Value);
ServerName