ReadXmlSchema() public méthode

Reads the XML schema from the specified into the .
public ReadXmlSchema ( Stream stream ) : void
stream Stream
Résultat void
 protected DatasetPatrols(SerializationInfo info, StreamingContext context) {
     string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
     if ((strSchema != null)) {
         DataSet ds = new DataSet();
         ds.ReadXmlSchema(new XmlTextReader(new System.IO.StringReader(strSchema)));
         if ((ds.Tables["Patrols"] != null)) {
             this.Tables.Add(new PatrolsDataTable(ds.Tables["Patrols"]));
         }
         this.DataSetName = ds.DataSetName;
         this.Prefix = ds.Prefix;
         this.Namespace = ds.Namespace;
         this.Locale = ds.Locale;
         this.CaseSensitive = ds.CaseSensitive;
         this.EnforceConstraints = ds.EnforceConstraints;
         this.Merge(ds, false, System.Data.MissingSchemaAction.Add);
         this.InitVars();
     }
     else {
         this.InitClass();
     }
     this.GetSerializationData(info, context);
     System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
     this.Tables.CollectionChanged += schemaChangedHandler;
     this.Relations.CollectionChanged += schemaChangedHandler;
 }
        private void ArrayBinding_Load(object sender, System.EventArgs e)
        {
            // Access database
            System.Windows.Forms.DataVisualization.Charting.Utilities.SampleMain.MainForm mainForm = (System.Windows.Forms.DataVisualization.Charting.Utilities.SampleMain.MainForm)this.ParentForm;

            // The XML document
            string fileNameString = mainForm.applicationPath + "\\data\\data.xml";
            string fileNameSchema = mainForm.applicationPath + "\\data\\data.xsd";

            // Initializes a new instance of the DataSet class
            DataSet custDS = new DataSet();

            // Reads an XML schema into the DataSet.
            custDS.ReadXmlSchema( fileNameSchema );

            // Reads XML schema and data into the DataSet.
            custDS.ReadXml( fileNameString );

            // Initializes a new instance of the DataView class
            DataView firstView = new DataView(custDS.Tables[0]);

            Chart1.Series.Clear();
            // Since the DataView implements and IEnumerable, pass the reader directly into
            // the DataBindTable method with the name of the column used for the X value.
            Chart1.DataBindTable(firstView, "Name");

            // Set series appearance
            Chart1.Series[0].ChartType = SeriesChartType.Bar;
            Chart1.Series[0].Font = new Font("Trebuchet MS", 8);
            Chart1.Series[0].Color = System.Drawing.Color.FromArgb(220, 224,64,10);
            Chart1.Series[0].BorderWidth = 0;
        }
        private void ReadSchemaBad()
        {
            DataSet ds = new DataSet();
              StringBuilder sb = new StringBuilder(1024);

              try
              {
            // Read Schema File First
            ds.ReadXmlSchema(AppConfig.GetEmployeesSchemaFile());
            ds.ReadXml(AppConfig.GetEmployeesBadFile());

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
              sb.AppendFormat("id={0}", dr["id"]);
              sb.AppendFormat(Environment.NewLine);
              sb.AppendFormat("FirstName={0}", dr["FirstName"]);
              sb.AppendFormat(Environment.NewLine);
              sb.AppendFormat("LastName={0}", dr["LastName"]);
              sb.AppendFormat(Environment.NewLine);
            }

            txtResult.Text = sb.ToString();
              }
              catch (Exception ex)
              {
            txtResult.Text = ex.ToString();
              }
        }
    private void getSomeContent()
    {
        dt = new DataTable();
        ds = new DataSet();

        String xmlpath = Server.MapPath("~/App_Data/WanhatAutot.xml");
        String schemapath = Server.MapPath("~/App_Data/WanhatAutot.xsl");

        ds.ReadXml(xmlpath);
        ds.ReadXmlSchema(schemapath);

        List<String> merkit = new List<String>();

        merkit.Add("Volvo");
        merkit.Add("Datsun");
        merkit.Add("Nissan");
        merkit.Add("Ford");
        merkit.Add("Porsche");
        merkit.Add("Mazda");
        merkit.Add("Audi");

        listMerkit.DataSource = merkit;
        listMerkit.DataBind();

        GridView1.DataSource = ds;
        GridView1.DataBind();
    }
 internal string GenerateTypedDataSet(XmlSchemaElement element, XmlSchemas schemas, CodeNamespace codeNamespace, StringCollection references, CodeDomProvider codeProvider)
 {
     if (element == null)
     {
         return null;
     }
     if (this.importedTypes[element.SchemaType] != null)
     {
         return (string) this.importedTypes[element.SchemaType];
     }
     IList list = schemas.GetSchemas(element.QualifiedName.Namespace);
     if (list.Count != 1)
     {
         return null;
     }
     XmlSchema schema = list[0] as XmlSchema;
     if (schema == null)
     {
         return null;
     }
     DataSet dataSet = new DataSet();
     using (MemoryStream stream = new MemoryStream())
     {
         schema.Write(stream);
         stream.Position = 0L;
         dataSet.ReadXmlSchema(stream);
     }
     string name = new TypedDataSetGenerator().GenerateCode(dataSet, codeNamespace, codeProvider.CreateGenerator()).Name;
     this.importedTypes.Add(element.SchemaType, name);
     references.Add("System.Data.dll");
     return name;
 }
Exemple #6
0
 private void ReadXmlSchema(DataSourceXmlTextReader xmlReader)
 {
     this.designConnections = new DesignConnectionCollection(this);
     this.designTables      = new DesignTableCollection(this);
     this.designRelations   = new DesignRelationCollection(this);
     this.sources           = new SourceCollection(this);
     this.serializer        = new DataSourceXmlSerializer();
     this.dataSet           = new System.Data.DataSet();
     this.dataSet.Locale    = CultureInfo.InvariantCulture;
     System.Data.DataSet set = new System.Data.DataSet {
         Locale = CultureInfo.InvariantCulture
     };
     set.ReadXmlSchema(xmlReader);
     this.dataSet = set;
     foreach (DataTable table in this.dataSet.Tables)
     {
         DesignTable table2 = this.designTables[table.TableName];
         if (table2 == null)
         {
             this.designTables.Add(new DesignTable(table, TableType.DataTable));
         }
         else
         {
             table2.DataTable = table;
         }
         foreach (Constraint constraint in table.Constraints)
         {
             ForeignKeyConstraint foreignKeyConstraint = constraint as ForeignKeyConstraint;
             if (foreignKeyConstraint != null)
             {
                 this.designRelations.Add(new DesignRelation(foreignKeyConstraint));
             }
         }
     }
     foreach (DataRelation relation in this.dataSet.Relations)
     {
         DesignRelation relation2 = this.designRelations[relation.ChildKeyConstraint];
         if (relation2 != null)
         {
             relation2.DataRelation = relation;
         }
         else
         {
             this.designRelations.Add(new DesignRelation(relation));
         }
     }
     foreach (Source source in this.Sources)
     {
         this.SetConnectionProperty(source);
     }
     foreach (DesignTable table3 in this.DesignTables)
     {
         this.SetConnectionProperty(table3.MainSource);
         foreach (Source source2 in table3.Sources)
         {
             this.SetConnectionProperty(source2);
         }
     }
     this.serializer.InitializeObjects();
 }
        public Form1()
        {
            // How to Activate
            //Stimulsoft.Base.StiLicense.Key = "6vJhGtLLLz2GNviWmUTrhSqnO...";
            //Stimulsoft.Base.StiLicense.LoadFromFile("license.key");
            //Stimulsoft.Base.StiLicense.LoadFromStream(stream);

            InitializeComponent();

            if (File.Exists("..\\Data\\Demo.xsd"))
            {
                dataSet1.ReadXmlSchema("..\\Data\\Demo.xsd");
            }
            else
            {
                MessageBox.Show("File \"Demo.xsd\" not found");
            }

            if (File.Exists("..\\Data\\Demo.xsd"))
            {
                dataSet1.ReadXml("..\\Data\\Demo.xml");
            }
            else
            {
                MessageBox.Show("File \"Demo.xml\" not found");
            }

            dataSet1.DataSetName = "Demo";
        }
Exemple #8
0
        private static DataSet ConvertXMLFileToDataSet(string xmlFile)
        {
            StringReader stream = null;
            XmlTextReader reader = null;
            try
            {
                XmlDocument xmld = new XmlDocument();
                xmld.Load(xmlFile);

                DataSet xmlDS = new DataSet();
                stream = new StringReader(xmld.InnerXml);
                //从stream装载到XmlTextReader
                reader = new XmlTextReader(stream);
                //xmlDS.ReadXml(reader);
                xmlDS.ReadXmlSchema(reader);
                //xmlDS.ReadXml(xmlFile);
                return xmlDS;
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (reader != null)
                    reader.Close();
            }
        }
        protected DataSet(SerializationInfo info, StreamingContext context)
        {
            string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));

            if ((strSchema != null))
            {
                System.Data.DataSet ds = new System.Data.DataSet();
                ds.ReadXmlSchema(new XmlTextReader(new System.IO.StringReader(strSchema)));
                if ((ds.Tables["TestCase"] != null))
                {
                    this.Tables.Add(new TestCasesDataTable(ds.Tables["TestCase"]));
                }
                if ((ds.Tables["TsCHdaItemValue"] != null))
                {
                    this.Tables.Add(new ItemValuesDataTable(ds.Tables["TsCHdaItemValue"]));
                }
                this.DataSetName        = ds.DataSetName;
                this.Prefix             = ds.Prefix;
                this.Namespace          = ds.Namespace;
                this.Locale             = ds.Locale;
                this.CaseSensitive      = ds.CaseSensitive;
                this.EnforceConstraints = ds.EnforceConstraints;
                this.Merge(ds, false, System.Data.MissingSchemaAction.Add);
                this.InitVars();
            }
            else
            {
                this.InitClass();
            }
            this.GetSerializationData(info, context);
            System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
            this.Tables.CollectionChanged    += schemaChangedHandler;
            this.Relations.CollectionChanged += schemaChangedHandler;
        }
		public static string Generate (string inputFileContent, CodeCompileUnit compileUnit, CodeNamespace mainNamespace, CodeDomProvider codeProvider)
		{
			var dataSet = new DataSet ();
			dataSet.ReadXmlSchema (inputFileContent);
			T.Generate (dataSet, mainNamespace, codeProvider.CreateGenerator ());
			return null;
		}
Exemple #11
0
 protected dsItem(SerializationInfo info, StreamingContext context)
 {
     string s = (string) info.GetValue("XmlSchema", typeof(string));
     if (s != null)
     {
         DataSet dataSet = new DataSet();
         dataSet.ReadXmlSchema(new XmlTextReader(new StringReader(s)));
         if (dataSet.Tables["Item"] != null)
         {
             base.Tables.Add(new _ItemDataTable(dataSet.Tables["Item"]));
         }
         base.DataSetName = dataSet.DataSetName;
         base.Prefix = dataSet.Prefix;
         base.Namespace = dataSet.Namespace;
         base.Locale = dataSet.Locale;
         base.CaseSensitive = dataSet.CaseSensitive;
         base.EnforceConstraints = dataSet.EnforceConstraints;
         base.Merge(dataSet, false, MissingSchemaAction.Add);
         this.InitVars();
     }
     else
     {
         this.InitClass();
     }
     base.GetSerializationData(info, context);
     CollectionChangeEventHandler handler = new CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += handler;
     base.Relations.CollectionChanged += handler;
 }
        /// <summary>
        /// Fills and return a DataSet processing the data set file and starting with the oid.
        /// </summary>
        /// <param name="oid">Oid of the instance.</param>
        /// <param name="dataSetFile">Path of the data set file.</param>
        /// <returns>A DataSet object with the suitable data.</returns>
        public static DataSet GetData(Oid oid, string dataSetFile)
        {
            DataSet lDataSet = new DataSet();
            try
            {
                lDataSet.ReadXmlSchema(dataSetFile);
            }
            catch (Exception e)
            {
                object[] lArgs = new object[1];
                lArgs[0] = dataSetFile;
                string lErrorMessage = CultureManager.TranslateStringWithParams(LanguageConstantKeys.L_ERROR_DATASET_GENERICLOAD, LanguageConstantValues.L_ERROR_DATASET_GENERICLOAD, lArgs);

                Exception newException = new Exception(lErrorMessage, e);
                throw newException;
            }

            // Analize the Tables in the DataSet.
            DataTable lStartingClass = GetDataTable(lDataSet, oid.ClassName);

            string lDisplaySet = GetDisplaySet(lStartingClass);
            DataTable rootInstance = Logics.Logic.ExecuteQueryInstance(Logics.Logic.Agent, oid, lDisplaySet);
            // Add data to DataSet.
            lStartingClass.Merge(rootInstance);

            // Process Table relationships.
            ProcessTableRelationships(lDataSet, lStartingClass, oid);

            return lDataSet;
        }
Exemple #13
0
		protected DS2(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : 
				base(info, context, false) {
			if ((this.IsBinarySerialized(info, context) == true)) {
				this.InitVars(false);
				System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
				this.Tables.CollectionChanged += schemaChangedHandler1;
				this.Relations.CollectionChanged += schemaChangedHandler1;
				return;
			}
			string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
			if ((this.DetermineSchemaSerializationMode(info, context) == System.Data.SchemaSerializationMode.IncludeSchema)) {
				System.Data.DataSet ds = new System.Data.DataSet();
				ds.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));

				this.DataSetName = ds.DataSetName;
				this.Prefix = ds.Prefix;
				this.Namespace = ds.Namespace;
				this.Locale = ds.Locale;
				this.CaseSensitive = ds.CaseSensitive;
				this.EnforceConstraints = ds.EnforceConstraints;
				this.Merge(ds, false, System.Data.MissingSchemaAction.Add);
				this.InitVars();
			}
			else {
				this.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
			}
			this.GetSerializationData(info, context);
			System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
			base.Tables.CollectionChanged += schemaChangedHandler;
			this.Relations.CollectionChanged += schemaChangedHandler;
		}
Exemple #14
0
        //public static XmlNodeList GetXmlNodes(string xmlNodePath)
        //{
        //    XmlDocument xmlDoc = new XmlDocument();
        //    //xmlDoc.Load();
        //    return xmlDoc.SelectNodes(xmlNodePath);
        //}
        /*
              public static string GetInnerText(string xmlNodePath)
              {
                  XmlDocument xmlDoc = new XmlDocument();
                  LoadXMLSettingsFile(xmlDoc, GetSettingsFile());
                  XmlNode xmlNode = xmlDoc.SelectSingleNode(xmlNodePath);
                  return xmlNode.InnerText;
              }

              */
        public static DataSet GetDataSet(string DataSetSchemaPath, string TableXmlPath)
        {
            DataSet ds = new DataSet();
            ds.ReadXmlSchema(DataSetSchemaPath);
            ds.ReadXml(TableXmlPath);
            return ds;
        }
Exemple #15
0
 internal static DataSet ReadDataSet()
 {            
     DataSet ds = new DataSet();
     ds.ReadXmlSchema("store.xsd");
     ds.ReadXml("store.xml");
     return ds;
 }
 protected Map_Features_DataSet(SerializationInfo info, StreamingContext context) {
     string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
     if ((strSchema != null)) {
         DataSet ds = new DataSet();
         ds.ReadXmlSchema(new XmlTextReader(new StringReader(strSchema)));
         if ((ds.Tables["Features"] != null)) {
             Tables.Add(new FeaturesDataTable(ds.Tables["Features"]));
         }
         if ((ds.Tables["Types"] != null)) {
             Tables.Add(new TypesDataTable(ds.Tables["Types"]));
         }
         DataSetName = ds.DataSetName;
         Prefix = ds.Prefix;
         Namespace = ds.Namespace;
         Locale = ds.Locale;
         CaseSensitive = ds.CaseSensitive;
         EnforceConstraints = ds.EnforceConstraints;
         Merge(ds, false, MissingSchemaAction.Add);
         InitVars();
     }
     else {
         InitClass();
     }
     GetSerializationData(info, context);
     CollectionChangeEventHandler schemaChangedHandler = new CollectionChangeEventHandler(SchemaChanged);
     Tables.CollectionChanged += schemaChangedHandler;
     Relations.CollectionChanged += schemaChangedHandler;
 }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Populate series data using random data
            if(ChartData.Text == String.Empty)
            {
                double[]	yValues = {23.67, 75.45, 60.45, 34.54, 85.62, 32.43, 55.98, 67.23, 56.34, 23.14, 45.24, 67.41, 13.45, 56.36, 45.29};
                for(int pointIndex = 0; pointIndex < yValues.Length; pointIndex++)
                {
                    Chart1.Series["Series1"].Points.AddXY(1990 + pointIndex, yValues[pointIndex]);
                }
            }

            // Populate series data from the hidden text fields
            else
            {
                DataSet	dataSet = new DataSet();
                dataSet.ReadXmlSchema(new StringReader(ChartDataSchema.Text));
                dataSet.ReadXml(new StringReader(ChartData.Text));
                DataView dataView = new DataView(dataSet.Tables[0]);
                Chart1.Series["Series1"].Points.DataBindXY(dataView, "X", dataView, "Y");
            }

            // Data bind grid control to the series data
            if (!IsPostBack)
            {
                DataBindGrid();
            }
        }
Exemple #18
0
 public static DataTable GetProducts()
 {
     DataSet dsStore = new DataSet();
     dsStore.ReadXmlSchema(Application.StartupPath + "\\store.xsd");
     dsStore.ReadXml(Application.StartupPath + "\\store.xml");
     return dsStore.Tables["Products"];
 }
Exemple #19
0
            private void Form1_Load(object sender, EventArgs e)
            {
                // Приязка к таблицам в качестве источника BindingSource
                dgwDrivers.DataSource = bsDrivers;
                dgwCars.DataSource = bsCars;

                // BindingSource - предназначен для упрощения процесса 
                // привязки элементов управления к источнику данных


                // Создание DataSet с именем AutoPark
                dataSet = new DataSet("AutoPark");
                // Формирование заполнение dataSet  из  XML-файла
                dataSet.ReadXml("Registration.xml");
                dataSet.ReadXmlSchema("Registration.xsd");




                // присваивание dataSet объекту BindingSource
                bsDrivers.DataSource = dataSet;
                // указываем таблицу для свойства DataMember
                bsDrivers.DataMember = "Drivers";

                // присваивание dataSet объекту BindingSource
                bsCars.DataSource = bsDrivers;
                // указываем таблицу для свойства DataMember
                bsCars.DataMember = "FK_DriversCars";

            }
Exemple #20
0
        static void Main()
        {
            DataSet dataSet = new DataSet();

              dataSet.ReadXmlSchema(@"..\..\ch13\booklist.xsd");

              DisplaySchema.displayDataSetSchema(dataSet);
        }
        public DataSetPopulator(string xmlSchema)
        {
            _xmlSchema = xmlSchema;
            _generator = new ObjectIDGenerator();

            _dataSet = new DataSet();
            _dataSet.ReadXmlSchema(new StringReader(_xmlSchema));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            dataSet1 = new DataSet();
            string path = Server.MapPath("~/App_Data");

            dataSet1.ReadXmlSchema(path + "\\XMLFile1.xsd");
            dataSet1.ReadXml(path + "\\XMLFile1.xml");
            Page.DataBind();
        }
        public void _TestFixtureSetup()
        {
            DataSet dataSet = new DataSet();

            dataSet.ReadXmlSchema(XmlTestFiles.SqlServer.XmlSchemaFile);

            _defaultIterator = new DataSetTableIterator(dataSet);
            _forwardIterator = new DataSetTableIterator(dataSet, false);
            _reverseIterator = new DataSetTableIterator(dataSet, true);
        }
Exemple #24
0
 DataTable IDataHelper.GetData(string dataObjectName)
 {
     // TODO: figure out how to embed reference to xsd in xml file so we can read using a datatable
     DataSet ds = new DataSet();
     ds.ReadXmlSchema(this._DataPath + dataObjectName + ".xsd");
     string xmlFileName = this._DataPath + dataObjectName + ".xml";
     this.CreateIfNew(xmlFileName, ds);
     ds.ReadXml(xmlFileName, XmlReadMode.ReadSchema);
     return ds.Tables[0];
 }
		public void XmlLoadTest ()
		{
			try {
				DataSet ds = new DataSet();
				ds.ReadXmlSchema ("Test/System.Data/TestReadXmlSchema1.xml");
				ds.ReadXml ("Test/System.Data/TestReadXml1.xml");
				ds = null;
			} catch {
				Assert.Fail ("#1 Should not throw Exception");
			}
		}
        private void ReadSchema()
        {
            DataSet ds = new DataSet();
              StringBuilder sb = new StringBuilder(1024);

              // Read Schema File First
              ds.ReadXmlSchema(AppConfig.GetEmployeesSchemaFile());
              ds.ReadXml(AppConfig.GetEmployeesFile());

              txtResult.Text = "Done";
        }
        public DataSet BuildDataSet(string schemaFile, string dataFile = null)
        {
            var dataSet = new DataSet();
            dataSet.ReadXmlSchema(StreamHelper.ReadOnlyStreamFromFilename(schemaFile));

            if (dataFile != null)
            {
                dataSet.ReadXml(StreamHelper.ReadOnlyStreamFromFilename(dataFile));
            }

            return dataSet;
        }
        private DataSet BuildDataSet(string dataFilename = null)
        {
            var dataSet = new DataSet();
            dataSet.ReadXmlSchema(ReadOnlyStreamFromFilename(GetXmlSchemaFilename()));

            if (dataFilename != null)
            {
                dataSet.ReadXml(ReadOnlyStreamFromFilename(dataFilename));
            }

            return dataSet;
        }
        public XmlToCsvUsingLinq(string xmlSourceFilePath)
        {
            _xmlSourceFilePath = @xmlSourceFilePath;

            var ds = new DataSet("ds");
            ds.ReadXmlSchema(@_xmlSourceFilePath);

            foreach (DataTable table in ds.Tables)
            {
                TableNameCollection.Add(table.TableName);
            }
        }
Exemple #30
0
 protected TemplateDS(SerializationInfo info, StreamingContext context)
     : base(info, context, false)
 {
     if (base.IsBinarySerialized(info, context))
     {
         this.InitVars(false);
         CollectionChangeEventHandler value = new CollectionChangeEventHandler(this.SchemaChanged);
         this.Tables.CollectionChanged += value;
         this.Relations.CollectionChanged += value;
     }
     else
     {
         string s = (string)info.GetValue("XmlSchema", typeof(string));
         if (base.DetermineSchemaSerializationMode(info, context) == SchemaSerializationMode.IncludeSchema)
         {
             DataSet dataSet = new DataSet();
             dataSet.ReadXmlSchema(new XmlTextReader(new StringReader(s)));
             if (dataSet.Tables["TemplateProperty"] != null)
             {
                 base.Tables.Add(new TemplateDS.TemplatePropertyDataTable(dataSet.Tables["TemplateProperty"]));
             }
             if (dataSet.Tables["FormInfo"] != null)
             {
                 base.Tables.Add(new TemplateDS.FormInfoDataTable(dataSet.Tables["FormInfo"]));
             }
             if (dataSet.Tables["FormProperty"] != null)
             {
                 base.Tables.Add(new TemplateDS.FormPropertyDataTable(dataSet.Tables["FormProperty"]));
             }
             if (dataSet.Tables["FormRememberField"] != null)
             {
                 base.Tables.Add(new TemplateDS.FormRememberFieldDataTable(dataSet.Tables["FormRememberField"]));
             }
             base.DataSetName = dataSet.DataSetName;
             base.Prefix = dataSet.Prefix;
             base.Namespace = dataSet.Namespace;
             base.Locale = dataSet.Locale;
             base.CaseSensitive = dataSet.CaseSensitive;
             base.EnforceConstraints = dataSet.EnforceConstraints;
             base.Merge(dataSet, false, MissingSchemaAction.Add);
             this.InitVars();
         }
         else
         {
             base.ReadXmlSchema(new XmlTextReader(new StringReader(s)));
         }
         base.GetSerializationData(info, context);
         CollectionChangeEventHandler value2 = new CollectionChangeEventHandler(this.SchemaChanged);
         base.Tables.CollectionChanged += value2;
         this.Relations.CollectionChanged += value2;
     }
 }
Exemple #31
0
        /// <summary>
        /// This loads the values into the controls on load
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!Page.IsPostBack)
            {
                lblVersion.Text = ConfigurationManager.AppSettings["Version"];

                DataSet dsMenu = new DataSet();
                dsMenu.ReadXmlSchema(Server.MapPath(ConfigurationManager.AppSettings["AppMenuXSD"]));
                dsMenu.ReadXml(Server.MapPath(ConfigurationManager.AppSettings["AppMenuXML"]));

                rptMenu.DataSource = dsMenu;
                rptMenu.DataBind();
            }
        }
Exemple #32
0
        private static void LoadSettings()
        {
            DataSet ds = new DataSet();
            ds.ReadXmlSchema(Application.StartupPath + "\\ShowMiiWads.cfg");
            ds.ReadXml(Application.StartupPath + "\\ShowMiiWads.cfg");

            try
            {
                nandpath = ds.Tables["Settings"].Rows[0]["NandPath"].ToString();
                foldercount = Convert.ToInt32(ds.Tables["Folders"].Rows[0]["Foldercount"]);
                splash = ds.Tables["Settings"].Rows[0]["SplashScreen"].ToString();
            }
            catch { }
        }
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //

            dataSet1.ReadXmlSchema("..\\..\\Data\\Demo.xsd");
            dataSet1.ReadXml("..\\..\\Data\\Demo.xml");
        }
        public void All_Test_Xml_Files_Comply_With_Test_Xsd_Schema()
        {
            DataSet ds = new DataSet();
            ds.ReadXmlSchema(ReadOnlyStreamFromFilename(GetXmlSchemaFilename()));
            ds.ReadXml(ReadOnlyStreamFromFilename(GetXmlFilename()));

            DataSet dsRefresh = new DataSet();
            dsRefresh.ReadXmlSchema(ReadOnlyStreamFromFilename(GetXmlSchemaFilename()));
            dsRefresh.ReadXml(ReadOnlyStreamFromFilename(GetXmlRefeshFilename()));

            DataSet dsModify = new DataSet();
            dsModify.ReadXmlSchema(ReadOnlyStreamFromFilename(GetXmlSchemaFilename()));
            dsModify.ReadXml(ReadOnlyStreamFromFilename(GetXmlRefeshFilename()));
        }
Exemple #35
0
        public void actualizarProjecto(Projecto p)
        {
            string file, schema;
            file = getFicheiro(p.getNome());
            if (file.Length == 0)
            {
                file = p.getNome() + ".xml";
                schema = file.Remove(file.Length - 4) + ".xsd";
                File.Copy("exemplo.xml", file);

            }
            else { schema = file.Remove(file.Length - 4) + ".xsd"; }
            DataSet ds = new DataSet();

            FileStream finschema = new FileStream("exemplo.xsd", FileMode.OpenOrCreate, FileAccess.Read, FileShare.Read);
            ds.ReadXmlSchema(finschema);
            finschema.Close();
            FileStream findata = new FileStream(file, FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite);
            ds.ReadXml(findata);
            findata.Close();

            foreach (DataRow dr in ds.Tables["projecto"].Rows)
            {
                dr["nome"] = p.getNome();
                dr["data"] = DateTime.Now;
                dr["Filtros"] = p.getFiltros();
            }

            foreach (DataRow dr in ds.Tables["Propriedades"].Rows)
            {
                dr["url"] = p.getUrlInicial();
            }

            foreach (DataRow dr in ds.Tables["Propriedades"].Rows)
            {
                dr["pasta"] = p.getPasta();
                dr["visualizacaolocal"] = p.getvisualizacaolocal();
                dr["niveis"] = p.getNivel();
                dr["imagensremotas"] = p.getImagensRemotas();
                dr["aceitarrejeitar"] = p.getAceitarRejeitar();
            }

            FileStream fout = new FileStream(file, FileMode.Truncate,
                    FileAccess.Write, FileShare.ReadWrite);
            //Only write the Xml data to the stream
            ds.WriteXml(fout);
            //Close the Stream
            fout.Close();
        }
Exemple #36
0
        public Form1()
        {
            // How to Activate
            //Stimulsoft.Base.StiLicense.Key = "6vJhGtLLLz2GNviWmUTrhSqnO...";
            //Stimulsoft.Base.StiLicense.LoadFromFile("license.key");
            //Stimulsoft.Base.StiLicense.LoadFromStream(stream);

            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //

            dataSet1.ReadXmlSchema("..\\Data\\Demo.xsd");
            dataSet1.ReadXml("..\\Data\\Demo.xml");

            tbCopyright.Text = "(C) " + DateTime.Now.Year.ToString() + " My Company";
        }
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //

            // How to Activate
            //Stimulsoft.Base.StiLicense.Key = "6vJhGtLLLz2GNviWmUTrhSqnO...";
            //Stimulsoft.Base.StiLicense.LoadFromFile("license.key");
            //Stimulsoft.Base.StiLicense.LoadFromStream(stream);

            dataSet1.ReadXmlSchema("..\\..\\Data\\Demo.xsd");
            dataSet1.ReadXml("..\\..\\Data\\Demo.xml");
        }
        private void Form1_Load(object sender, System.EventArgs e)
        {
            if (File.Exists("..\\..\\Data\\Demo.xsd"))
            {
                dataSet1.ReadXmlSchema("..\\..\\Data\\Demo.xsd");
            }
            else
            {
                MessageBox.Show("File \"Demo.xsd\" not found");
            }

            if (File.Exists("..\\..\\Data\\Demo.xsd"))
            {
                dataSet1.ReadXml("..\\..\\Data\\Demo.xml");
            }
            else
            {
                MessageBox.Show("File \"Demo.xml\" not found");
            }

            dataSet1.DataSetName = "Demo";
            stiReport1.RegData(dataSet1);

            if (File.Exists("..\\..\\Reports\\BookmarksHyperlinks.mrt"))
            {
                stiReport1.Load("..\\..\\Reports\\BookmarksHyperlinks.mrt");
            }
            else
            {
                MessageBox.Show("File \"BookmarksHyperlinks.mrt\" not found");
            }
            stiReport1.Load("..\\..\\Reports\\BookmarksHyperlinks.mrt");

            stiReport1.Render(true);
            stiReport1.Info.Zoom = panel1.Zoom;
            if (stiReport1.CompiledReport != null)
            {
                stiReport1.CompiledReport.Info.Zoom = panel1.Zoom;
            }
            panel1.Refresh();
        }
Exemple #39
0
    protected Appointments(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
        :
        base(info, context, false)
    {
        if ((this.IsBinarySerialized(info, context) == true))
        {
            this.InitVars(false);
            System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
            this.Tables.CollectionChanged    += schemaChangedHandler1;
            this.Relations.CollectionChanged += schemaChangedHandler1;
            return;
        }
        string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));

        if ((this.DetermineSchemaSerializationMode(info, context) == System.Data.SchemaSerializationMode.IncludeSchema))
        {
            System.Data.DataSet ds = new System.Data.DataSet();
            ds.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
            if ((ds.Tables["Appointment"] != null))
            {
                base.Tables.Add(new AppointmentDataTable(ds.Tables["Appointment"]));
            }
            this.DataSetName        = ds.DataSetName;
            this.Prefix             = ds.Prefix;
            this.Namespace          = ds.Namespace;
            this.Locale             = ds.Locale;
            this.CaseSensitive      = ds.CaseSensitive;
            this.EnforceConstraints = ds.EnforceConstraints;
            this.Merge(ds, false, System.Data.MissingSchemaAction.Add);
            this.InitVars();
        }
        else
        {
            this.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
        }
        this.GetSerializationData(info, context);
        System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
        base.Tables.CollectionChanged    += schemaChangedHandler;
        this.Relations.CollectionChanged += schemaChangedHandler;
    }
Exemple #40
0
 public static DataSet ImportXML(this DataSet dataSet, String filename)
 {
     if (filename.IsNullOrWhiteSpace())
     {
         return(default(DataSet));
     }
     dataSet = new DataSet(Path.GetFileNameWithoutExtension(filename));
     //dataSet.ReadXml(filename);
     dataSet.ReadXmlSchema(filename);
     foreach (DataTable table in dataSet.Tables)
     {
         table.BeginLoadData();
     }
     dataSet.ReadXml(filename);
     foreach (DataTable table in dataSet.Tables)
     {
         table.EndLoadData();
     }
     //-----------------------------------------------------
     //dataSet.ReadXml(XmlReader.Create(new StringReader(xmlDocument.InnerXml)));
     return(dataSet);
 }
Exemple #41
0
        public Form1()
        {
            InitializeComponent();

            if (File.Exists("..\\..\\Data\\Demo.xsd"))
            {
                dataSet1.ReadXmlSchema("..\\..\\Data\\Demo.xsd");
            }
            else
            {
                MessageBox.Show("File \"Demo.xsd\" not found");
            }

            if (File.Exists("..\\..\\Data\\Demo.xsd"))
            {
                dataSet1.ReadXml("..\\..\\Data\\Demo.xml");
            }
            else
            {
                MessageBox.Show("File \"Demo.xml\" not found");
            }

            dataSet1.DataSetName = "Demo";
        }
        internal string GenerateTypedDataSet(XmlSchemaElement element, XmlSchemas schemas, CodeNamespace codeNamespace, StringCollection references, CodeDomProvider codeProvider)
        {
            if (element == null)
            {
                return(null);
            }
            if (this.importedTypes[element.SchemaType] != null)
            {
                return((string)this.importedTypes[element.SchemaType]);
            }
            IList list = schemas.GetSchemas(element.QualifiedName.Namespace);

            if (list.Count != 1)
            {
                return(null);
            }
            XmlSchema schema = list[0] as XmlSchema;

            if (schema == null)
            {
                return(null);
            }
            DataSet dataSet = new DataSet();

            using (MemoryStream stream = new MemoryStream())
            {
                schema.Write(stream);
                stream.Position = 0L;
                dataSet.ReadXmlSchema(stream);
            }
            string name = new TypedDataSetGenerator().GenerateCode(dataSet, codeNamespace, codeProvider.CreateGenerator()).Name;

            this.importedTypes.Add(element.SchemaType, name);
            references.Add("System.Data.dll");
            return(name);
        }
Exemple #43
0
        // Read information from the reader.
        private void ReadModeSchema(XmlReader reader, XmlReadMode mode)
        {
            bool inferSchema = mode == XmlReadMode.InferSchema || mode == XmlReadMode.Auto;
            bool fillRows    = mode != XmlReadMode.InferSchema;

            // This check is required for full DiffGram.
            // It is not described in MSDN and it is impossible
            // with WriteXml(), but when writing XML using
            // XmlSerializer, the output is like this:
            // <dataset>
            //  <schema>...</schema>
            //  <diffgram>...</diffgram>
            // </dataset>
            //
            // FIXME: This, this check should (also) be done
            // after reading the top-level element.

            //check if the current element is schema.
            if (reader.LocalName == "schema")
            {
                if (mode != XmlReadMode.Auto)
                {
                    reader.Skip(); // skip the schema node.
                }
                else
                {
                    DSet.ReadXmlSchema(reader);
                }

                reader.MoveToContent();
            }

            // load an XmlDocument from the reader.
            XmlDocument doc = new XmlDocument();

            doc.Load(reader);
            if (doc.DocumentElement == null)
            {
                return;
            }

            // treatment for .net compliancy :
            // if xml representing dataset has exactly depth of 2 elements,
            // than the root element actually represents datatable and not dataset
            // so we add new root element to doc
            // in order to create an element representing dataset.
            //
            // FIXME: Consider attributes.
            // <root a='1' b='2' /> is regarded as a valid DataTable.
            int rootNodeDepth = XmlNodeElementsDepth(doc.DocumentElement);

            switch (rootNodeDepth)
            {
            case 1:
                if (inferSchema)
                {
                    DSet.DataSetName = doc.DocumentElement.LocalName;
                    DSet.Prefix      = doc.DocumentElement.Prefix;
                    DSet.Namespace   = doc.DocumentElement.NamespaceURI;
                }
                return;

            case 2:
                // create new document
                XmlDocument newDoc = new XmlDocument();
                // create element for dataset
                XmlElement datasetElement = newDoc.CreateElement("dummy");
                // make the new created element to be the new doc root
                newDoc.AppendChild(datasetElement);
                // import all the elements from doc and insert them into new doc
                XmlNode root = newDoc.ImportNode(doc.DocumentElement, true);
                datasetElement.AppendChild(root);
                doc = newDoc;
                break;

            default:
                if (inferSchema)
                {
                    DSet.DataSetName = doc.DocumentElement.LocalName;
                    DSet.Prefix      = doc.DocumentElement.Prefix;
                    DSet.Namespace   = doc.DocumentElement.NamespaceURI;
                }
                break;
            }

            // set EnforceConstraint to false - we do not want any validation during
            // load time.
            bool origEnforceConstraint = DSet.EnforceConstraints;

            DSet.EnforceConstraints = false;

            // The childs are tables.
            XmlNodeList nList = doc.DocumentElement.ChildNodes;

            // FIXME: When reading DataTable (not DataSet),
            // the nodes are column items, not rows.
            for (int i = 0; i < nList.Count; i++)
            {
                XmlNode node = nList[i];
                // node represents a table onky if it is of type XmlNodeType.Element
                if (node.NodeType == XmlNodeType.Element)
                {
                    AddRowToTable(node, null, inferSchema, fillRows);
                }
            }
            // set the EnforceConstraints to original value;
            DSet.EnforceConstraints = origEnforceConstraint;
        }