XML 模式:仅具有基本属性的限制意味着什么?

发布于 2024-08-14 11:32:45 字数 590 浏览 1 评论 0原文

创建如下内容意味着什么?

<xsd:simpleType name="myField">
    <xsd:restriction base="xsd:boolean"/>
</xsd:simpleType>

请注意,限制内没有实际元素(没有最小或最大长度,没有枚举等)。我觉得这基本上是将 myField 的类型设置为 xsd:boolean

但是,我的 wsdl 中有以下两个内容:(

上面的示例)

<xsd:element name="myOtherField" type="xsd:boolean"/>

当使用 JaxRPC 或 Apache Axis(转换为 java 对象骨架)时,第一个被转换为布尔值(对象),而后者被转换为布尔值(对象)示例被转换为布尔值(原始)。这告诉我,发布的第一个示例以某种方式表示该元素是可选的,但我不明白如何。

我同意第二个例子应该成为一个原语,但为什么第一个例子是布尔值?

更新:使第二个节点名称通用

What would it mean to create something like the following?

<xsd:simpleType name="myField">
    <xsd:restriction base="xsd:boolean"/>
</xsd:simpleType>

Notice there are no actual elements within the restriction (no min or max length, no enumerations, etc). I feel like this is basically setting the type of myField to xsd:boolean.

However, I have both of the following in my wsdl:

(the example from above)

and

<xsd:element name="myOtherField" type="xsd:boolean"/>

When using JaxRPC or Apache Axis (to convert to a java object skeleton), the first gets converted into a Boolean (object), where as the latter example gets converted into a boolean (primitive). This tells me that the first example posted somehow signifies the element is optional, but I don't understand how.

I agree that the second example should become a primitive, but why is the first example a Boolean?

Updated: Made second node name generic

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

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

发布评论

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

评论(1

活泼老夫 2024-08-21 11:32:45

我看到的唯一原因是元素的默认最小值为 1,因此它是布尔值是有意义的。

另一方面,简单类型通常在属性中使用,并且这些类型通常是可选的。所以这可能是它在哪里使用的问题。

The only reason I see for that is that elements have a default minimum of 1, so it makes sense that it is boolean.

On the other hand, simple types are commonly used in attributes and these are tipically optional. So it probably is a matter of where it's used.

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