Creating a new data type
This should cover W3C XML Schema, Relax NG and DTD related problems.
-
- Posts: 5
- Joined: Mon Aug 13, 2007 1:04 pm
Creating a new data type
Post by carol.aboody »
Hi all
I have 2 questions on creating data types:
1)
I need my "datereturn" attribute to be in a specific format, or contain empty value.
For example: 2007-02-02 12:22:00, or "".
2)I need my "avgrank" attribute to be decimal OR empty. If i use decimal with an empty answer i get a validation error.
This is my Schema:
Thanks
I have 2 questions on creating data types:
1)
I need my "datereturn" attribute to be in a specific format, or contain empty value.
For example: 2007-02-02 12:22:00, or "".
2)I need my "avgrank" attribute to be decimal OR empty. If i use decimal with an empty answer i get a validation error.
This is my Schema:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!--W3C Schema generated by XMLSpy v2007 sp2 (http://www.altova.com)-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="getrank">
<xs:complexType>
<xs:attribute name="rc" use="required" type="xs:int"/>
<xs:attribute name="datereturn" use="required" type="xs:????????"/>
<xs:attribute name="avgrank" use="required" type="xs:????????"/>
</xs:complexType>
</xs:element>
</xs:schema>
-
- Posts: 5
- Joined: Mon Aug 13, 2007 1:04 pm
Solution to empty-decimal problem,date format still an issue
Post by carol.aboody »
I found a solution to the second problem here :
http://xsd.stylusstudio.com/2003May/post03006.htm
I still need help for the date format.
Thanks
http://xsd.stylusstudio.com/2003May/post03006.htm
I still need help for the date format.
Thanks
-
- Posts: 89
- Joined: Mon Mar 06, 2006 10:13 pm
If you're not using the standard date format, you could create a pattern based on an xs:string, eg
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="([0-9]{4}-[0-1][0-9]-[0-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9])|"/>
</xs:restriction>
</xs:simpleType>
Can't remember if [0-9]{4} works, you might need to use [0-9][0-9][0-9][0-9]
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="([0-9]{4}-[0-1][0-9]-[0-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9])|"/>
</xs:restriction>
</xs:simpleType>
Can't remember if [0-9]{4} works, you might need to use [0-9][0-9][0-9][0-9]
-
- Posts: 5
- Joined: Mon Aug 13, 2007 1:04 pm
Post by carol.aboody »
I tried that, i got this message:
Validation Error Message: s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '.'.
I couldn't find the meaning of it.
Validation Error Message: s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '.'.
I couldn't find the meaning of it.
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ 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