System.Data.DataSet.ReadXSDSchema C# (CSharp) Method

ReadXSDSchema() private method

private ReadXSDSchema ( XmlReader reader, bool denyResolving ) : void
reader XmlReader
denyResolving bool
return void
        internal void ReadXSDSchema(XmlReader reader, bool denyResolving)
        {
            XmlSchemaSet sSet = new XmlSchemaSet();

            int schemaFragmentCount = 1;
            //read from current schmema element
            if (reader.LocalName == Keywords.XSD_SCHEMA && reader.NamespaceURI == Keywords.XSDNS)
            {
                if (reader.HasAttributes)
                {
                    string attribValue = reader.GetAttribute(Keywords.MSD_FRAGMENTCOUNT, Keywords.MSDNS); // this must not move the position
                    if (!string.IsNullOrEmpty(attribValue))
                    {
                        schemaFragmentCount = int.Parse(attribValue, null);
                    }
                }
            }

            while (reader.LocalName == Keywords.XSD_SCHEMA && reader.NamespaceURI == Keywords.XSDNS)
            {
                XmlSchema s = XmlSchema.Read(reader, null);
                sSet.Add(s);
                //read the end tag
                ReadEndElement(reader);

                if (--schemaFragmentCount > 0)
                {
                    MoveToElement(reader);
                }
                while (reader.NodeType == XmlNodeType.Whitespace)
                {
                    reader.Skip();
                }
            }
            sSet.Compile();
            XSDSchema schema = new XSDSchema();
            schema.LoadSchema(sSet, this);
        }