本文整理汇总了C#中System.Xml.XPath.XPathNodeIterator.MoveNext方法的典型用法代码示例。如果您正苦于以下问题:C# XPathNodeIterator.MoveNext方法的具体用法?C# XPathNodeIterator.MoveNext怎么用?C# XPathNodeIterator.MoveNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XPath.XPathNodeIterator
的用法示例。
在下文中一共展示了XPathNodeIterator.MoveNext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: max
/// <summary>
/// Implements the following function
/// number max(node-set)
/// </summary>
/// <param name="iterator"></param>
/// <returns></returns>
public double max(XPathNodeIterator iterator)
{
double max, t;
if (iterator.Count == 0)
{
return Double.NaN;
}
try
{
iterator.MoveNext();
max = XmlConvert.ToDouble(iterator.Current.Value);
while (iterator.MoveNext())
{
t = XmlConvert.ToDouble(iterator.Current.Value);
max = (t > max) ? t : max;
}
}
catch
{
return Double.NaN;
}
return max;
}
示例2: min
/// <summary>
/// Implements the following function
/// number min(node-set)
/// </summary>
/// <param name="iterator"></param>
/// <returns></returns>
public double min(XPathNodeIterator iterator)
{
double min, t;
if (iterator.Count == 0)
{
return Double.NaN;
}
try
{
iterator.MoveNext();
min = XmlConvert.ToDouble(iterator.Current.Value);
while (iterator.MoveNext())
{
t = XmlConvert.ToDouble(iterator.Current.Value);
min = (t < min) ? t : min;
}
}
catch
{
return Double.NaN;
}
return min;
}
示例3: min
/// <summary>
/// Implements the following function
/// string date2:min(node-set)
/// See http://www.xmland.net/exslt/doc/GDNDatesAndTimes-min.xml
/// </summary>
/// <remarks>THIS FUNCTION IS NOT PART OF EXSLT!!!</remarks>
public string min(XPathNodeIterator iterator)
{
TimeSpan min, t;
if (iterator.Count == 0)
{
return "";
}
try
{
iterator.MoveNext();
min = XmlConvert.ToTimeSpan(iterator.Current.Value);
while (iterator.MoveNext())
{
t = XmlConvert.ToTimeSpan(iterator.Current.Value);
min = (t < min) ? t : min;
}
}
catch (FormatException)
{
return "";
}
return XmlConvert.ToString(min);
}
示例4: EditCand_Load
private void EditCand_Load(object sender, EventArgs e)
{
doc = new XPathDocument(FILE_NAME);
nav = doc.CreateNavigator();
// Compile a standard XPath expression
expr = nav.Compile("/config/voto/@puesto");
iterator = nav.Select(expr);
// Iterate on the node set
comboBox1.Items.Clear();
try
{
while (iterator.MoveNext())
{
XPathNavigator nav2 = iterator.Current.Clone();
comboBox1.Items.Add(nav2.Value);
comboBox1.SelectedIndex = 0;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
//save old title
oldTitle = comboBox1.Text;
}
示例5: CoreFunctionNodeSetPosition
public void CoreFunctionNodeSetPosition ()
{
expression = navigator.Compile("position()");
iterator = navigator.Select("/foo");
AssertEquals ("0", navigator.Evaluate ("position()").ToString ());
AssertEquals ("0", navigator.Evaluate (expression, null).ToString ());
AssertEquals ("0", navigator.Evaluate (expression, iterator).ToString ());
iterator = navigator.Select("/foo/*");
AssertEquals ("0", navigator.Evaluate (expression, iterator).ToString ());
iterator.MoveNext();
AssertEquals ("1", navigator.Evaluate (expression, iterator).ToString ());
iterator.MoveNext ();
AssertEquals ("2", navigator.Evaluate (expression, iterator).ToString ());
iterator.MoveNext ();
AssertEquals ("3", navigator.Evaluate (expression, iterator).ToString ());
}
示例6: FilterNodes
public static XPathNodeIterator FilterNodes(XPathNodeIterator nodeset, string xpath)
{
try
{
while (nodeset.MoveNext())
{
var nav = nodeset.Current;
var manager = new XmlNamespaceManager(nav.NameTable);
nav.MoveToFollowing(XPathNodeType.Element);
foreach (var ns in nav.GetNamespacesInScope(XmlNamespaceScope.All))
{
manager.AddNamespace(ns.Key, ns.Value);
}
var result = nav.Evaluate(xpath, manager);
if (result is XPathNodeIterator) {
return (XPathNodeIterator)result;
} else {
XmlDocument doc = new XmlDocument();
doc.LoadXml("<result expression=\"" + xpath + "\">" + result.ToString() + "</result>");
return (XPathNodeIterator)doc.DocumentElement.CreateNavigator().Evaluate("/result");
}
}
}
catch (Exception ex)
{
return ex.ToXPathNodeIterator();
}
return nodeset;
}
示例7: avg
/// <summary>
/// Implements the following function
/// number avg(node-set)
/// </summary>
/// <param name="iterator"></param>
/// <returns>The average of all the value of all the nodes in the
/// node set</returns>
/// <remarks>THIS FUNCTION IS NOT PART OF EXSLT!!!</remarks>
public double avg(XPathNodeIterator iterator)
{
double sum = 0;
int count = iterator.Count;
if (count == 0)
{
return Double.NaN;
}
try
{
while (iterator.MoveNext())
{
sum += XmlConvert.ToDouble(iterator.Current.Value);
}
}
catch (FormatException)
{
return Double.NaN;
}
return sum / count;
}
示例8: difference2
/// <summary>
/// Implements an optimized algorithm for the following function
/// node-set difference(node-set, node-set)
/// Uses document identification and binary search,
/// based on the fact that a node-set is always in document order.
/// </summary>
/// <param name="nodeset1">An input nodeset</param>
/// <param name="nodeset2">Another input nodeset</param>
/// <returns>The those nodes that are in the node set
/// passed as the first argument that are not in the node set
/// passed as the second argument.</returns>
/// <author>Dimitre Novatchev</author>
private XPathNodeIterator difference2(XPathNodeIterator nodeset1, XPathNodeIterator nodeset2)
{
List<Pair> arDocs = new List<Pair>();
List<XPathNavigator> arNodes2 = new List<XPathNavigator>(nodeset2.Count);
while (nodeset2.MoveNext())
{
arNodes2.Add(nodeset2.Current.Clone());
}
auxEXSLT.findDocs(arNodes2, arDocs);
XPathNavigatorIterator enlResult = new XPathNavigatorIterator();
while (nodeset1.MoveNext())
{
XPathNavigator currNode = nodeset1.Current;
if (!auxEXSLT.findNode(arNodes2, arDocs, currNode))
enlResult.Add(currNode.Clone());
}
enlResult.Reset();
return enlResult;
}
示例9: difference2
/// <summary>
/// Implements an optimized algorithm for the following function
/// node-set difference(node-set, node-set)
/// Uses document identification and binary search,
/// based on the fact that a node-set is always in document order.
/// </summary>
/// <param name="nodeset1">An input nodeset</param>
/// <param name="nodeset2">Another input nodeset</param>
/// <returns>The those nodes that are in the node set
/// passed as the first argument that are not in the node set
/// passed as the second argument.</returns>
/// <author>Dimitre Novatchev</author>
private XPathNodeIterator difference2(XPathNodeIterator nodeset1, XPathNodeIterator nodeset2)
{
ArrayList arDocs = new ArrayList();
ArrayList arNodes2 = new ArrayList(nodeset2.Count);
while(nodeset2.MoveNext())
{
arNodes2.Add(nodeset2.Current.Clone());
}
auxEXSLT.findDocs(arNodes2, arDocs);
ExsltNodeList enlResult = new ExsltNodeList();
while(nodeset1.MoveNext())
{
XPathNavigator currNode = nodeset1.Current;
if(!auxEXSLT.findNode(arNodes2, arDocs, currNode) )
enlResult.Add(currNode.Clone());
}
return ExsltCommon.ExsltNodeListToXPathNodeIterator(enlResult);
}
示例10: DebuggerOptions
internal DebuggerOptions(XPathNodeIterator iter)
{
while (iter.MoveNext ()) {
switch (iter.Current.Name) {
case "File":
file = iter.Current.Value;
break;
case "InferiorArgs":
append_array (ref inferior_args, iter.Current.Value);
break;
case "JitArguments":
append_array (ref jit_arguments, iter.Current.Value);
break;
case "WorkingDirectory":
WorkingDirectory = iter.Current.Value;
break;
case "MonoPrefix":
MonoPrefix = iter.Current.Value;
break;
case "MonoPath":
MonoPath = iter.Current.Value;
break;
default:
throw new InternalError ();
}
}
if (inferior_args == null)
inferior_args = new string [0];
}
示例11: CreateLimitationForm
public CreateLimitationForm(string strXPathRoot, string strName, XPathNodeIterator xpIterator, bool bAttribute,
System.Collections.Specialized.StringCollection astrPreviousConstraints)
{
InitializeComponent();
m_astrPreviousConstraints = astrPreviousConstraints;
this.textBoxXPath.Text = strXPathRoot;
this.textBoxName.Text = strName;
while ((xpIterator != null) && xpIterator.MoveNext())
{
string strValue = xpIterator.Current.Value;
if (!m_strIteratorValues.Contains(strValue))
m_strIteratorValues.Add(strValue);
}
if (bAttribute)
radioButtonSpecificValue.Checked = true;
else
radioButtonPresenceOnly.Checked = true;
// only enabled on subsequent executions
radioButtonPreviousConstraint.Enabled = (m_astrPreviousConstraints.Count > 0);
helpProvider.SetHelpString(checkedListBox, Properties.Resources.checkedListBoxHelp);
helpProvider.SetHelpString(flowLayoutPanelConstraintType, Properties.Resources.flowLayoutPanelConstraintTypeHelp);
}
示例12: ProcessAssemblies
void ProcessAssemblies (LinkContext context, XPathNodeIterator iterator)
{
while (iterator.MoveNext ()) {
AssemblyDefinition assembly = GetAssembly (context, GetFullName (iterator.Current));
ProcessTypes (assembly, iterator.Current.SelectChildren ("type", _ns));
ProcessNamespaces (assembly, iterator.Current.SelectChildren ("namespace", _ns));
}
}
示例13: XPathArrayIterator
public XPathArrayIterator(XPathNodeIterator nodeIterator)
{
this.list = new ArrayList();
while (nodeIterator.MoveNext())
{
this.list.Add(nodeIterator.Current.Clone());
}
}
示例14: ConvertIteratorToArray
static XPathNavigator[] ConvertIteratorToArray(XPathNodeIterator iterator) {
XPathNavigator[] result = new XPathNavigator[iterator.Count];
for (int i = 0; i < result.Length; i++) {
iterator.MoveNext();
result[i] = iterator.Current.Clone();
}
return (result);
}
示例15: ElongRegexEpression
public ElongRegexEpression()
{
XPathNavigator navigator = RegexOperation.GetXPathNavigatorByPath(CommonOperation.GetConfigValueByKey(Constant.CCTRIPPATH));
nodeIterator = navigator.Select(Constant.CREGEXEXPRESSION);
nodeIterator.MoveNext();
}