XSD - element, element value and attribute ?

M

Matthet

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
 
S

strajan

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.
 
M

Matthet

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

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top