King_Ming Posted July 31, 2014 Share Posted July 31, 2014 Hi, I'm trying to create an xsd with restriction for the following but I can't seem to find an example of how to do it properly. Basically its a string element that has an attribute. What I'm trying to do is have restriction on both the Name and the Number. So for example, for Name, I want to only allow [a-t]*, and for number I want it to be 0 -100. Thanks in advance, ~Ming XML <Name Number="10">abcdeft</Name> Link to comment Share on other sites More sharing options...
L8V2L Posted August 1, 2014 Share Posted August 1, 2014 (edited) Hi, I'm trying to create an xsd with restriction for the following but I can't seem to find an example of how to do it properly. Basically its a string element that has an attribute. What I'm trying to do is have restriction on both the Name and the Number. So for example, for Name, I want to only allow [a-t]*, and for number I want it to be 0 -100. Thanks in advance, ~Ming XML <Name Number="10">abcdeft</Name> This seem to be for facetRestrictionAnd PatternAttributePattern These are the schema's elements you will need to make this work...<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XML/Schema" version="1.0"><xs:element name="name"><xs:complexType><xs:restriction base="xs:string"><xs:pattern value="[A-T]*[a-t]*" /><xs:attribute name="Number"><xs:simpleType><xs:restriction base="xs:integer"><xs:pattern value="[0-9]+" /><xs:maxInclusion value="100" /><xs:minInclusion value="0" /></xs:restriction></xs:simpleType></xs:attribute></xs:restriction></xs:complexType></xs:element></xs:schema>I'm on my phone doing this, so they may be errors. Please give me a like for my efforts. Edited August 1, 2014 by L8V2L Link to comment Share on other sites More sharing options...
L8V2L Posted August 1, 2014 Share Posted August 1, 2014 (edited) Someone please delete this! Edited August 1, 2014 by L8V2L Link to comment Share on other sites More sharing options...
King_Ming Posted September 8, 2014 Author Share Posted September 8, 2014 That doesn't seem to work.. Link to comment Share on other sites More sharing options...
L8V2L Posted September 8, 2014 Share Posted September 8, 2014 That doesn't seem to work.. You don't won't uppercase? Then take the uppercase part out. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now