I am using this piece of code from MSDN
to create an XSD from an XML
XmlReader reader = XmlReader.Create("contosoBooks.xml");
XmlSchemaSet schemaSet = new XmlSchemaSet();
XmlSchemaInference schema = new XmlSchemaInference();
schemaSet = schema.InferSchema(reader);
foreach (XmlSchema s in schemaSet.Schemas())
{
textbox.text = s.ToString();
}
I want to output the .xsd based on my xml file. When I generate the .xsd file, the only content I get inside it is: System.Xml.Schema.XmlSchema
When I generate the XSD using Visual Studio option to create Schema, it comes out properly. However, I have over 150 xml docs that I need to create XSD for hence need a programmatic option. Can anyone help?
With the desired XML document opened in the active editor tab, choose Tools | XML Actions | Generate XSD Schema from XML File on the main menu. The Generate Schema From Instance Document dialog box opens. and select the desired file in the dialog that opens.
Free tool to generate XSD (XML schema) from the XML file. There is option to browse the input . xml file and to save the output .
xsd using following steps : Create library (optional) > Right Click , New Message Model File > Select SOAP XML > Choose Option 'I already have WSDL for my data' > 'Select file outside workspace' > 'Select the WSDL bindings to Import' (if there are multiple) > Finish. This will give you the . xsd and .
Use this XML to XML Schema converter tool by pasting or uploading XML in the left box below. Results will appear in the box on the right. Generate XML Schema from XML with this XSD Generator. Input (XML) - Paste your XML here.
I use this command line:
Administrator:Developer Command Prompt for VS2013
Create xsd file from xml:
xsd FullFilePath.xml /outputdir:myOutputDir
Generate object to represent that xsd file in our project.
xsd /c /n:myNameSpace FullPath\fileName.xsd
then it will tell where the .cs file is created.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With