C# PowerShell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Razor XML Demo

Tired of creating XML files using XmlWriter, XmlDocument or XDocument. After looking at a few thousand lines of declarative statements to build out a rather complex XML file for a client, I thought to myself, "There has got to be a better way."

Hmmm.... Razor exists. It's just angle brackets. I wonder...

@* Generator : Template TypeVisibility : Internal *@
@using System.Collections.Generic
@using RazorXmlDemo;

@functions {
public IEnumerable<XmlModel> Model { get; set; }
<?xml version="1.0" encoding="UTF-8"?>
  @foreach (var m in Model)

Be sure to include a Generator statement as the first line of code.

This project uses RazorGenerator.Templating to make the magic happen.