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 » WMB 8.0.0.1 regular expression editor

Post new topic  Reply to topic
 WMB 8.0.0.1 regular expression editor « View previous topic :: View next topic » 
Author Message
mbsa
PostPosted: Wed Mar 20, 2013 10:00 am    Post subject: WMB 8.0.0.1 regular expression editor Reply with quote

Apprentice

Joined: 04 Mar 2013
Posts: 41

Have a date, yymmdd ,trying to create a regualr exp for dfdl that will validate this.I have tried 2d{1,20}2d{1,12}2d{1,31} .i Test 130320 and 121212 it responds not valid.Is it possible to check the data range in an expression.
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Mar 20, 2013 2:30 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Your regex is wrong in several ways. First though, some background in case others stumble across this thread in future:

If your xsd contains pattern facets on xs:string elements then IBM DFDL will validate that the value matches the pattern. The regular expression engine is a standard one, so it should work the same way in DFDL as it would for an XML document. There are several web sites that offer free regex testers, and any of them should be suitable for a simple pattern like this one.

The DFDL language does allow regular expressions to be used in other ways:
- to check whether the data stream matches a regex and if not, back out and try another branch of the model.
- to determine the length of an element's value using a regex
...but IBM's DFDL processor does not yet support these ( in WMB v8.0.0.1)

Having said all of that, you are probably going about this in the wrong way. See this thread for the reason why : http://stackoverflow.com/questions/4766845/yyyymmdd-date-format-regular-expression-to-validate-a-date-in-c-sharp-net
You would be better off changing the type of the field to xs:date and setting the Calendar Pattern property to 'yyMMdd'.
Back to top
View user's profile Send private message
mbsa
PostPosted: Thu Mar 21, 2013 7:17 am    Post subject: Reply with quote

Apprentice

Joined: 04 Mar 2013
Posts: 41

I updated the regular exp to this and verified the regualr expr and it says it match.I need YYMMDDand i an using the below regular expression
Code:


^((\d{2}((0[13578]|1[02])(0[1-9]|[12]\d|3[01])|(0[13456789]|1[012])(0[1-9]|[12]\d|30)|02(0[1-9]|1\d|2[0-8])))|([02468][048]|[13579][26])0229)$


But now the DFDL is asking for default value and i am provide the date which passed in the testing 121212.But DFDL is throwing error saying the default doest not confirm to the pattern .
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Mar 21, 2013 7:30 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

mbsa wrote:
I updated the regular exp to this and verified the regualr expr and it says it match.I need YYMMDDand i an using the below regular expression
Code:


^((\d{2}((0[13578]|1[02])(0[1-9]|[12]\d|3[01])|(0[13456789]|1[012])(0[1-9]|[12]\d|30)|02(0[1-9]|1\d|2[0-8])))|([02468][048]|[13579][26])0229)$


But now the DFDL is asking for default value and i am provide the date which passed in the testing 121212.But DFDL is throwing error saying the default doest not confirm to the pattern .


Slightly off topic, but why not adopt the advice given & use xs:date with a pattern? Seems a much more simple & easy to maintain solution, even if you get that mighty regex to work.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mbsa
PostPosted: Thu Mar 21, 2013 8:37 am    Post subject: Reply with quote

Apprentice

Joined: 04 Mar 2013
Posts: 41

I changed it as a Date and changed the pattern to yyMMdd.This pattern was not available in dfdl drop down so i typed in.Now it is failing saying
Code:

XML schema validation error ''cvc-datatype-valid.1.2: The value "121212" is not a valid value for the "date" datatype.'' on line '7' column '73' when parsing element ''/XMLNSC/http://schemas.xmlsoap.org/soap/envelope/:Envelope/http://schemas.xmlsoap.org/soap/envelope/:Body/http://GKPR_MV_30:MV3060Ops/input1/GKPR_SYSTEM_INFO/GKPR_BATCH_RELEASE_DATE''.  Internal error codes: 6000, 1.
This error was reported by the XMLNSC parser. The XML document being parsed is not valid according to the message definitions in the message set.
The XML document has violated the rules expressed in the message definition files in the message set
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Mar 21, 2013 8:39 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

That's not a DFDL error.

That's an XMLNSC error on the output.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Mar 21, 2013 6:38 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

i thought that the default for xsd:date was yyyy-mm-dd. Note the dashes
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Fri Mar 22, 2013 5:47 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:

That's not a DFDL error.

That's an XMLNSC error on the output.
Correct. You need to understand the data types that are required by the various parts of your message flow. If you want to output XML that validates against an XSD then you must make sure that the value conforms to XML Schema's rules.
However, this normally happens automatically - the XMLNSC writer will ensure that a DATE field in the message tree is written in the correct format. Your message flow must be doing something unusual.
Back to top
View user's profile Send private message
mbsa
PostPosted: Fri Mar 22, 2013 11:07 am    Post subject: Reply with quote

Apprentice

Joined: 04 Mar 2013
Posts: 41

The requirement is to use String but as eveybody suggested i tried Date format but did not work for me.
I am back to String with the pattern
\d{2}\d{2}\d{2}.I have to test the date and Month.Please suggest what i need to add to the regular expression.
Back to top
View user's profile Send private message
kimbert
PostPosted: Fri Mar 22, 2013 11:30 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
i tried Date format but did not work for me.
What do you mean by 'did not work'? You managed to get DFDL to parse your date correctly - otherwise the message would never have reached the output side of the flow. The XMLNSC error is probably easy to fix.
Quote:
I am back to String with the pattern
I think you should persist with the xs:date approach. Using xs:string is a complex and error-prone solution to a very simple problem.
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 » WMB 8.0.0.1 regular expression editor
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.