我一直致力于为与筛选相关的独立包创建代表 HR-Xml 3 规范的类。我遇到了一些问题,但目前我认为主要问题是 xsd.exe 中缺乏对 xsd:union 语句的支持。
当Xsd.exe遇到简单类型时
由 union 定义,它忽略
定义并使用
其内置字符串数据类型
地方。
来自 - http://msdn.microsoft.com/ en-us/library/bc57azyw%28VS.85%29.aspx
我在各种论坛和新闻组上看到的唯一解决方案是重组 XSD 以不使用联合?然而,即使我需要的实体很小,union 语句的数量也接近 100。也许这是唯一的解决方案?
我已经坚持了很多天了,除了“不,那不起作用”之外,还没有找到任何真正有用的东西。最后,我需要让它以某种方式工作。任何有关工具、重新设计、转换器的建议,以及任何可以让我获得这些课程的东西!我什至开始考虑生成 Java 类,然后将它们转换为 C#...我不知所措 提前
致谢!我当然希望有办法解决这个问题!
最后,我们决定在第一阶段不实施HR-Xml,也许当我们回到它时,我会有更好的运气。不过,如果有人阅读本文并有任何建议,请留下反馈,因为我计划对此进行一段时间的监控。
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
definition and uses the
built-in string data type in its
place.
From - http://msdn.microsoft.com/en-us/library/bc57azyw%28VS.85%29.aspx
The only solution I've seen on various forums and newsgroups is to restructure the XSD to not use the union? However, even with the small subset of entities I need, the number of union statements approaches 100. Perhaps this is the only solution?
I've been stuck on this for a number of days now and haven't been able to find anything real useful, besides "nope, that doesn't work". In the end, I need to make it work somehow. Any suggestions for tools, redesigns, converters, anything that can get me these classes! I've even started to think about generating Java classes and then converting those to C#... I'm at a loss
Thanks in advance! I certainly hope there's some solution to this!
In the end, we made the decision that we wouldn't implement HR-Xml in the first phase, perhaps when we get back to it, I'll have better luck. Still, if anyone reads this and has any suggestions please leave feedback as I plan to monitor this for a while.
发布评论
评论(2)
您可以相当轻松快速地尝试以下两件事,看看它们是否提供任何帮助:
使用 WCF svcutil.exe 实用程序(带有
/dconly
开关)而不是 xsd.exe - 这将尝试创建一个基于 WCF DataContractSerializer 的类,该类可以处理一些比标准 .NET XML 序列化器更好的事情尝试使用备用“XSD-to-code”生成器,例如 Xsd2Code Codeplex
马克
Two things you could try fairly easily and quicky to see if they provide any help:
use the WCF svcutil.exe utility (with the
/dconly
switch) instead of xsd.exe - this will attempt to create a class based on the WCF DataContractSerializer which can handle a few things better than the standard .NET XML Serializertry an alternate "XSD-to-code" generator, for instance something like Xsd2Code on Codeplex
Marc
我还需要使用工会从 XSD 生成 C# 代码
,一种工作解决方案是
由 Liquid-technologies 创建的免费在线 XSD 到 C# 代码生成器
它未经 MIT 许可。如果您想将此库用于非教育目的,则需要购买它
在我的情况下,我的 XSD 中不再有
union
,我只是将其从代码和xsd 中删除。 exe
来自
C:\Program Files (x86)\Microsoft SDKs\Windows\{version}\bin\NETFX {version} Tools\
的有效
I also needed to gen C# code from XSD with unions
And one work solution was
Free Online XSD to C# Code Generator created by liquid-technologies
It's not MIT Licenced. If you want to use this lib for not educational purposes, you need to buy it
In my case i had no more
union
in my XSD, and i just removed it from code, andxsd.exe
fromC:\Program Files (x86)\Microsoft SDKs\Windows\{version}\bin\NETFX {version} Tools\
worked