Jump to content

Xml Schema Pattern Issue


mrx3cas

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.

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

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

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

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...