xsd.exe

XML complexType with element that ends up as "XmlElement"

In my XSD, I have something similar to this: <?xml version="1.0" encoding="utf-8" ?> <schema xmlns:jump="testThingy" elementFormDefault="qualified" targetNamespace="testThingy" xmlns="http://www.w3.org/2001/XMLSchema"&gt; <element name="command" type="jump:commandType" /> <complexType name="loginType"> <sequence> <element ...

Is svcutil.exe a replacement for xsd.exe?

I am using xsd.exe to generate some c# classes from a .xsd file. I ran into the same issue that is covered here and on other sites where xsd.exe generates Type[] arrays instead of generic List collections for types in the .xsd file. Some people have suggested that svcutil.exe can be used as a replacement for xsd.exe if you pass the /dat...

Clarification in getting the desired Directory

In My Windows based project set, of XML files are located at "c:\TestProj\XmlSource". My mission is to programmatically create schema files for those xml files. I am executing the code as follow: string directoryName = @"c:\TestProj\XmlSource"; foreach (string foundName in System.IO.Directory.GetFiles(directoryName)) { Process...

XSD.exe /dataset is not creating enumerations from my xsd file

I have created an XSD and have run XSD.exe on top of that .xsd file. It seems that my simple types that are restricted to enumeration values are not being generated as enums in the outputted .cs file. For example, my xsd looks like this: <xs:element name="ItemList" nillable="false"> <xs:complexType> <xs:sequence minOccurs="1" maxOc...

xsd.exe generates duplicate attributes when run on OFX2 schema

Using the command line: "xsd.exe" "OFX 2.1.1 schema/OFX2_Protocol.xsd" /c /namespace:OFX /nologo" The resulting C# source file fails to build with these errors: D:\blah\OFX2_Protocol.cs(19,6): error CS0579: Duplicate 'System.CodeDom.Compiler.GeneratedCodeAttribute' attribute D:\blah\OFX2_Protocol.cs(20,6): error CS0579: Duplicate 'Sy...

XmlSerialization and xsi:SchemaLocation (xsd.exe)

I used xsd.exe to generate a C# class for reading/writing GPX files. How do I get the resultant XML file to include the xsi:schemaLocation attribute eg. I want the following but xsi:schemaLocation is always missing <?xml version="1.0"?> <gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/20...

Trouble with XML Deserialization into XSD generated classes

I have a rather detailed xml file. Below is the top level nodes (I have included the ellipse as the lower level nodes are all well formed and properly filled with data): <?xml version="1.0" encoding="UTF-8"?> <config> <Models>...</Models> <Data>...</Data> </config> I have created an xsd file from using the Visual Studio 2008 ...

Nullable value with xsd.exe genereated class

I have been using xsd.exe to generate a class for deserializing XML into. I have decimal value in the source xsd that is not required: <xs:attribute name="Balance" type="xs:decimal" use="optional" /> The resulting class from xsd generates the following code: private decimal balanceField; [System.Xml.Serialization.XmlAttributeAttribu...

a xsd general tree structure, to be compiled to object model with xsd.exe

hi, say i want my xml to include any number of CONTAINER tags, which every one of those to include yet again any number of container tags, and so on. how would the xsd look like? p.s. i want this xsd to be compiled to classes. thank you very much. ...

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. <Root> <Type1 /> <Type2 /> <Type2 /> <Type1 /> </Root> I am testing out migrating from the XSD.exe tool which although adds type-safety has a lot of little annoyances. ...

XmlSerializer not populating sub-elements

I've used XSD.EXE to convert an XSD into an object. That works fine and I can Deserialize using XMLSerializer just fine, except that the subelements which are generated as arrays don't populate. private SubElements[] subelementsField; /// <remarks/> [System.Xml.Serialization.XmlArrayItemAttribute("SubElement", IsNullable=f...

using xsd.exe to generate xsd schema for a generic class.

Hello Everyone, I recently discovered the cool abilities of xsd.exe to generate schemas from types in a dll. However I am having trouble generating them for generic types. For example what command line paramters would I use to generate a schema for List? If it matters, I am using these schemas with linq to xsd to create strongly type...

xmlserializer validation

Hi, I'm using XmlSerializer to deserialize Xml achives. But I found the class xsd.exe generated only offers capability to read the xml, but no validation. For example, if one node is missing in a document, the attribute field of the generated class will be null, rather than throws a validation exception as I expected. How can I achieve...

.Net class generation from XSD with union

I've been working to create classes representing the HR-Xml 3 spec for the stand-along packages related to Screening. I've had a couple of problems, but currently I believe the main problem is the lack of support within xsd.exe for the xsd:union statement. When Xsd.exe encounters a simple type defined by union, it ignores the d...

How do I specify names for properties when using XSD.exe?

I'm writing an XSD schema which has an element that describes a file structure: <xs:schema ... > <xs:element name="FileStructure"> <xs:complexType> <xs:sequence> <xs:element ref="Folder" minOccurs="1" maxOccurs="1" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="Folder"> <xs:...

Create virtual methods using xsd.exe

I am using classes that were generated from an XML schema using the xsd.exe tool. It currently generates a huge (32k line) .cs file. I then serialize and deserialize parts of the of model using XMLSerializer. I need to override properties in these classes, so I have partial classes in separate files that override some of these generated...

Generating classes using XSD without base class in each one

Not sure what the appropriate tags are here... A while back I created a batch script which, when run will convert all .xsd files found in C:\api\ into C# classes using the xsd.exe file found in the Microsoft Windows SDK (using v6.1 here). @ECHO OFF CLS ECHO *** ECHO Runs xsd.exe on all *.xsd files sorted by filename in the current fold...

Why do some generated C# class properties not match the XSD attributes?

I'm generating C# classes from an OTA (Open Travel Alliance) XSD file. You can download the XSD file from here. I create the C# class with the following command in a Visual Studio Command Prompt: xsd FS_OTA_VehLocDetailsNotifRQ.xsd /classes /nologo Within OTA_VehLocDetailsNotifRQ.POS[0].RequestorID I would expect to find an ID proper...

Xml in Dot net 3.5:how to load xml document into object of class generated from schema?

I have defined schema for xml in file "packetTemplate.xsd".Using ms tool "xsd.exe" i have generated class "PacketTemplate" corresponding to schema.Does dot net provides api that can load xml document by refering to file and returns object of class PacketTemplate. ...

xsd.exe creating invalid constraints in dataset from xsd file

I have a sequence with an allowed minimum length of zero in my xsd. When I try and load an xml file which doesn't have any elements of the sequence into the DataSet that xsd.exe created I get an exception indicating that my file violated one of the DataSet's constraints. The xml file validates against the schema so I know it's valid. ...