System.Data.XmlTreeGen.SchemaTree C# (CSharp) Метод

SchemaTree() приватный Метод

private SchemaTree ( XmlDocument xd, DataTable dt ) : XmlElement
xd XmlDocument
dt DataTable
Результат XmlElement
        internal XmlElement SchemaTree(XmlDocument xd, DataTable dt)
        {
            _dsElement = xd.CreateElement(Keywords.XSD_PREFIX, Keywords.XSD_ELEMENT, Keywords.XSDNS);
            _constraintNames = new ArrayList();
            _ds = dt.DataSet;
            _dc = xd;

            _namespaces = new Hashtable();
            _prefixes = new Hashtable();

            if (_schFormat != SchemaFormat.Remoting)
            {
                _autogenerated = new Hashtable();
            }

            XmlElement rootSchema = xd.CreateElement(Keywords.XSD_PREFIX, Keywords.XSD_SCHEMA, Keywords.XSDNS);
            _sRoot = rootSchema;
            WriteSchemaRoot(xd, rootSchema, dt.Namespace);

            XmlElement dsCompositor = FillDataSetElement(xd, null, dt);

            _constraintSeparator = xd.CreateElement(Keywords.XSD_PREFIX, "SHOULDNOTBEHERE", Keywords.XSDNS);
            _dsElement.AppendChild(_constraintSeparator);


            if (_schFormat != SchemaFormat.Remoting)
            {
                if (_ds != null)
                {
                    _namespaces[_ds.Namespace] = rootSchema;
                    if (_ds.Namespace.Length == 0)
                    {
                        _prefixes[_ds.Namespace] = null;
                    }
                    else
                    {
                        // generate a prefix for the dataset schema itself.
                        rootSchema.SetAttribute(Keywords.XMLNS_MSTNS, _ds.Namespace);
                        _prefixes[_ds.Namespace] = "mstns";
                    }
                }
                else
                {
                    _namespaces[dt.Namespace] = rootSchema;
                    if (dt.Namespace.Length == 0)
                    {
                        _prefixes[dt.Namespace] = null;
                    }
                    else
                    {
                        // generate a prefix for the dataset schema itself.
                        rootSchema.SetAttribute(Keywords.XMLNS_MSTNS, dt.Namespace);
                        _prefixes[dt.Namespace] = "mstns";
                    }
                }
            }

            // Generate all the constraint names
            GenerateConstraintNames(dt, true);

            //
            // Output all top level elements, which will recursively invoke to other tables.
            //

            XmlElement el = HandleTable(dt, xd, rootSchema, false);
            rootSchema.AppendChild(el);

            _dsElement.RemoveChild(_constraintSeparator);
            rootSchema.AppendChild(_dsElement);

            return rootSchema;
        }

Same methods

XmlTreeGen::SchemaTree ( XmlDocument xd, XmlWriter xmlWriter, DataSet ds, DataTable dt, bool writeHierarchy ) : void