ashwnacharya
ashwnacharya

Reputation: 14861

Alternative to xsd.exe in Visual Studio 2010

Looks like XSD.exe is not delivered as a part of Visual Studio 2010.

what is the alternative being offered in VS2010?

Upvotes: 23

Views: 38579

Answers (7)

user1134181
user1134181

Reputation:

XML Schema Definition Tool is available in the menu "Start":

Start-> All Programs-> Microsoft Visual Studio 2010-> Visual Studio Command Prompt(2010)

You'll see the welcome message a command line:

Setting environment for using Microsoft Visual Studio 2010 x86 tools.

D:\Program Files\Microsoft Visual Studio 10.0\VC>

You can, for example, create an XML scheme from the XML-file.

example.xml:

<?xml version="1.0" encoding="utf-8"?>
<country>
    <country_name>France</country_name>
    <population>59.7</population>
</country>

To do this, enter the following:

I:\example.xml /outputdir:D:\xml2xsd

In my system, i see the following:

...
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 4.0.30319.1]
Copyright (C) Microsoft Corporation. All rights reserved.
Writing file 'D:\xml2xsd\example.xsd'.

D:\Program Files\Microsoft Visual Studio 10.0\VC>

In the catalog D:\xml2xsd\ came a such a scheme:

example.xsd:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
  <xs:element name="country">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="country_name" type="xs:string" minOccurs="0" />
        <xs:element name="population" type="xs:string" minOccurs="0" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="country" />
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>

A full list of options here - http://msdn.microsoft.com/en-us/library/x6c1kb0s.aspx

As for alternatives, you can search converters for operations that allows xsd.exe:

  • XDR to XSD

  • XML to XSD

  • XSD to DataSet

  • XSD to Classes

  • Classes to XSD

Good luck.

Upvotes: 4

Dunc
Dunc

Reputation: 18922

I had to add this to my path:

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\

(Start > Edit the system environment variables > Environment Variables > Edit 'Path' under 'System variables')

Then I could start the Visual Studio command prompt (2010) and type

xsd.exe /? 

Upvotes: 1

elwyn
elwyn

Reputation: 10521

I believe xsd.exe is not available with Visual Studio * 2010 Express

Upvotes: 4

stormwild
stormwild

Reputation: 2955

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\xsd.exe

Upvotes: 16

Generally speaking DTD is an alternative to XSD and DTD is fully supported in Visual Studio. However, DTD is a weaker language, as some things can not be expressed in it. For example, it does not support as many data types as XSD does, nor does it have assertions. Anyways, if you're not too picky about it, you can give it a try.

Upvotes: 0

adam
adam

Reputation: 189

Start -> All Programs -> Microsoft Visual Studio 2010 -> Visual Studio Tools -> Visual Studio Command Prompt

You can use xsd.exe from here.

Upvotes: 18

Dean
Dean

Reputation: 3346

It's available from the VS 2010 command prompt. Open up the VS 2010 command prompt and type "xsd /?".

Upvotes: 41

Related Questions