Click here to Skip to main content
15,171,439 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all,

Supposed I have this code :

XML
<attribute name="id" use="required">
  <simpleType>
    <restriction base="ID"/>
  </simpleType>
</attribute>


With ID as a basis I can only enter a valid name(NCName) as value. (ex. id01)

Is there any way to add unique restriction on a string in xml schema so I could insert invalid values ​​who do not fit the valid name? (ex. 01id)
Posted
Comments
Mehdi Gholam 1-Nov-11 4:13am
   
XML is a data format, it does not understand "restrictions" that is up to the XML parsers and handlers.
Agus Syahputra 1-Nov-11 4:22am
   
do you understand xml schema?

1 solution

You're doing it wrong: "ID" is not an XSD type. Look at the code samples in this chapter: http://www.w3schools.com/schema/el_restriction.asp[^]; it will give you right idea.

—SA
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900