Jump to content

Regex problem


TonyPG
 Share

Recommended Posts

Hi i am having problems with adding a simpleType regex pattern. I have this in my code at the moment.

<xsd:simpleType name="SKU">  <xsd:restriction base="xsd:string">	<xsd:pattern value="^[^0-9][a-zA-z0-9]*" />  </xsd:restriction></xsd:simpleType>  <xsd:element name="commercial-listing">...<xsd:attribute name="version" type="SKU"></xsd:attribute>...

There is no error message in the schema document. Dotted line indicated unrelated code. Then in the XML doc

<commercial-listing version="A1234">......</commercial-listing>

But no matter what pattern i use even if it is a single character both in the pattern and in the xml doc. The version ENTITY underlines red in Eclipse and i get an error. Description Resource Path Location Typecvc-attribute.3: The value 'A1234' of attribute 'version' on element 'commercial-listing' is not valid with respect to its type, 'SKU'. reml.xml /src line 10 XML Problemcvc-pattern-valid: Value 'A1234' is not facet-valid with respect to pattern '^[^0-9][a-zA-z0-9]*' for type 'SKU'. reml.xml /src line 10 XML Problem Any advice would be appreciated.

Link to comment
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
 Share

×
×
  • Create New...