Advertisement

05.07.2008 at 12:30PM PDT, ID: 23384011 | Points: 500
[x]
Attachment Details

XML Schema - Elemenmt with Pattern Not Required

I have an XML schmea defined. One element type is phone, which must adhere to a pattern (see below). The value is not required, but when it is null it fails validation since it is not adhering to the pattern. How can it be defined so it only validates to the pattern when the node is not null?

<xs:simpleType name="phonextype">
            <xs:restriction base="xs:string">
                  <xs:maxLength value="10"/>
                  <xs:pattern value="([0-9]{10})?"/>
            </xs:restriction>
      </xs:simpleType>
Start your free trial to view this solution
Question Stats
Zone: Web Development
Question Asked By: HydeNSeeka
Question Asked On: 05.07.2008
Participating Experts: 1
Points: 500
Views: 0
Translate:
Loading Advertisement...
05.07.2008 at 02:52PM PDT, ID: 21520661

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080236-EE-VQP-29 / EE_QW_2_20070628