1using System.Threading.Tasks;
53 object Obj =
Argument1.AssociatedObjectValue;
58 else if (Obj is XmlNode N)
63 int i, c = Result.Count;
76 for (i = 0; i < c; i++)
79 return Operators.Vectors.VectorDefinition.
Encapsulate(Items,
false,
this);
95 internal static XmlNodeList Evaluate(XmlNode N,
string XPath)
97 XmlNamespaceManager NamespaceManager;
101 if (N is XmlDocument Doc)
103 NamespaceManager =
new XmlNamespaceManager(Doc.NameTable);
104 Root = Doc.DocumentElement;
106 else if (N is XmlElement E && !(N.OwnerDocument is
null))
108 NamespaceManager =
new XmlNamespaceManager(N.OwnerDocument.NameTable);
113 NamespaceManager =
null;
117 if (NamespaceManager is
null)
118 Result = N.SelectNodes(XPath);
121 if (XPath.Contains(
"default:"))
125 if (
string.IsNullOrEmpty(Root.Prefix) && !
string.IsNullOrEmpty(Root.NamespaceURI))
131 foreach (XmlNode N2
in Root.ChildNodes)
133 if (N2 is XmlElement E)
141 if (
string.IsNullOrEmpty(Root.Prefix) && !
string.IsNullOrEmpty(Root.NamespaceURI))
147 foreach (XmlNode N2
in Root.ChildNodes)
149 if (N2 is XmlElement E)
156 NamespaceManager.AddNamespace(
"default",
Namespace);
159 Result = N.SelectNodes(XPath, NamespaceManager);
172 if (Node is XmlText Text)
174 else if (Node is XmlCDataSection CData)
176 else if (Node is XmlAttribute Attr)
180 if (Node.HasChildNodes && Node.FirstChild == Node.LastChild && Node.FirstChild is XmlText Text2)
A chunked list is a linked list of chunks of objects of type T .
bool HasFirstItem
If there is a first item in the collection
T RemoveFirst()
Removes the first item in the collection.
void Add(T Item)
Adds an item to the collection.
Script runtime exception.
Class managing a script expression.
static bool TryParse(string s, out double Value)
Tries to parse a double-precision floating-point value.
Base class for funcions of two scalar variables.
ScriptNode Argument2
Function argument 2.
ScriptNode Argument1
Function argument 1.
Base class for all nodes in a parsed script tree.
int Length
Length of expression covered by node.
override string ToString()
int Start
Start position in script expression.
static readonly ObjectValue Null
Null value.
Performs an XML slection using XPATH.
override string FunctionName
Name of the function
override bool UpgradeScalarsToSameSet
If scalars should be upgraded to the same set before evaluation.
static IElement ToElement(XmlNode Node)
Encapsulates an XML Node for use in script.
SelectXml(ScriptNode Xml, ScriptNode Name, int Start, int Length, Expression Expression)
Performs an XML slection using XPATH.
override IElement EvaluateScalar(IElement Argument1, IElement Argument2, Variables Variables)
Evaluates the function on two scalar arguments.
override string[] DefaultArgumentNames
Default Argument names
override Task< IElement > EvaluateScalarAsync(IElement Argument1, IElement Argument2, Variables Variables)
Evaluates the function on two scalar arguments.
Basic interface for all types of elements.
IElement Encapsulate(ChunkedList< IElement > Elements, ScriptNode Node)
Encapsulates a set of elements into a similar structure as that provided by the current element.