Welcome   |   ASP.NET   |   Web Services   |   How Do I...?   |   Class Browser
  |   I want my samples in...   

How Do I...? Common Tasks QuickStart Tutorial

Go To...

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.

C# XmlSchemaInference.exe
View Source

[This sample can be found at M:\web\users\Sites\AspnetQuickStart\v2.0\QuickStart\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.

		
XmlSchemaInference infer = new XmlSchemaInference();
XmlSchemaSet sc = new XmlSchemaSet();
C#

The following code infers an XML schema from an XML document.

		
sc = infer.InferSchema(new XmlTextReader("sample.xml"));
C#



Microsoft .NET Framework SDK QuickStart Tutorials Version 2.0
Copyright � 2005 Microsoft Corporation. All rights reserved.


Hosted by MaximumASP | Found a broken link? | Contact Us | Terms and conditions | Privacy Policy | Advertise with us
� 2000 - 2008  Mindcracker LLC. All Rights Reserved