xsd.exe

Why does xsd.exe generate string property for xs:integer?

倾然丶 夕夏残阳落幕 提交于 2019-11-29 01:37:19
问题 When I generate a c# class from a xsd schema with xsd.exe I find this behaivor a bit wierd. My element: <xs:element name="InvoiceNo" type="xs:integer"/> is generated to: [System.Xml.Serialization.XmlElementAttribute(DataType="integer", Order=5)] public string InvoiceNo { ... } Why is that property not generated as an int instead of string ? 回答1: This behavior is by design: The xs:integer type is specified as a number with no upper or lower bound on its size. For this reason, neither XML

I can't find xsd.exe in Visual Studio 2008?

五迷三道 提交于 2019-11-28 23:12:03
In Visual Studio 2005 the XSD compiler was in the SDK/v2.0 directory. In Visual Studio there is only a SDK/v3.5 directory has gone and so too has the xsd.exe compiler. Where has it gone? Not being completely happy with the above answers I have found that the SDK containing amongst other things the XSD.exe compiler is distributed now as part of the Windows SDK. See http://msdn.microsoft.com/en-gb/windows/bb980924.aspx?wt.svl=more_downloads It is distributed as part of the Visual Studio 2008 package but they have moved it from the Visual Studio directory tree to: on 32bit Windows "Program Files

Automatically generate XSD to C# in Visual Studio IDE

喜欢而已 提交于 2019-11-28 17:02:23
问题 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. Normally, it should only run when XSD changes. Adding the generated .cs file to project puts it under .xsd of the same name, so the IDE knows they are related.

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

那年仲夏 提交于 2019-11-28 12:12:46
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 the standalone tool? Shamelessly borrowed from here : using System; using System.IO; using System.Collections.Generic; using System.Reflection; using System.Text; using System.Xml; using System.Xml.Serialization; using System.Xml.Schema; using System.CodeDom; using System.CodeDom.Compiler; using Microsoft.CSharp; using NUnit.Framework; namespace

XmlSerialization and xsi:SchemaLocation (xsd.exe)

佐手、 提交于 2019-11-28 09:13:05
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/2001/XMLSchema" version="1.1" xmlns="http://www.topografix.com/GPX/1/1" creator="ExpertGPS 1.1 - http://www.topografix.com" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"> </gpx> dtb Add this to your generated C# class:

How to read XML into a class/classes that matches its xsd

不打扰是莪最后的温柔 提交于 2019-11-28 08:29:52
So I have an XSD and a webservice that delivers in that same format. Now I could go ahead and read the xml into a document, create my objects from the class etc... But I am thinking, there must be some easier way to do that. Am I right? ;) Yahoo Maps GeocodeResponse XSD Yahoo Maps GeocodeResponse sample <ResultSet xsi:schemaLocation="urn:yahoo:maps http://api.local.yahoo.com/MapsService/V1/GeocodeResponse.xsd"> <Result precision="address"> <Latitude>47.643727</Latitude> <Longitude>-122.130474</Longitude> <Address>1 Microsoft Way, #Way1</Address> <City>Redmond</City> <State>WA</State> <Zip

Tool that can combine many XSD files into one?

放肆的年华 提交于 2019-11-28 06:52:56
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 long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters." To make a long story short, it seems that the only way I can get all these to validate and generate together is if I can merge all the

XSD tool appends “Specified” to certain properties/fields when generating C# code

允我心安 提交于 2019-11-28 02:54:47
问题 I got a strange behaviour with the XSD generator I can't really explain. I got an XSD like this: <xs:complexType name="StageSequenceElement" mixed="false"> <xs:complexContent> <xs:extension base="CoreObject"> <xs:sequence> <xs:element name="Description" type="xs:string" minOccurs="0"> <xs:annotation> <xs:documentation>Some Doc</xs:documentation> </xs:annotation> </xs:element> <xs:element name="StageRef" type="ObjectReference"> <xs:annotation> <xs:documentation>...</xs:documentation> </xs

What is the correct way of using the Guid type in a XSD file?

删除回忆录丶 提交于 2019-11-27 20:29:22
I have a .xsd file which I use to generate code with the xsd.exe tool from Visual Studio. Some class members are Guids and the xsd.exe tool gives 2 warnings: Namespace ' http://microsoft.com/wsdl/types/ ' is not available to be referenced in this schema. Type ' http://microsoft.com/wsdl/types/:guid ' is not declared. The Guid type is recognized because the generated C# file is valid and works. Anyone knows how to get rid of those warnings? What is the correct syntax for the XSD to be validated AND class members being generated as System.Guid? erbi Thank you all, I found how to remove the

Can we control type name in xsd.exe tool generated class

a 夏天 提交于 2019-11-27 18:04:13
问题 xsd.exe tool generates classes for given xsd file. It follows a pattern for naming the type. For example, <Students> <Student Name="A" RollNo="1" Address="Some Address"> <Department Id="20" Name="CSE"/> </Student> </Students> xsd.exe /c Students.xsd Students.cs file is generated. If we see the type for elements Element Type Name Students Students Student StudentsStudent Department StudentsStudentDepartment It generates type by prefixing the parent element name if the element is child. Can we