xsd.exe

StackOverFlowException when generating C# code from xsd using xsd.exe (VS2010)

Hello, I am trying to generate C# code from an XML schema with xsd.exe with Visual Studio RC1 (version 10.0.30128.1) but get the follwoing error: C:\Development>xsd CR2008Schema.xsd /classes Microsoft (R) Xml Schemas/DataTypes support utility [Microsoft (R) .NET Framework, Version 4.0.30128.1] Copyright (C) Microsoft Corporation. All r...

Automatically generate XSD to C# in Visual Studio IDE

I am running Visual Studio 2010. I have a XSD schema and want to use xsd.exe tool to generate appropriate C# file. I have done this successfully from a command line but now I want to do the same from IDE. Is there some well-known route for this? I have managed to use a pre-build event but I hate to have the tool running on each build. N...

XSD.exe question about include files and code generation

If you have an XSD with an includes reference. Is it possible to generate 2 separate class files. 1 for the XSD, and 1 for the included XSD? My Scenario 4 XSDs, each of which share 15-20 element definitions in common. Rather than maintaining, I'd like to end up with the 4 XSDs all referencing a fifth file with the common definitions, an...

How to handle xs:any in WCF Data Contract

scratching my head on WCF ... I've got XML messages where the children of could be anything, e.g. <Test1Root> <CaseNo></CaseNo> <Activity></Activity> <DataFields> <AccountRef></AccountRef> <PropRef></PropRef> <User></User> </DataFields> </Test1Root> I've handled this in BizTalk using the xs:any for the <xs:...

Looking for a smart command-line tool in Linux which can generate xsd out of xml.

I can also settle for a web-based interface, but a good command-line tool is preferable. Now, I have tried to use xsd.exe that comes with mono-devel, but that skipped a whole bunch of stuff that was mentioned in the xml file. I understand that I will need to hand-tweak the output, but I do want something decent to start with. ...

XML Serialization of the default values of optional attributes

I have a set of classes build using xsd.exe, and I am trying to serialise them. However, an attribute is not being included in the resulting XML. Here is part of the schema where the problem lies. <xsd:element name="Widget"> <xsd:complexType> /* sequence removed for brevity */ <xsd:attribute name="Version" type="Vers...

How do you control what goes into XSDs generated from C# objects?

I know I can generate an XSD files from a C# assembly using XSD.exe or svcutil.exe. Is there anyway to control what goes in to the XSD file? I am mainly interested in adding restriction tags. ...

How do you deserialize Transunion XML?

Here is my attempt, xsd and classes created from xsd.exe Running my code I get error "There is an error in XML document (1, 2)." Inner exception {" was not expected."} Any help would be greatly appreciated. Thanks! XML Snippet: <xml> <creditBureau xmlns="http://www.transunion.com/namespace" xmlns:xsi="http://www....

xsd.exe generates weird C# class for XML serialization

Hi, I have an XML schema in .xdr file. This is a shortened version of this file(just for example): <?xml version = "1.0" encoding = "WINDOWS-1252"?> <Schema name = "ANS.xdr" xmlns = "urn:schemas-microsoft-com:xml-data" xmlns:dt = "urn:schemas-microsoft-com:datatypes"> <ElementType name = "Shipment" content = "eltOnly" order ...

Why XSD created by Visual Studio is different from created by XSD.exe?

Running XSD.exe over a XML file, the resulting file is different from openning the XML in Visual Studio, clicking XML menu, Create Schema. Why? There are some kind of arguments for XSD.exe to accomplish that? ...

How to best capture this XML Schema in C# classes

I have a large XML schema that has elements that look like this: <xs:element name="Tmats"> <xs:complexType> <xs:sequence> <xs:element name="ProgramName" type="xs:string" minOccurs="0"> <xs:annotation> <xs:documentation>PN</xs:documentation> </xs:annotation> ...

Multiple XSD files with same entities defined

Hi, Thanks for any help, We have two XSD files, both of them shares some same entities and some others different. Note that the one with differences are called differently. We want to generate C# code that can Serialize / Deserialize those entities, without ending up with two entities that share the same name and same content in two ...

Tool that can combine many XSD files into one?

I need to create XML serializer classes for approximately 65 XSD files, for which I am using Microsoft's XSD.EXE to generate the C# code... However, I keep running into Window CMD's character limit in the resulting output file (in which XSD.EXE combines the name of every XSD included): "The specified path, file name, or both are too lon...

Possible xml deserialization bug

I'm using the following xml schema entry to deserliaze some xml into an xsd generated block. <xs:element name="Action"> <xs:complexType> <xs:attribute name="src" type="xs:string" use="required" /> <xs:attribute name="dst" type="xs:string" use="required" /> <xs:attribute name="create" type="xs:string" use="optional" /> <x...

XML Schema Nillable use?

Hi All, I have a very simple XSD like below <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="SEARCH_INCIDENT" type="SEARCH_INCIDENT" /> <xs:complexType name="SEARCH_INCIDENT"> <xs:sequence> <xs:element name="INCIDENT_NUMBER" typ...

Using .NET XmlSerializer for xml with different polymorphic roots.

I have XML docs with different roots coming from one source. I have a XSD schema just like described in this question, with the abstract='true' root element 'BaseElem' of a Base type, plus additional root elements Elem1, Elem2, ... that extend the Base type and use substitutionGroup='BaseElement' attribute. xsd.exe generates BaseElem an...

Is there an XSD for XSD's, a Meta-XSD?

Does there exist an Xml schema that will validate other XML schemas? What I want to do is take such a meta-schema (if it exists) and run it through XSD.EXE so that I can use C# classes to read an arbitrary XML schema and analyze it. ...

How do I troubleshoot this exception when creating an XmlSerializer object?

I downloaded the XML Schema for XML Schemas at http://www.w3.org/2001/XMLSchema.xsd. I then used XSD.EXE to create a class from the downloaded file. I called the class schema.cs. I then executed this line of code: XmlSerializer serializer = new XmlSerializer(typeof(schema)); and got this error: The XML element 'annotation' from ...

Are circular groups allowed by XSD schema?

For this xml: <elem1 xmlns="http://www.fixprotocol.org/ns/fast/t/1.0"&gt; <elem2> <elem2/> </elem2> </elem1> I have this schema, which seems to validate fine against w3 schema validation service, and the schema validates the above XML just fine. Sadly, xsd.exe and some other tools report it to be an error. Is that correct? Are ci...