Click here to Skip to main content
15,888,968 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What is the meaning of following tag, This tag is the validation for a string in XSD file

XML
<xs:pattern value="([ -~])*"/>


the complete tags are

XML
<xs:element name="DESCRIPTION-OF-GOODS">
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:maxLength value="255"/>
                <xs:minLength value="1"/>
                <xs:pattern value="([ -~])*"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
Posted
Updated 12-Oct-12 2:13am
v3

1 solution

Hello,

This is a Regular expression pattern(RegEx).

xs:pattern value="([ -~])*"

[ ] is a character class, that means it will match one character out of all the class possibilities.
- means a range of characters, here all characters from " " to "~"
( )is a group
* means as many time as you wish.

So basically it means that you can have any characters between " " and "~" repeated as often as you want. Any other character will make the node invalid.

See details here:
http://www.regular-expressions.info/reference.html[^]

Valery.
 
Share this answer
 
v3
Comments
Menon Santosh 12-Oct-12 8:35am    
what does this mean 'characters between " " and or "~"' plz make me understand with example
Valery Possoz 12-Oct-12 8:39am    
" " is ASCII code 20... "~" is ASCII 126. Any character whose code is between 20 and 126 will be ok.
http://www.asciitable.com/
Menon Santosh 12-Oct-12 8:56am    
thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900