How Do I...? Common Tasks QuickStart Tutorial
How Do I...Infer an XML Schema?
This sample illustrates how to infer an XML schema from a given XML document by using the XmlSchemaInference class.
An XmlSchemaInference object is used to infer an XML schema from a particular XML document, and then adds the inferred schema
to an XmlSchemaSet object. The inferred schema is further refined by using schemas inferred from additional XML documents.
VB XmlSchemaInference.exe
[This sample can be found at H:\Home\WU_000036_efe47225c86ca62f325a01d8519bc002\Webs\aspnet.sk\quickstarts\QuickStartv20\howto\samples\Xml\XmlSchemaInference\
To build this sample, open the SDK command prompt and navigate to the above path. Build the sample using the build tool msbuild
passing the solution file as the first parameter: msbuild mySample.sln. The compiled executable will be found in the sub directory \bin
directory.]
The following code creates the XmlSchemaInference and XmlSchemaSet objects.
Dim infer As New XmlSchemaInference()
Dim sc As New XmlSchemaSet()
VB
The following code infers an XML schema from an XML document.
sc = infer.InferSchema(new XmlTextReader("sample.xml"))
VB
Microsoft .NET Framework SDK QuickStart Tutorials Version 2.0
Copyright � 2005 Microsoft Corporation. All rights reserved.
|