Infer and create a Schema from an XML file. in VB.NET



Infer and create a Schema from an XML file. in VB.NET

'Assembly: System.Xml.dll

'Namespace: System.IO
'Namespace: System.Xml
'Namespace: System.Xml.Schema

' Gets the schema.
Dim infer As New XmlSchemaInference()
Dim sc As New XmlSchemaSet()
sc = infer.InferSchema(New XmlTextReader(xmlFile))

' Writes the schema.
Dim w As XmlWriter = XmlWriter.Create(New StreamWriter(XsdFile))
Dim schema As XmlSchema
For Each schema In sc.Schemas()
    schema.Write(w)
Next schema

Share |

 Cant find the page you are looking for?
 Help us to improve by adding the content that you are looking for.
 Leave a feedback
 We look forward to hear your comments and feedback.