XML Schema: Attribute and Restriction Pattern on the same El

wxdqz

New Member
Hello all I am hoping you have can give me some help with a schema problem I am having. I have been hunting all over the net for answers and wasted alot of time through trial and error.

<xsd:element name="name">
<xsd:simpleType>
<xsd:restriction base="anyType">
<xsd:pattern value=http://www.webdeveloper.com/forum/archive/index.php/".{5,20}" />
<xsd:attribute name="number" use="required" type="xsd:IDREF"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>

As you can see I want to have the element (name) restricted by a pattern. But it also has an attribute which is an IDREF. Now I have tried many ways of structuring this always with errors from the parser (XMLWriter MSXML4).

Also the basic structure must remain the same due to XML file I have been given to apply this schema to. The XML looks like this:

<name number="c001">Treffynnon</name>


I cannot change the structure of the XML file so I must make the Schema work around the above pre-exisiting XML structure.

Thanks in advance.
 
Back
Top