-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#20 - Added ability to whitelist base templates
- Loading branch information
Showing
5 changed files
with
60 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using System.Xml; | ||
|
||
namespace Leprechaun.Extensions | ||
{ | ||
public static class XmlNodeExtensions | ||
{ | ||
public static string GetExpectedAttribute(this XmlNode node, string attributeName) | ||
{ | ||
if(node == null) | ||
throw new ArgumentNullException(nameof(node)); | ||
|
||
// ReSharper disable once PossibleNullReferenceException | ||
XmlAttribute attribute = node.Attributes[attributeName]; | ||
|
||
if (attribute == null) throw new InvalidOperationException($"Missing expected '{attributeName}' attribute on '{node.Name}' node while processing: {node.OuterXml}"); | ||
|
||
return attribute.Value; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters