尝试从 XSD 生成代码是噩梦

发布于 2024-07-29 23:37:41 字数 831 浏览 3 评论 0原文

晕,

我确信这个问题过去已经被问过很多次了,但我正在做一场噩梦。

我有一组包含大量复杂类型的 XSD 模式。 其中之一是:

<complexType name="commandType">
  <sequence>
    <choice>
      <element name="check" type="epp:readWriteType"/>
    </choice>
  </sequence>
</complexType>

但是,“check”实际上应该是“checkType”......但它不可能,因为这样做会在包含文件中创建某种疯狂循环,因此设计工具只是不这样做不让你这么做。 因此,readWriteType 可能是 checkType 派生自的类(我不知道,我可能在撒谎)。

然而 readWriteType 看起来像这样:

<complexType name="readWriteType">
  <sequence>
    <any namespace="##other"/>
  </sequence>
</complexType>

因此代码生成工具只是不知道如何处理它,或者 checkType 如何与 readWriteType 相关。 这真是令人沮丧。

不管怎样,只是希望这里有人能有一个脑电波!

哦,XSD.exe 不适用于这些类,因此我尝试使用一些第三方工具,例如在复杂类型之前需要元素。

谢谢,P

Halo

I'm sure this question has been asked many times in the past, but I'm having a nightmare with it.

I have a set of XSD schemas with a tonne of complex types. One of them is this:

<complexType name="commandType">
  <sequence>
    <choice>
      <element name="check" type="epp:readWriteType"/>
    </choice>
  </sequence>
</complexType>

But, "check" should actually be a "checkType"....but it can't be, because doing this would create some kind of mad looping in the includes files, so the design tools just don't let you do this. So, readWriteType was put in presumably to be a class that perhaps checkType derives from (I don't know, I could be lying).

readWriteType however, looks like this:

<complexType name="readWriteType">
  <sequence>
    <any namespace="##other"/>
  </sequence>
</complexType>

So the code generation tools just haven't got a clue what to do with it, or how checkType relates to readWriteType. It's mighty frustrating.

Anyway, was just hoping someone on here might have a brainwave!

Oh, XSD.exe doesn't work with these classes so I'm trying to work with some third party tools, something about needing element before complexType.

Thanks, P

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

2024-08-05 23:37:45

我不知道如何解决这个问题 - 只要您使用 元素类型,生成的代码将始终相当通用并使用大量 object代码>元素。

为什么不能将元素 check 设为 checkType 类型? 这确实是解决问题的唯一方法 - 如果您有明确定义的类型,那么代码生成可以对此做一些事情。

马克

I don't see how you can solve this - as long as you use the <any> element type, the generated code will always be rather generic and use a lot of object elements.

Why can't you make the element check be of type checkType ? That really is the only way to get things straightened out - if you have clearly defined types, then the code generation can do something about it.

Marc

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文