예제 #1
0
        public void Reset()
        {
            currentAttribute = null;

            nameCursor.Reset();
            valueCursor.Reset();

            // Skip any whitespace that may be before the actual beginning of the tag.
            int currentIndex = SkipWhitespace(0);

            // Skip the tag name to the first attribute.
            currentIndex = tagString.IndexOfAny(XmlParserConstants.WhitespaceChars, currentIndex);

            // May the element does not have attributes. Just skip to the end.
            if (currentIndex == -1)
            {
                currentIndex = tagString.Length;
            }

            currentIndex = SkipWhitespace(currentIndex);

            nameCursor.StartPosition  = currentIndex;
            valueCursor.StartPosition = currentIndex;

            // At this point, if there are no attributes the cursors are positioned
            // at the end of the tag string --> Invalidate the enumerator.
            if (nameCursor.StartPosition == tagString.Length)
            {
                Invalidate();
            }
        }
예제 #2
0
 /// <summary>
 /// Resets the parser to the beginning of the xml string, so that the next
 /// invocation of "MoveToNextTag()" will position the parser on the first tag.
 /// </summary>
 public void Reset()
 {
     Validate(false);
     _cursor.Reset();
     Current = XmlParserTagInfo.NullTag;
     _path.Clear();
 }