borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (store proceudre related question ?)Next Topic (what is the difference between datagrid,datalist and repeater) New Topic New Poll Post Reply
AndreaVB Forum : ASP.Net : how to generate xml schema automatically from any xml file ?
Poster Message
tri_inn
Level: Regular User
Registered: 26-08-2002
Posts: 395

icon how to generate xml schema automatically from any xml file ?

i want to is there any buil in classes by which i can generate xml schema automatically instead of writing xml schema manually.
if it is possible then please help me with source code.

05-07-2004 at 06:15 AM
View Profile Send Email to User Show All Posts | Quote Reply
zimcoder
Level: VB Lord


Registered: 27-10-2003
Posts: 225
icon Re: how to generate xml schema automatically from any xml file ?

You can use the dataset methods to read and write xml schema

first let us read an xml file into our dataset

private void ReadSchemaFromFile(){
   // Create the DataSet to read the schema into.
   DataSet thisDataSet = new DataSet();
   // Set the file path and name. Modify this for your purposes.
   string filename="mySchema.xml";
   // Invoke the ReadXmlSchema method with the file name.
   thisDataSet.ReadXmlSchema(filename);

// more code coming here
}


Once you have the schema for the dataset you can write it out as a schema file
private void ReadSchemaFromFile(){
   // Create the DataSet to read the schema into.
   DataSet thisDataSet = new DataSet();
   // Set the file path and name. Modify this for your purposes.
   string filename="mySchema.xml";
   // Invoke the ReadXmlSchema method with the file name.
   thisDataSet.ReadXmlSchema(filename);
      // Display the DataSet schema as XML.
    Console.WriteLine( ds.GetXmlSchema() );
}

this should return a string that is an XSD file

____________________________
BrainBench ADO.NET and ASP.NET Certified Developer

24-07-2004 at 06:33 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : ASP.Net : how to generate xml schema automatically from any xml file ?
Previous Topic (store proceudre related question ?)Next Topic (what is the difference between datagrid,datalist and repeater) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder