Hi, I would like to question about setting up the element types

I am currently developing a catalogue of course desriptions so I have an element that is,

<xs:element name="code" type="this is the problem" />

inside this is the problem, I am supposed to include type that allows me to do this:

"4 letter code and 4 digit code"

In order to incorporate this what shall I do? it is both 4 letter string and 4 integer...? so I can't just go like xs:integer..! (has to limit..)

Thanks

<xs:element name="code">
  <xs:simpleType>
    <xs:restriction base="xs:string">
      <xs:pattern value="[a-zA-Z]{4}[0-9]{4}"/>
    </xs:restriction>
  </xs:simpleType>
</xs:element>

Try that.

commented: Amazing guy +0

Thank you very much this works extremely efficient and well!

Hi MikeyIsMe, may I ask you one more question?

The type has to be:

text, allowing embedded HTML formatting

what should I use to do this? (allowing embedded HTML formatting? I think for text xsd:string would be find tho...)

Can you give a couple of examples of what your after to be allowed :) Can maybe invent a regex for it then.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.