Jump to content
Sign in to follow this  
King_Ming

xml to xsd

Recommended Posts

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>

Share this post


Link to post
Share on other sites

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 by L8V2L

Share this post


Link to post
Share on other sites

Someone please delete this!

Edited by L8V2L

Share this post


Link to post
Share on other sites

That doesn't seem to work..

You don't won't uppercase? Then take the uppercase part out.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×