-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathXmlOutput.cs
More file actions
35 lines (33 loc) · 908 Bytes
/
XmlOutput.cs
File metadata and controls
35 lines (33 loc) · 908 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
29
30
31
32
33
34
35
using System;
using System.Reflection;
using System.Xml;
using Waher.Runtime.Inventory;
using Waher.Script.Output;
namespace Waher.Script.Xml
{
/// <summary>
/// Formats an XmlDocument as an expression.
/// </summary>
public class XmlOutput : ICustomStringOutput
{
/// <summary>
/// If the interface understands objects such as <paramref name="Object"/>.
/// </summary>
/// <param name="Object">Object</param>
/// <returns>How well objects of this type are supported.</returns>
public Grade Supports(Type Object)
{
return typeof(XmlNode).IsAssignableFrom(Object.GetTypeInfo()) ? Grade.Ok : Grade.NotAtAll;
}
/// <summary>
/// Gets a string representing a value.
/// </summary>
/// <param name="Value">Value</param>
/// <returns>Expression string.</returns>
public string GetString(object Value)
{
XmlNode Node = (XmlNode)Value;
return Node.OuterXml;
}
}
}