System.Xml.XmlReader.ReadToNextSibling C# (CSharp) Method

ReadToNextSibling() public method

public ReadToNextSibling ( string name ) : bool
name string
return bool
        public virtual bool ReadToNextSibling(string name)
        {
            if (name == null || name.Length == 0)
            {
                throw XmlConvert.CreateInvalidNameArgumentException(name, nameof(name));
            }

            // atomize name
            name = NameTable.Add(name);

            // find the next sibling
            XmlNodeType nt;
            do
            {
                if (!SkipSubtree())
                {
                    break;
                }
                nt = NodeType;
                if (nt == XmlNodeType.Element && Ref.Equal(name, Name))
                {
                    return true;
                }
            } while (nt != XmlNodeType.EndElement && !EOF);
            return false;
        }

Same methods

XmlReader::ReadToNextSibling ( string localName, string namespaceURI ) : bool

Usage Example

Example #1
0
        private void ExtractDefinitions(XmlReader reader, ResultFile trx)
        {
            if (reader.ReadToFollowing("TestDefinitions"))
            {
                if (reader.ReadToDescendant("UnitTest"))
                {
                    do
                    {
                        var testId = Guid.Parse(reader.GetAttribute("id"));
                        var tempResult = trx.Results.First(result => result.TestId == testId);
                        tempResult.Storage = reader.GetAttribute("storage");

                        if (reader.ReadToFollowing("TestMethod"))
                        {
                            tempResult.CodeBase = reader.GetAttribute("codeBase");
                            tempResult.AdapterTypeName = reader.GetAttribute("adapterTypeName");
                            tempResult.ClassName = reader.GetAttribute("className");
                        }

                        reader.ReadToNextSibling("UnitTest");
                    }
                    while (reader.ReadToNextSibling("UnitTest"));
                }
            }
        }
All Usage Examples Of System.Xml.XmlReader::ReadToNextSibling