问题标签 [xsd2code]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
xsd - java.io.StreamCorruptedException:无效的流标头:3C787364
将 inputStream 转换为 ObjectInputStream 时出现此错误。请帮助我解决这个问题。
我的代码:
例外:
c# - Xsd2Code 自动属性不起作用?
我正在使用 Xsd2Code 为我的 XSD 文件生成 C# 序列化器/反序列化器类。我还启用了自动属性的生成。
问题 #1:除了自动属性之外,Xsd2Code 仍然生成私有字段。这不应该是必要的。
问题 #2:只有私有字段被初始化。自动属性未初始化并保持为空。
xml - 指定的类型未被识别:name='CD', namespace='urn:hl7-org:v3
我正在尝试使用自动生成的 ac# 类反序列化 XML 文件。当我尝试反序列化 xml 文件时,出现异常“无法识别指定的类型。” 有没有人遇到过这个问题?对你的帮助表示感谢。
我试图加载 c# 类和 xsd 文件,但它们太大而无法在此处加载。
c# 类是从使用下面的 xml 文件创建的 xsd 文件生成的。创建了两个xsd文件qrda.xsd和qrda1.xsd,使用如下命令生成c#类(xsd qrda.xsd qrda1.xsd /c)
xsd - Create C# class from reqif.xsd
I am trying to generate a C# class from the following ReqIF XSD file.
I have tried with xsd.exe which failed and now also with xsd2code which fails with the following error message (translation: reference to undeclared attribute group):
I suppose the xsd file is not 100% correct. I tried to get some information about the xsd format, but with my limited knowledge I was not able to solve the issue. Does somebody have an idea what could be wrong here or how I could proceed?
Thanks!
c# - 从 XSD (xhtml.blkstruct.class) 生成 C# 类
我有一个 xsd 文件,使用引用 xhtml.BlkStruct.class 的元素简化如下。我试过 xsd.exe 和 xsd2code 试图从中生成一个 C# 类,但我总是遇到错误。
这是错误(对未声明/未声明模型组的引用)
任何人都可以帮我解决这里出了什么问题吗?
背景我正在尝试 XmlSerialize 包含(简单)HTML/XML 与 sting 内容混合的字符串,所以像
例如
c# - VS2015 中的 Xsd2Code 插件
我已经下载并安装了 Xsd2Code 插件。
但是在 Visual Studio 中,当我右键单击 xsd 文件时,我看不到“运行 Xsd2Code 生成”选项。
我正在为此苦苦挣扎。
请帮帮我。
c# - XSD2Code 不生成可选枚举
我在从几个 XSD 生成 C# 类时遇到了一个相当大的问题。在序列化期间,枚举成员获取错误的值。我正在序列化的 XML 中不存在该属性,因此我希望它为 NULL 或“0”,但它获取的值“1”是枚举中的第一个可用值。
假设我有一个名为“person.xsd”的 XSD,它看起来像这样;
人.xsd
person XSD 包含一个名为“basisschema.xsd”的基本模式。该文件如下所示;
基础架构.xsd
生成的代码如下所示;
客户端.cs
CdtSomeType.cs
我期望 Person.cs 中有一个“CdtSomeType”类型的可选属性,但是这并没有发生。现在,当我们使用以下代码序列化与此 XSD 匹配的 XML 文件时;
然后属性“SomeEnumElement”具有默认枚举值 (1),而不是 NULL 或“0”。这发生在序列化期间。我能做些什么来解决这个问题?
xsd - 与 SvcUtils.exe 一起使用时,DataContractSerializer.ReadObject() 无法创建对象
我针对 XSD 文件运行 SvcUtil.exe 以生成类。然后尝试使用以下行从 XML 创建对象。我得到如下所示的错误。请看下面的详细代码。
使用的命令
完整代码
(XSD)
(XML)
我在同一个 XSD 文件上运行 XSD.exe。然后我能够使用XmlSerializer.Deserialize()
.
XSD 没有任何属性。我已经针对 XSD 验证了 XML。
请让我知道为什么Deserialize()
失败。
c# - 将对象序列化为没有空元素和具有空子元素的 XML 的对象
我需要将对象序列化为 XML 请求,但我正在调用的服务不接受空元素。
我从 XSD 生成了合同类,请求结构如下所示:
对于代码生成,我使用了 xsd2code并将其配置为从序列化中排除空集合。创建对象时
我可以将其序列化为 XML:
但是后端服务抱怨空<ids />
和<names />
元素。
是否有首选/任何方式从序列化 XML 中排除这些空元素?
如果我设法排除<ids />
and <names />
,最终我也想摆脱<filters>
元素。谢谢。
更新:添加了 XSD 的相关部分
更新:序列化完成如下
c# - Generating C# classes from XSD - schema elements are ignored
I generate C# classes for this XSD schema using xsd.exe or Xsd2Code:
I get similar results in both cases:
It seems strange to me that employee
is not referenced anywhere and that some information is lost after code generation. For example, if I look at the generated code it is not obvious that this XML can be created:
Why is information about schema elements not included into the generated code? Are there any other tools that can somehow save this information in the generated classes?