XSD - element, element value and attribute ?

Matthet

Usenet Archive
Joined
Sep 22, 2003
Messages
6
Reaction score
0
Hi,

I'm defining an element that
is based on simpleType named "myPatternType"

<xsd:element name="MyElement">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="myPatternType">
<xsd:attribute name="myAttr" type="myAttrType"
use="optional"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>

I need to add
<xsd:maxLength value="10"> to MyElement
and I can't find a way to do it.

Thx for any help
MAciek
 

strajan

Usenet Archive
Joined
Sep 17, 2003
Messages
9
Reaction score
0
You can either add that restriction in you myPatternType like the following <xsd:simpleType name="myPatternType"> <xsd:restriction base="xsd:string"> <xsd:maxLength value="10"/> <xsd:pattern value="[A-Z]{2}" /> </xsd:restriction> </xsd:simpleType> or you have to declare another type which restricts myPatternType to the maxLength value and the use that type to extend to include the attribute.

Cheers.
 

Matthet

Usenet Archive
Joined
Sep 22, 2003
Messages
6
Reaction score
0
You can either add that restriction in you myPatternType or you have to declare another type which restricts myPatternType to the maxLength value and the use that type to extend to include the attribute.

Thx,
so you are saying that it is not possible to put my maxLength to my element?!

myPatternType is used in few elements
myAttrType is also used in few attributes
and
I would like maxLength to be used in only one element
so I think that defining new myPatternType2 is not good idea.

MAciek
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,798
Members
249,594
Latest member
henrywalsh

Latest Threads

Top