Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ReadXMLSchema - When to use it

Status
Not open for further replies.

Skittle

ISP
Sep 10, 2002
1,528
0
0
US
I needed to read an XML file into a dataset and build a web form datagrid from the dataset.

To do this I coded the following:-

myDataSet1.ReadXMLSchema("C:\File1.XSD")
myDataSet1.ReadXML("C:\File1.XML")

myDataGrid1.DataSouce = myDataSet1
myDataGrid1.DataBind

Wors fine BUT it works just as well if I do not load the
schema .XSD file. Is it therefore only appropriate and necessary to load a Schema file when values are added to the dataset and you need to validate the new values fit the rules in the Schema file?


Dazed and confused
 
not 100% sure but I think you would read the schema to see if it matched what you expect before loading the data.
 
The schema is there to validate your XML document, to make sure it's formatted correctly. This is especially useful when the XML document is created by someone else, or is coming from another layer within your application.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top