-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDecodeFunction.cs
More file actions
28 lines (27 loc) · 854 Bytes
/
DecodeFunction.cs
File metadata and controls
28 lines (27 loc) · 854 Bytes
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Figaro;
using Nancy.Helpers;
namespace Nancy.Demos.Figaro
{
public class DecodeFunction: XmlExternalFunction
{
/// <summary>
/// Take our 'About Me' section and decode the HTML so it displays properly.
/// </summary>
/// <param name="txn"></param>
/// <param name="mgr"></param>
/// <param name="args"></param>
/// <returns></returns>
public override XmlResults Execute(XmlTransaction txn, XmlManager mgr, XmlArguments args)
{
var ret = mgr.CreateXmlResults();
var about = args.GetArguments(0);
ret.Add(new XmlValue(HttpUtility.HtmlDecode(about.NextValue().AsString)));
return ret;
}
}
}