开发者

XML schema for a complex type and I want an attribute on it

开发者 https://www.devze.com 2022-12-20 09:52 出处:网络
In your xml wisdom, have you a idea on how to define the type for “bDead” to be? (type=”xs:Boolean”)

In your xml wisdom, have you a idea on how to define the type for “bDead” to be? (type=”xs:Boolean”)

<bDead>0
<xdn>state</xdn>
       <xdv>alive</xdv>
</bDead>

Here’s the schema. Where/how would I specify the type and ranges for bdead? I don’t think that I can..

<xs:element name="bDead" >
<xs:complexType mixed="true">
<xs:sequence>
<xs:element name="xdn" type="xs:string" />
<xs:element name="xdv" type="xs:stri开发者_运维知识库ng" />
              </xs:sequence>
</xs:complexType>
</xs:element


If I understand the question properly, you want bDead to be an xs:Boolean with mixed content? The <xs:simpleContent> element is probably what you want inside your <xs:complextType>.

As Lord Torgamus says, w3schools is a pretty good place. I uses w3c.org. It can be harder to understand sometimes, but they are the source of the standard. As for XML-Schema, their "Part 0" of the standard document is a kind of primer. http://www.w3.org/TR/2004/REC-xmlschema-0-20041028/


I'm not completely clear on what you're asking for; do you mean the text of bDead, which is 0 in your example? What is bDead supposed to be, an integer?

In general, it seems like you want something related to XML schema restrictions. w3schools has a good page about those here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号