xsd.exe

xsd.exe does not seem to work for C++ with newer versions of Visual Studio

江枫思渺然 提交于 2021-01-28 08:08:29
问题 I am trying to use the xsd.exe tool to generate C++ classes from XML schema files. According to this post I should simply be able to use the tool from a Visual Studio developer command prompt, but it doesn't seem to work for C++ in newer versions of Visual Studio (2017 or 2019) When I try to execute the command I get the error: Error: The CodeDom provider type "Microsoft.VisualC.CppCodeProvider, CppCodeProvider, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" could not be

XSD from variable number of XML elements

风流意气都作罢 提交于 2020-01-16 19:38:35
问题 I'm creating a xml document based on some conditions in my app. the number of elements inside my xml is always variable. For instance, one time it may look like: <TransactionTypes> <X value="false" text="" /> <O value="false" text="" /> <E value="false" text="" /> <P value="false" text="" /> <C value="false" text="" /> <K value="false" text="" /> </TransactionTypes> and the other time like: <TransactionTypes> <TT value="false" text="" /> <EP value="false" text="" /> <PY value="false" text=""

Is svcutil.exe a replacement for xsd.exe?

社会主义新天地 提交于 2020-01-11 15:46:58
问题 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 /dataContractOnly parameter to svcutil.exe. However, it seems like those people are mistaken because svcutil.exe actually generates System.Xml.XmlNode[] array

Cannot generate classes because no top-level elements with complex type where found

蹲街弑〆低调 提交于 2020-01-11 02:09:07
问题 I am trying to create a class from a xsd file using the XSD.EXE tool. but for some reason i get this error. Warning: cannot generate classes because no top-level elements with complex type were found. I have looked around on stack and seen that i could put a type on the complex type element but i cannot seem to get i to work. here is the xsd file <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.unece.org/cefact/namespaces

Using XSD files in WinRT Projects

这一生的挚爱 提交于 2019-12-24 15:32:45
问题 I'm trying to use some existing C# code in a WinRT (Windows Store/Metro) project. This code relied on some xml files generated using XSD. Unfortunately it seems the old XmlDocument classes aren't available in WinRT... there are some alternatives, but they don't seem to be quite the same - so I need to generate some new files for WinRT. Is there a way to import an XSD file into a WinRT project so that all the data classes, and enums are generated and can be used in the Metro project? I've

XSD.exe ignores simple complextypes

核能气质少年 提交于 2019-12-24 10:48:26
问题 We have a big wcf service, and a big xsd document where we have several elements and complex types. We generate code with the xsd.exe, and use the XmlSerializerFormat on our ServiceContract for the WCF service to serialize these objects again. Now we have a problem with xsd.exe and the definitions of an array of strings. Image we have the following element defined.. <xs:element name="Configuration" type="Configuration"/> <xs:complexType name="Configuration"> <xs:sequence> <xs:element name=

Why is a field in an auto-generated class serialized into an element when defined as an attribute in the XSD?

我怕爱的太早我们不能终老 提交于 2019-12-24 06:37:22
问题 I'm trying to expose a fairly complex object as XML through a REST API (using WCF). However, the object is defined by an XSD file so I've generated classes using the xsd.exe tool. The problem is that it seems that when my object is serialized to XML, an attribute (defined in the xsd) is serialized into an element. And I don't get why. Currently, I'm assuming that my xsd somehow allows that, but I can't tell why. I don't do any custom serialization, I let the framework handle it. Can someone

How to work with different.xsd namespaces that contains the same elements/classes?

不问归期 提交于 2019-12-23 18:07:34
问题 Im having a little trouble understanding how I should work with xml files, so I hope you guys can guide me in the right dirrection :) Hopefully I can explain my problem clear enough :) I have a lot of .xsd files which are all connected from top to bottom. So I have 10 .xsd with namespace A and 10 .xsd with namespace B. Lets say that the two namespaces represents each own car. That means they both share a lot of the same elements, like engine, wheel ect.. I tought that I could make use of xsd

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

倖福魔咒の 提交于 2019-12-23 10:28:12
问题 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(typeof(<someType>), "<SomeValue>")] attribute for the member representing a default field. So my question isn't there more elegant way to do this? For example is there any

xsd.exe generates two files, how to join them into one?

只愿长相守 提交于 2019-12-22 12:21:02
问题 I'm not a big XSD expert.. so I'm using xsd.exe to quickly generate some xsd that I need and then tweaking them a bit (minOccur, etc). But now it has created two XSD files, the main one and an extra one where it defines a complex type. How could I mash them together? I've tried for a while but I keep getting compilation errors. Here's what they look like: <?xml version="1.0" encoding="utf-8"?> <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn