what's wrong with this schema definition?

K

kk

I have this portion in my schema definition:

<xsd:simpleType name="MyTimeType">
<xsd:restriction base="xsd:dateTime">
<xsd:pattern value="\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}-Z"/>
<xsd:pattern
value="\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}+\d{2}:\d{2}"/>
<xsd:pattern
value="\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}-\d{2}:\d{2}"/>
</xsd:restriction>
</xsd:simepleType>

When I validate this with XMLSpy, it high-lights the second pattern
and gives this error message:

"This schema doesn't appear to be valid by itself (as a part
of anohter schema, it might still be OK): Schema error -
invalid regular expression: \ expected at position 41"

Could someone tell what's wrong with this pattern?

thanks a lot.

kk
 
M

Martin Honnen

kk said:
I have this portion in my schema definition:

<xsd:simpleType name="MyTimeType">
<xsd:restriction base="xsd:dateTime">
<xsd:pattern value="\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}-Z"/>
<xsd:pattern
value="\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}+\d{2}:\d{2}"/>
<xsd:pattern
value="\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}-\d{2}:\d{2}"/>
</xsd:restriction>
</xsd:simepleType>

When I validate this with XMLSpy, it high-lights the second pattern
and gives this error message:

"This schema doesn't appear to be valid by itself (as a part
of anohter schema, it might still be OK): Schema error -
invalid regular expression: \ expected at position 41"

Could someone tell what's wrong with this pattern?

Have you tried using
\+
instead of
+
The plus symbol is meta character thus you might need to escape it to
have it literally included in the pattern
 
K

kk

Martin said:
Have you tried using
\+
instead of
+
The plus symbol is meta character thus you might need to escape it to
have it literally included in the pattern

Thank you very much, that was dumb on my part :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top