Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
PrettyXml.cs
1
using
System.Xml;
2
using
System.Threading.Tasks;
3
using
Waher.Content.Xml
;
4
using
Waher.Script.Abstraction.Elements
;
5
using
Waher.Script.Model
;
6
using
Waher.Script.Objects
;
7
8
namespace
Waher.Script.Xml.Functions
9
{
13
public
class
PrettyXml
:
FunctionOneScalarVariable
14
{
22
public
PrettyXml
(
ScriptNode
Argument
,
int
Start
,
int
Length
,
Expression
Expression
)
23
: base(
Argument
,
Start
,
Length
,
Expression
)
24
{
25
}
26
30
public
override
string
FunctionName
=> nameof(
PrettyXml
);
31
38
public
override
IElement
EvaluateScalar
(
string
Argument
,
Variables
Variables
)
39
{
40
return
new
StringValue
(
XML
.
PrettyXml
(
Argument
));
41
}
42
49
public
override
IElement
EvaluateScalar
(
IElement
Argument
,
Variables
Variables
)
50
{
51
object
Obj =
Argument
.AssociatedObjectValue;
52
53
if
(Obj is
null
)
54
return
Argument
;
55
else
if
(Obj is
string
s)
56
return
new
StringValue
(
XML
.
PrettyXml
(s));
57
else
if
(Obj is XmlNode N)
58
return
new
StringValue
(
XML
.
PrettyXml
(N));
59
else
60
return
base.EvaluateScalar(
Argument
,
Variables
);
61
}
62
69
public
override
Task<IElement>
EvaluateScalarAsync
(
IElement
Argument
,
Variables
Variables
)
70
{
71
return
Task.FromResult(this.
EvaluateScalar
(Argument,
Variables
));
72
}
73
}
74
}
Waher.Content.Xml.XML
Helps with common XML-related tasks.
Definition:
XML.cs:19
Waher.Content.Xml.XML.PrettyXml
static string PrettyXml(string Xml)
Reformats XML to make it easier to read.
Definition:
XML.cs:1548
Waher.Script.Expression
Class managing a script expression.
Definition:
Expression.cs:39
Waher.Script.Model.FunctionOneScalarVariable
Base class for funcions of one scalar variable.
Definition:
FunctionOneScalarVariable.cs:15
Waher.Script.Model.FunctionOneVariable.Argument
ScriptNode Argument
Function argument.
Definition:
FunctionOneVariable.cs:33
Waher.Script.Model.ScriptNode
Base class for all nodes in a parsed script tree.
Definition:
ScriptNode.cs:69
Waher.Script.Model.ScriptNode.Length
int Length
Length of expression covered by node.
Definition:
ScriptNode.cs:101
Waher.Script.Model.ScriptNode.Start
int Start
Start position in script expression.
Definition:
ScriptNode.cs:92
Waher.Script.Objects.StringValue
String value.
Definition:
StringValue.cs:13
Waher.Script.Variables
Collection of variables.
Definition:
Variables.cs:25
Waher.Script.Xml.Functions.PrettyXml
PrettyXml(s)
Definition:
PrettyXml.cs:14
Waher.Script.Xml.Functions.PrettyXml.EvaluateScalarAsync
override Task< IElement > EvaluateScalarAsync(IElement Argument, Variables Variables)
Evaluates the function on a scalar argument.
Definition:
PrettyXml.cs:69
Waher.Script.Xml.Functions.PrettyXml.EvaluateScalar
override IElement EvaluateScalar(string Argument, Variables Variables)
Evaluates the function on a scalar argument.
Definition:
PrettyXml.cs:38
Waher.Script.Xml.Functions.PrettyXml.EvaluateScalar
override IElement EvaluateScalar(IElement Argument, Variables Variables)
Evaluates the function on a scalar argument.
Definition:
PrettyXml.cs:49
Waher.Script.Xml.Functions.PrettyXml.PrettyXml
PrettyXml(ScriptNode Argument, int Start, int Length, Expression Expression)
PrettyXml(x)
Definition:
PrettyXml.cs:22
Waher.Script.Xml.Functions.PrettyXml.FunctionName
override string FunctionName
Name of the function
Definition:
PrettyXml.cs:30
Waher.Script.Abstraction.Elements.IElement
Basic interface for all types of elements.
Definition:
IElement.cs:20
Waher.Content.Xml
Definition:
XmlCodec.cs:11
Waher.Script.Abstraction.Elements
Definition:
AbelianGroupElement.cs:5
Waher.Script.Model
Definition:
BinaryBooleanOperator.cs:8
Waher.Script.Objects
Definition:
BooleanValue.cs:7
Waher.Script.Xml.Functions
Definition:
GetAttribute.cs:9
IoTGateway
Script
Waher.Script.Xml
Functions
PrettyXml.cs
Generated by
1.9.5