CreateReader() static private method

static private CreateReader ( XmlReader xr ) : XmlReader
xr XmlReader
return XmlReader
        internal void LoadDiffGram(DataSet ds, XmlReader dataTextReader)
        {
            XmlReader ssync = DataTextReader.CreateReader(dataTextReader);

            this.dataSet = ds;
            while ((ssync.LocalName == "before") && (ssync.NamespaceURI == "urn:schemas-microsoft-com:xml-diffgram-v1"))
            {
                this.ProcessDiffs(ds, ssync);
                ssync.Read();
            }
            while ((ssync.LocalName == "errors") && (ssync.NamespaceURI == "urn:schemas-microsoft-com:xml-diffgram-v1"))
            {
                this.ProcessErrors(ds, ssync);
                ssync.Read();
            }
        }
Beispiel #2
0
        internal void LoadDiffGram(DataSet ds, XmlReader dataTextReader)
        {
            XmlReader reader = DataTextReader.CreateReader(dataTextReader);

            _dataSet = ds;
            while (reader.LocalName == Keywords.SQL_BEFORE && reader.NamespaceURI == Keywords.DFFNS)
            {
                ProcessDiffs(ds, reader);
                reader.Read(); // now the reader points to the error section
            }

            while (reader.LocalName == Keywords.MSD_ERRORS && reader.NamespaceURI == Keywords.DFFNS)
            {
                ProcessErrors(ds, reader);
                Debug.Assert(reader.LocalName == Keywords.MSD_ERRORS && reader.NamespaceURI == Keywords.DFFNS, "something fishy");
                reader.Read(); // pass the end of errors tag
            }
        }
        internal void LoadDiffGram(DataTable dt, XmlReader dataTextReader)
        {
            XmlReader ssync = DataTextReader.CreateReader(dataTextReader);

            this.dataTable = dt;
            this.tables    = new ArrayList();
            this.tables.Add(dt);
            this.CreateTablesHierarchy(dt);
            while ((ssync.LocalName == "before") && (ssync.NamespaceURI == "urn:schemas-microsoft-com:xml-diffgram-v1"))
            {
                this.ProcessDiffs(this.tables, ssync);
                ssync.Read();
            }
            while ((ssync.LocalName == "errors") && (ssync.NamespaceURI == "urn:schemas-microsoft-com:xml-diffgram-v1"))
            {
                this.ProcessErrors(this.tables, ssync);
                ssync.Read();
            }
        }
Beispiel #4
0
        internal void LoadDiffGram(DataTable dt, XmlReader dataTextReader)
        {
            XmlReader reader = DataTextReader.CreateReader(dataTextReader);

            _dataTable = dt;
            _tables    = new ArrayList();
            _tables.Add(dt);
            CreateTablesHierarchy(dt);

            while (reader.LocalName == Keywords.SQL_BEFORE && reader.NamespaceURI == Keywords.DFFNS)
            {
                ProcessDiffs(_tables, reader);
                reader.Read(); // now the reader points to the error section
            }

            while (reader.LocalName == Keywords.MSD_ERRORS && reader.NamespaceURI == Keywords.DFFNS)
            {
                ProcessErrors(_tables, reader);
                Debug.Assert(reader.LocalName == Keywords.MSD_ERRORS && reader.NamespaceURI == Keywords.DFFNS, "something fishy");
                reader.Read(); // pass the end of errors tag
            }
        }
Beispiel #5
0
        internal void LoadData(XmlReader reader)
        {
            this.dataReader = DataTextReader.CreateReader(reader);
            int  depth = this.dataReader.Depth;
            bool flag  = this.isTableLevel ? this.dataTable.EnforceConstraints : this.dataSet.EnforceConstraints;

            this.InitNameTable();
            if (this.nodeToSchemaMap == null)
            {
                this.nodeToSchemaMap = this.isTableLevel ? new XmlToDatasetMap(this.dataReader.NameTable, this.dataTable) : new XmlToDatasetMap(this.dataReader.NameTable, this.dataSet);
            }
            if (this.isTableLevel)
            {
                this.dataTable.EnforceConstraints = false;
            }
            else
            {
                this.dataSet.EnforceConstraints = false;
                this.dataSet.fInReadXml         = true;
            }
            if (this.topMostNode != null)
            {
                if (!this.isDiffgram && !this.isTableLevel)
                {
                    DataTable schemaForNode = this.nodeToSchemaMap.GetSchemaForNode(this.topMostNode, this.FIgnoreNamespace(this.topMostNode)) as DataTable;
                    if (schemaForNode != null)
                    {
                        this.LoadTopMostTable(schemaForNode);
                    }
                }
                this.topMostNode = null;
            }
            while (!this.dataReader.EOF)
            {
                if (this.dataReader.Depth < depth)
                {
                    break;
                }
                if (reader.NodeType != XmlNodeType.Element)
                {
                    this.dataReader.Read();
                }
                else
                {
                    DataTable tableForNode = this.nodeToSchemaMap.GetTableForNode(this.dataReader, this.FIgnoreNamespace(this.dataReader));
                    if (tableForNode == null)
                    {
                        if (!this.ProcessXsdSchema())
                        {
                            this.dataReader.Read();
                        }
                        continue;
                    }
                    this.LoadTable(tableForNode, false);
                }
            }
            if (this.isTableLevel)
            {
                this.dataTable.EnforceConstraints = flag;
            }
            else
            {
                this.dataSet.fInReadXml         = false;
                this.dataSet.EnforceConstraints = flag;
            }
        }