Trouble validating an attribute of type "time"
Posted: Thu Sep 22, 2005 11:55 pm
Here's a fragment of my XSD file:
[/color]
and a fragment of my XML file:
<Track length="5:57">My Funny Valentine</Track>
When I attempt to validate the file, Oxygen gives me these errors:
http://www.w3.org/TR/xmlschema-2/#cvc-datatype-valid E cvc-datatype-valid.1.2.1: '5:57' is not a valid value for 'time'.
http://www.w3.org/TR/xmlschema-1/#cvc-attribute E cvc-attribute.3: The value '5:57' of attribute 'length' on element 'Track' is not valid with respect to its type, 'time'.
When I validate the same file with XMLSpy, I get no validation errors. I'm still a newbie at XSD, so I'm wondering if there's something I'm doing wrong.
(I realize that 'duration' would be a more appropriate data type than 'time', but I have to work within this restriction.)
Thanks for any help!
-Steve
Code: Select all
<xs:element name="Track" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="length" type="xs:time" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
and a fragment of my XML file:
<Track length="5:57">My Funny Valentine</Track>
When I attempt to validate the file, Oxygen gives me these errors:
http://www.w3.org/TR/xmlschema-2/#cvc-datatype-valid E cvc-datatype-valid.1.2.1: '5:57' is not a valid value for 'time'.
http://www.w3.org/TR/xmlschema-1/#cvc-attribute E cvc-attribute.3: The value '5:57' of attribute 'length' on element 'Track' is not valid with respect to its type, 'time'.
When I validate the same file with XMLSpy, I get no validation errors. I'm still a newbie at XSD, so I'm wondering if there's something I'm doing wrong.
(I realize that 'duration' would be a more appropriate data type than 'time', but I have to work within this restriction.)
Thanks for any help!
-Steve