Is there a way to specify a range as a data type
This should cover W3C XML Schema, Relax NG and DTD related problems.
			- 
				daddyjones
- Posts: 9
- Joined: Wed Apr 11, 2018 4:43 pm
Is there a way to specify a range as a data type
Post by daddyjones »
I have an attribute that I'd like to have a range of values as it's data type.  By which I don't mean: a number between x and y, but more like x-y
For example <myelement myattribute="7-10" /> or <myelement myattribute="14-240" />
I'm guessing I might have to use a regular expression for this, but I was wondering if there was a simpler way that already exists?
			
			
									
									
						For example <myelement myattribute="7-10" /> or <myelement myattribute="14-240" />
I'm guessing I might have to use a regular expression for this, but I was wondering if there was a simpler way that already exists?
- 
				tavy
- Posts: 396
- Joined: Thu Jul 01, 2004 12:29 pm
Re: Is there a way to specify a range as a data type
Hello,
As far as I know the only way to impose this restriction in XSD is to use a "pattern" facet.
Best Regards,
Octavian
			
			
									
									As far as I know the only way to impose this restriction in XSD is to use a "pattern" facet.
Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
						<oXygen/> XML Editor
http://www.oxygenxml.com
- 
				daddyjones
- Posts: 9
- Joined: Wed Apr 11, 2018 4:43 pm
Re: Is there a way to specify a range as a data type
Post by daddyjones »
Thanks.  In case anyone is googling this in future and finds this thread - I've gone with:
			
			
									
									
						Code: Select all
<xs:pattern value="[123456789]\d*-[123456789]\d*"/>
			
				Jump to
				
			
		
			
			
	
	- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service