Questions tagged [xsd.exe]

The XML Schema Definition (Xsd.exe) tool generates XML schema or common language runtime classes from XDR, XML, and XSD files, or from classes in a runtime assembly. It is a part of the Microsoft .NET SDK.

References

346 questions
8
votes
1 answer

Programmatically use XSD.exe tool feature (generate class from XSD Schema) through .NET Framework classes?

I want to generate a class from an XML XSD Schema, just as you can do with the Xsd.exe tool. E.g. XSD.exe /namespace:Generated.Xsd_1 /classes /outputdir:..\Classes Is there a way to do this by using classes in the .NET Framework instead of using…
John K
  • 28,441
  • 31
  • 139
  • 229
8
votes
3 answers

How to use xsd.exe /c output

I tried using xsd.exe to convert an .xsd file into a C# class. It worked, but I'm still not quite sure how to use this class. It has several class-level attributes but the most interesting is System.Xml.Serialization.XmlTypeAttribute. Which class…
User1
  • 39,458
  • 69
  • 187
  • 265
7
votes
2 answers

Programmatically use XSD.exe tool feature (generate schema from class) through .NET Framework classes?

I want to generate an XML Schema based upon a class, just as you can do with the Xsd.exe tool. E.g. xsd.exe /type: typename /outputdir:c:\ assmeblyname. Is there a way to do this by using classes in the .NET Framework instead of using the…
John K
  • 28,441
  • 31
  • 139
  • 229
7
votes
4 answers

Error: Can only generate one of classes or datasets

I've copied a Dataset from one csproj to another, and the new project gets the following compile warning: "The custom tool 'MSDataSetGenerator' failed while processing the file 'Client.xsd'." In researching this warning I discovered that if I opened…
dviljoen
  • 1,612
  • 1
  • 16
  • 28
7
votes
2 answers

Xsd.exe is unable generate class when Importing ComplexType

I am trying to run Xsd.exe on a XSD file and I am getting following error. I am using IMPORT because host-namespace is different from foreign-namespace. A2.xsd depends on A21.xsd, which in turn depends on A22.xsd (all are in same folder) ERROR:…
user1174790
  • 309
  • 4
  • 11
7
votes
3 answers

XSD.exe doesn't enforce minOccurs

I have a simple schema where I'm declaring both minOccurs and maxOccurs to 1. When I run the XSD.exe to generate a C# class and consume the class in code; the field is not enforced as mandatory. Is there some additional step missing? or does the…
G33kKahuna
  • 1,730
  • 7
  • 24
  • 39
7
votes
5 answers

.Net xsd.exe tool doesn't generate all types

For some reason, MS .Net (v3.5) tool - xsd.exe doesn't generate types when they are not used inside any element. e.g. XSD File (I threw in the complex element to avoid this warning - "Warning: cannot generate classes because no top-level elements…
Mrchief
  • 75,126
  • 20
  • 142
  • 189
7
votes
2 answers

Preserving Order In Sequence of Choices (LINQ To XSD)

Given the following XML example we could imagine a schema defining Root as containing a sequence of unbound number of choices between Type1 and Type2. I am testing out migrating…
Philip
  • 339
  • 3
  • 12
7
votes
1 answer

How to generate .xsd from a .cs using xsd.exe tool?

I have a .cs file that contains a subclass of XTypedElement and IXMetaData. Microsoft has a tool that generates XSD files automatically from managed code, but it doesn't accept .cs files. It only accepts .exe, .dll, .xdr, .xml, and .xsd. How do I…
sam
  • 287
  • 5
  • 12
6
votes
1 answer

Read XML into xsd.exe generated classes. Good idea?

I have a fairly complex XML coming my way and I have the XSD for it. I generated classes via xsd.exe and read XML into the class structure via the XmlSerializer described here. It works great. However, this is the first time I've done it this way…
AngryHacker
  • 59,598
  • 102
  • 325
  • 594
6
votes
0 answers

xsd.exe options - how to ignore constraint error message?

I have the following error message: C:\Users\humphrt\Desktop\AVV>xsd AVV038526.xml Microsoft (R) Xml Schemas/DataTypes support utility [Microsoft (R) .NET Framework, Version 2.0.50727.3038] Copyright (C) Microsoft Corporation. All rights…
sapbucket
  • 6,795
  • 15
  • 57
  • 94
5
votes
1 answer

Generating an XSD file with xsd.exe tool from an XML file with multiple namespaces

What I want to do: I am trying to generate an XSD file for an existing XML file. I'm using the xsd.exe tool (shipped with Visual Studio). Some of the elements in the XML file are namespace-qualified. In some cases local names are the same, just as…
Konrad Morawski
  • 8,307
  • 7
  • 53
  • 91
5
votes
2 answers

XmlSerializer InvalidOperationExc - known issue converting types

I am using XmlSerializer against an XSD.EXE generated class. XmlSerializer serializer = new XmlSerializer(obj.GetType()); Throws up InvalidOperationException Unable to generate a temporary class (result=1). error CS0030: Cannot convert…
P.Brian.Mackey
  • 43,228
  • 68
  • 238
  • 348
5
votes
1 answer

xsd.exe does not create a collection (array or list) for xs:list tag

I have the following xsd tag which I expected to create a collection on deserialization but it doesn't. .... ....
Monku
  • 2,440
  • 4
  • 33
  • 57
5
votes
1 answer

Is there a JSON equivalent of xsd.exe?

I am able to generate an XSDs for MyDataContract.dll assembly using xsd.exe xsd.exe MyDataContract.dll This will generate an schema0.xsd with definitions for all the types in the assembly. Is there any equivalent for JSON? I've looked at Newtonsoft…
Darragh
  • 2,526
  • 1
  • 23
  • 31
1 2
3
23 24