// Callback for HarvestExtensions, called for each individual extension entry static void harvestExtension(IElementNavigator nav, IDictionary <string, object> properties, string url) { if (StringComparer.Ordinal.Equals(FmmExtensionUrl, url) && nav.MoveToNext("valueInteger")) { properties[MaturityLevelKey] = nav.Value; } }
public bool MoveToNext(string nameFilter = null) { bool exists = _navigator.MoveToNext(nameFilter); if (exists) { _index++; } return(exists); }
public bool MoveToNext() { bool exists = _navigator.MoveToNext(); if (exists) { _index++; } return(exists); }
public static void Render(IElementNavigator navigator, int nest = 0) { do { string indent = new string(' ', nest * 4); Debug.WriteLine($"{indent}" + ToString(navigator)); var child = navigator.Clone(); if (child.MoveToFirstChild()) { Render(child, nest + 1); } }while (navigator.MoveToNext()); }
/// <summary>Harvest extension values into a property bag.</summary> /// <param name="nav">An <see cref="IElementNavigator"/> instance.</param> /// <param name="properties">A property bag to store harvested summary information.</param> /// <param name="extensionValueHarvester">Callback function called for each individual extension entry.</param> public static void HarvestExtensions(this IElementNavigator nav, IDictionary <string, object> properties, Action <IElementNavigator, IDictionary <string, object>, string> extensionValueHarvester) { const string extension = "extension"; if (nav.Find(extension)) { do { var childNav = nav.Clone(); if (childNav.MoveToFirstChild("url")) { if (childNav.Value is string url) { extensionValueHarvester(childNav, properties, url); } } // [WMR 20171219] BUG: MoveToNext advances to extension.url (child attribute) instead of the next extension element } while (nav.MoveToNext(extension)); } }
/// <summary>Harvest an array of child element values into a property bag.</summary> /// <param name="nav">An <see cref="IElementNavigator"/> instance.</param> /// <param name="properties">A property bag to store harvested summary information.</param> /// <param name="key">A property key.</param> /// <param name="element">An element name.</param> /// <param name="childElement">A child element name.</param> public static bool HarvestValues(this IElementNavigator nav, IDictionary <string, object> properties, string key, string element, string childElement) { if (nav.Find(element)) { var values = new List <string>(); do { var childNav = nav.Clone(); if (childNav.MoveToFirstChild(childElement)) { HarvestValue(childNav, values); } } while (nav.MoveToNext(element)); if (values.Count > 0) { properties[key] = values.ToArray(); return(true); } } return(false); }
public bool MoveToNext(string nameFilter = null) => _current.MoveToNext(nameFilter);
public bool MoveToNext(string nameFilter = null) { _cache = new Cache(); return(_wrapped.MoveToNext(nameFilter)); }
/// <summary> /// Try to position the navigator on the current or sibling element with the specified name. /// If the current element name matches, then maintain the current position. /// Otherwise, navigate to the next matching sibling element (if it exists). /// </summary> /// <param name="nav">An <see cref="IElementNavigator"/> instance.</param> /// <param name="element">An element name.</param> /// <returns><c>true</c> if, upon return, the navigator is positioned on a matching element, or <c>false</c> otherwise.</returns> public static bool Find(this IElementNavigator nav, string element) { return(nav.Name == element || nav.MoveToNext(element)); }