Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
XmlScriptText.cs
1using System;
2using System.Collections.Generic;
3using System.Xml;
6
8{
13 {
14 private readonly string text;
15
24 : base(Start, Length, Expression)
25 {
26 this.text = Text;
27 }
28
32 public string Text => this.text;
33
40 internal override void Build(XmlDocument Document, XmlElement Parent, Variables Variables)
41 {
42 Parent.AppendChild(Document.CreateTextNode(this.text));
43 }
44
51 public override PatternMatchResult PatternMatch(XmlNode CheckAgainst, Dictionary<string, IElement> AlreadyFound)
52 {
53 if (CheckAgainst is XmlText ||
54 CheckAgainst is XmlCDataSection ||
55 CheckAgainst is XmlWhitespace ||
56 CheckAgainst is XmlSignificantWhitespace)
57 {
58 return CheckAgainst.InnerText.Trim() == this.text.Trim() ? PatternMatchResult.Match : PatternMatchResult.NoMatch;
59 }
60 else if (CheckAgainst is null)
61 return string.IsNullOrWhiteSpace(this.text) ? PatternMatchResult.Match : PatternMatchResult.NoMatch;
62 else
63 return PatternMatchResult.NoMatch;
64 }
65
71 public override bool IsApplicable(XmlNode CheckAgainst)
72 {
73 return (CheckAgainst is XmlText ||
74 CheckAgainst is XmlCDataSection ||
75 CheckAgainst is XmlWhitespace ||
76 CheckAgainst is XmlSignificantWhitespace);
77 }
78
79 }
80}
Class managing a script expression.
Definition: Expression.cs:39
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
ScriptNode Parent
Parent node.
Definition: ScriptNode.cs:126
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
Collection of variables.
Definition: Variables.cs:25
Base class for all XML Script leaf nodes in a parsed script tree.
XmlScriptText(string Text, int Start, int Length, Expression Expression)
XML Script text node.
string Text
Text represented by node.
override PatternMatchResult PatternMatch(XmlNode CheckAgainst, Dictionary< string, IElement > AlreadyFound)
Performs a pattern match operation.
override bool IsApplicable(XmlNode CheckAgainst)
If the node is applicable in pattern matching against CheckAgainst .
PatternMatchResult
Status result of a pattern matching operation.
Definition: ScriptNode.cs:17