Jump to content
Sign in to follow this  
mrx3cas

Xml Schema Pattern Issue

Recommended Posts

Hi,In schema pattern for one tag is defined like below.

<xs:simpleType name="IDType">		<xs:restriction base="xs:string">			<xs:maxLength value="100"/>			<xs:pattern value="[a-zA-Z0-9_\-]*"/>		</xs:restriction></xs:simpleType>

I just want to know what is the exact allowable values for IDType tag if pattern is specified like above?Thanks in advance.

Share this post


Link to post
Share on other sites

The total length of the string must be between 0 and 100 characters, and each of those characters must be a latin character, a number, "_" or "-".You might want to learn regular expressions.

Share this post


Link to post
Share on other sites

Hi boen_robot,What about occurrence specifier (*)? As it represents zero or more occurrences, if the string contains with out these characters is acceptable or not?I just want to know exactly what if there is any occurrence specifier in the pattern.Actually when the string contains only spaces and validation of that element against the schema is failing when I check with xml spy tool.I am getting the following message.File C:\test.xml is not valid. Value ' ' is not allowed for element <IDType>. Reason: it does not satisfy any of the defined patterns (see below) '[a-zA-Z0-9_\-]*' Error location: MBR / cus / bg / IDType Details cvc-pattern-valid: '' is not matched by the regular expressions of type definition '{anonymous}'. cvc-datatype-valid.1.1: For type definition '{anonymous}' the string '' is not pattern valid. cvc-simple-type.1: For type definition '{anonymous}' the string '' is not valid. cvc-type.3.1.3: The normalized value ' ' is not valid with respect to the type definition '{anonymous}'. cvc-elt.5.2.1: The element <IDType> is not valid with respect to the actual type definition '{anonymous}'.Can you please tell me the pattern specification along with the occurrence specifier.Thanks for giving reply.

Share this post


Link to post
Share on other sites

XML Schema implicitly anchors the entire expression with "^" and "$", so yeah... the above is invalid.See this page for other specifics of XML Schema patterns.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...