Hitesh T
Hitesh T

Reputation: 11

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

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:string" />
              </xs:sequence>
</xs:complexType>
</xs:element

Upvotes: 1

Views: 140

Answers (2)

Jeff Walker
Jeff Walker

Reputation: 1704

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/

Upvotes: 1

Pops
Pops

Reputation: 30868

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.

Upvotes: 0

Related Questions