xsd.exe

DataSet Classes generated by xsd.exe generate a huge number of warnings

I've got several hundred warnings due to missing xml comments from a single DataSet generated from a single .xsd file. Since this is an auto generated file manually editing them isn't a good idea. Is there any way to either disable the warning for the file (CS1591) or put values that will be imported into xml comments into the xsd file...

DataSet generated by xsd.exe is not writing attributes on root element

Child elements of my data are being written directly off the root element instead of off the element that is their parent in the schema. My xsd: <xs:schema xmlns="MyNameSpace" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="MyNameSpace" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0"> <xs:i...

Repeated use of elements in a schema and XSD.exe generated datasets.

My schema looks like this: <xs:schema xmlns="DAN" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="DAN" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0"> <xs:complexType name="Stuff"> <xs:sequence> <xs:element ref="Numbers" minOccurs="0"/> </xs:sequence> </xs:complexType> <xs:element ...

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 and I'll be reading in tons of XML files going forward from various sources. How reliabl...

.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 with complex type were found."): <?xml version="1.0" encoding="utf-8"?> <xs:schema target...

using XSD.exe to generate an XSD

I am building SSAS cubes using AMO in c#. For this, I want to get a list of the public properties for the classes for Server, Cube, Dimension, etc. This will be my superset from which the user must provide mandatory properties and may provide the optional ones. I am trying to generate an XSD schema. I ran the following command XSD C:\w...

.xsd comments in xsd.exe generated wrapper class.

I have an xsd file in my csproj, from which xsd.exe generates a wrapper cs file. I'd like to comment the xsd file in a way, that the comments are also inserted into the generated wrapper class, so VS intellisense can be used effectively. Is this possible using xsd.exe? ...

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 uses that attribute? Is there a simple way to turn an instantiation of this class into a...

MS Project XML Serialization

I am trying to read data from an MS Project XML file. I have used the XML Schema Tool to generate a set of strongly typed classes based on the Microsoft Project 2007 XML Schema. However, I ran into several issues. The xmlns property on the root node from the XML exported from MS Project does not match the XSD schema. MS Project gener...

xsd.exe generated classes don't serialize default value attributes

Hello, I have few .cs files generated by xsd.exe by a XSD schema. My problem is that when i try to serialize those classes to xml, the attributes whose values match the default values defined in the xsd schema are not being serialized. I found out that my problem is solved when i remove [System.ComponentModel.DefaultValueAttribute(t...

XSD.exe and "Circular Group references"

I am attempting to build some classes so that I can deserialise an XML file created by a third party application. Luckily the developer of the 3rd party application included a schema file with their code so that the XML file can be understood. When I use the XSD.exe tool from Visual Studio the process fails reporting the following error...

AutoMapper and is*Specified properties

Hi, I have a bunch of XSD.exe-generated data contract classes which for all optional elements have a pair of C# properties like int Amount {get; set;} bool isAmountSpecified {get; set;} On the other side of mapping arena I have a nullable int like int? Amount {get; set;} Ideally I'd like for AutoMapper to be able to recognize such...

Creating an XSD schema

I have an xml tag: <ROW field1="value 1" field2="value 2" ... /> fieldi has a string value, and number of attributes fieldi is variable, but not less than 1. Is it possible to create an xsd schema for this tag? possible xml document <ROWDATA> <ROW field1="dfgdf" field2="ddfg"></ROW> <ROW field1="dfedf" field2="djkfg" field3="c...

WCF code generation for large/complex schema (HR-XML/OAGIS) - is there an alternative?

Hello, and thank you for reading. I am implementing a WCF Service based on a predefined specification (HR-XML 3.0). As such, I am starting with the schema, and working my way back to code. There are a number of large Schema documents (which import yet more Schema documents) related to my implementation, provided by this specification. ...

how to: re-assemble machine generated classes from xsd files to their original nested state.

Hi everyone, I'm working in Visual Studio 2008 using c#. Let's say I have 2 xsd files e.g "Envelope.xsd" and "Body.xsd" I create 2 sets of classes by running xsd.exe, creating something like "Envelope.cs" and "Body.cs", so far so good. I can't figure out how to link the two classes to serialize (using XmlSerializer) into the proper n...

Can I create a dataset XSD without using the designer?

Hi everyone, I want to be able to create the XSD file for my typed dataset without using the visual studio dataset designer. Is there a way to do this using for instance a command-line tool? There is some magic happening when a table is dragged from the server explorer to the design surface, but where does that magic come from? To add...

Any way to override how <choice> element is binded by xsd.exe

I have the following elements in my schema: <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; <xs:complexType name="optimizeModelBase"> <xs:attribute name="name" type="xs:string"/> </xs:complexType> <xs:complexType name="riskModel"> <xs:complexCont...

What type of things can cause sgen msbuild task to fail intermittantly with Access Violation?

In our MSBuild file for our project we sgen an assembly containing classes used during xml serialization. The classes are generated via xsd.exe. We use the following SGen task configuration. <SGen ToolPath="$(SdkPath)" ShouldGenerateSerializer="true" UseProxyTypes="false" BuildAssemblyName="AssemblyName.dll" ...

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 classes generated using XSD.exe don't mandatory fields? any suggestions or insight will be h...

Deserializing classes from XML generated using XSD.exe

I have classes generated (using xsd.exe) from an .xsd that I can serialize just fine, but when I try and deserialize it, I get the error: {"<XMLLanguages xmlns='http://tempuri.org/XMLLanguages.xsd'&gt; was not expected."} I've searched for a couple of hours and found most peoples problems lie in not declaring namespaces in their xsd/x...