Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > XML

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-13-2009, 10:34 AM
moschen moschen is offline
Registered User
 
Join Date: Oct 2009
Posts: 2
XSD question: using multiple restriction patterns

Hi,

I would like the content of an element to match one of two possible string patterns. How can I implement this?

Goal:
<myElement>abcd</myElement>
or
<myElement>a1b2</myElement>

Something like:
Code:
<xs:simpleType name="myElement_Type">
  <xs:restriction base="xs:string">
    <xs:choice>
    <xs:pattern value="\w\w\w\w"/>
    <xs:pattern value="\w\d\w\d"/>
    </xs:choice>
  </xs:restriction>
</xs:simpleType>
Please note, that the example is a huge simplification. In reality the pattern for each of the choices is a lot more complex.

Looking forward to receivign your comments.

Regards,Mos
Reply With Quote
  #2  
Old 10-13-2009, 11:02 AM
moschen moschen is offline
Registered User
 
Join Date: Oct 2009
Posts: 2
Oh well, sometimes it can be so easy...It seems that this will do the trick:

Code:
<xs:simpleType name="myElement_Type">
  <xs:restriction base="xs:string">
    <xs:pattern value="\w\w\w\w"/>
    <xs:pattern value="\w\d\w\d"/>
  </xs:restriction>
</xs:simpleType>
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Test question: Design patterns & Environments todavidc-temp Java 4 10-11-2005 05:48 PM
Display one record at a time! ASP learner ASP.NET 5 10-08-2002 08:17 PM
Multiple Parent/Single Child UML Modeling Question Kevin Architecture and Design 1 06-07-2002 01:48 PM
question about xsd schema ec XML 2 01-31-2002 03:24 PM
XSD question Dave Kraft XML 0 01-10-2002 10:08 AM


All times are GMT -4. The time now is 12:19 AM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.