source/SchemaValidation/source/SchemaValidation/Extensions/SchemaValidatingReaderExtensions.cs
/// <summary>
/// Advances the reader to the next node, skipping EndElements, and returns true.
/// If the next node is a EndElement with the specified name, stops and returns false.
/// </summary>
/// <param name="reader">The reader to advance.</param>
/// <param name="nodeName">The name of the EndElement to stop advancing at.</param>
/// <returns>Returns true until the specified EndElement is found; false otherwise.</returns>
Advances the reader to the next node, skipping EndElements, and returns true.
If the next node is a EndElement with the specified name, stops and returns false.
Advances the reader to the next node skipping EndElements and returns true . If the next node is a EndElement with the specified name stops and returns false .
public static async Task<bool> AdvanceUntilClosedAsync(this ISchemaValidatingReader reader, string nodeName)
        {
            while (await reader.AdvanceAsync().ConfigureAwait(false))
            {
                if (reader.CurrentNodeType == NodeType.EndElement)
                {
                    if (reader.CurrentNodeName.Equals(nodeName, StringComparison.Ordinal))
                    {
                        break;
                    }
                    if (reader.CanReadValue)
                    {
                        return true;
                    }
                }
                else
                {
                    return true;
                }
            }
            return false;
        }
public static async Task < bool > AdvanceUntilClosedAsync ( this ISchemaValidatingReader reader , string nodeName ) { while ( await reader . AdvanceAsync ( ) . ConfigureAwait ( false ) ) { if ( reader . CurrentNodeType == NodeType . EndElement ) { if ( reader . CurrentNodeName . Equals ( nodeName , StringComparison . Ordinal ) ) { break ; } if ( reader . CanReadValue ) { return true ; } } else { return true ; } } return false ; }
Advances the reader to the next node, skipping EndElements, and returns true.
Advances the reader to the next node skipping EndElements and returns true .
Returns true until the specified EndElement is found; false otherwise.
Returns true until the specified EndElement is found ; false otherwise .
ISchemaValidatingReader
this
nodeName
string
The name of the EndElement to stop advancing at.
The name of the EndElement to stop advancing at .
reader
The reader to advance.
The reader to advance .