-
Notifications
You must be signed in to change notification settings - Fork 2
/
DocXmlUtil.cs
35 lines (30 loc) · 989 Bytes
/
DocXmlUtil.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//
// DocGen Source
//
// Copyright (c) 2019 ADAM MAJCHEREK ALL RIGHTS RESERVED
//
using System;
using System.Xml;
namespace DocGen
{
internal static class DocXmlUtil
{
internal const string XmlName = "name";
internal const string XmlSummary = "summary";
internal const string XmlNotAvailable = @"N\A";
internal static bool CollectSummaryFromNode(XmlNodeList nodes, string targetName, out string summary)
{
foreach (XmlNode node in nodes)
{
var nodeName = node.Attributes?[XmlName]?.Value ?? throw new NullReferenceException();
var typeName = nodeName.Remove(0, 2);
if (typeName != targetName) continue;
summary = node.SelectSingleNode(XmlSummary)?.InnerText;
summary = DocSyntax.RemoveSpaces(summary);
return true;
}
summary = XmlNotAvailable;
return false;
}
}
}