ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » XSD validation

Post new topic  Reply to topic
 XSD validation « View previous topic :: View next topic » 
Author Message
samchenchu
PostPosted: Thu Aug 29, 2013 10:51 pm    Post subject: XSD validation Reply with quote

Novice

Joined: 13 Aug 2013
Posts: 22

Hi Friends,

In my XSD one attribute has the pattern value as below.

<xs:attribute name="ItemNumber" use="required">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:pattern value="^.{1,9}$" />
<xs:minInclusive value="0" />
<xs:maxInclusive value="999999999" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>

In my code I am sending "6715126" value to the ItemNumber.This item number is valid as per pattern.
while validating with XSD its giving below exception "cvc-pattern-valid: The value "6715126" is not valid with respect to the pattern facet for type "#Anonymous"."
javascript:emoticon('')
Back to top
View user's profile Send private message
darioo
PostPosted: Fri Aug 30, 2013 12:59 am    Post subject: Reply with quote

Novice

Joined: 19 Mar 2009
Posts: 15

This is the source of your problems:

Code:
<xs:pattern value="^.{1,9}$" />


Since you've already specified that "xs:integer" is the desired type, your regex is redundant. Oh, and it's wrong.

Not every language defines and implements regular expressions the same way. For example, in XSD, "^" doesn't mean "start of line", it just negates whatever comes after it. Also, "$" isn't used.

Using

Code:
<xs:pattern value=".{1,9}" />


would be fine, but once again, it's redundant (and slower) since you've already specified that it's an integer and that the minimum inclusive value is 0, while the maximum inclusive value is 999999999.

The solution: get rid of

Code:
 <xs:pattern value="^.{1,9}$" />


and you should be fine.
Back to top
View user's profile Send private message
samchenchu
PostPosted: Fri Aug 30, 2013 2:18 am    Post subject: Reply with quote

Novice

Joined: 13 Aug 2013
Posts: 22

Thank you..Its working
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » XSD validation
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.