Author |
Message
|
abhyyy |
Posted: Wed Jan 18, 2012 8:03 pm Post subject: Limit length of field in delimiter based message set parsing |
|
|
Voyager
Joined: 29 Sep 2011 Posts: 83
|
Hi Friends,
I created a Message set in MRM domain for parsing elimited input message (delimeter is '|') and mentioned Lengths for different tags inproperties tab.
Problem : Even if I declare a tag as datatype "String" and set max length in its properties as 50. When I put string of 80 chars for that tag at the input message it still gets through which it shouldn't.
Question : Can we parse a message using a delimeter but still can restrict the length of delimited fields to the length we want. If yes, How? If No, Is their any workaround to solve this problem?
Thanks alot. _________________ ----------------------
NeVeR StOp LeaRnInG. |
|
Back to top |
|
 |
kash3338 |
Posted: Wed Jan 18, 2012 8:16 pm Post subject: Re: Limit length of field in delimiter based message set par |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
abhyyy wrote: |
Question : Can we parse a message using a delimeter but still can restrict the length of delimited fields to the length we want. If yes, How? If No, Is their any workaround to solve this problem?
Thanks alot. |
Is'nt it contradictory? When you have delimiter, then the application which sends you the message should make sure they place the delimiter at the right place, else the message becomes incorrect. |
|
Back to top |
|
 |
abhyyy |
Posted: Wed Jan 18, 2012 9:25 pm Post subject: |
|
|
Voyager
Joined: 29 Sep 2011 Posts: 83
|
They are placing it at the right place as of now. I'm trying to validate the input received from them at my end and handle the parsing error if in case they dont.
Is there a way to do that? _________________ ----------------------
NeVeR StOp LeaRnInG. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jan 18, 2012 9:33 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
abhyyy wrote: |
They are placing it at the right place as of now. I'm trying to validate the input received from them at my end and handle the parsing error if in case they don't.
Is there a way to do that? |
This is going to be way more difficult than you ever imagined.
You just simply cannot account for all parsing errors individually... and still make sense of the incoming message...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jan 19, 2012 3:53 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Even if I declare a tag as datatype "String" and set max length in its properties as 50. When I put string of 80 chars for that tag at the input message it still gets through which it shouldn't. |
Yes, it should - sometimes. The length restriction is an XML Schema facet on the simple type of the element. The MRM parser does not check these 'Value Constraints' unless you switch on validation in your message flow.
Quote: |
Can we parse a message using a delimeter but still can restrict the length of delimited fields to the length we want. If yes, How? |
Yes - set Validation to 'Content and Value' on the input node.
To explain this another way - the default behaviour of the MRM TDS parser is to parse the physical format and check that it is 'well-formed'. This default behaviour is very similar to the default behaviour of an XML parser.
If you switch on validation then the MRM parser behaves like a validating XML parser ( except that it is not parsing XML ). It checks minOccurs and maxOccurs and checks the simple values against any facets ( Value Constraints ) in the xsd. |
|
Back to top |
|
 |
whydieanut |
Posted: Wed Apr 04, 2012 12:45 am Post subject: |
|
|
 Disciple
Joined: 02 Apr 2010 Posts: 186
|
I couldn't get the input node to validate length restrictions (even by turning validation on).
But a Validate node after the input node did the trick.
Had to use Simple Type Restrictions for the fields though. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Apr 04, 2012 4:56 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I couldn't get the input node to validate length restrictions (even by turning validation on). |
You were doing something wrong - trust me on this. There is absolutely no difference at all between the validation performed by a Validate node and the validation performed by an Input node. However...
I suspect that you forgot to change 'Parse Timing' from its default value of 'On Demand'. A lot of people do that. If I'm right then you should remove the Validate node, set 'Parse Timing' to 'Immediate' and change your flow to use validation on the Input node - you don't want spurious complexity in your flow. |
|
Back to top |
|
 |
whydieanut |
Posted: Sun Apr 08, 2012 10:27 pm Post subject: |
|
|
 Disciple
Joined: 02 Apr 2010 Posts: 186
|
I'll recheck, though I had set all those options.
The only thing that strikes me is that I am using the MRM domain, and I remember reading that the behaviour of the validation (using XSD facets) is slightly different for MRM domain. |
|
Back to top |
|
 |
whydieanut |
Posted: Mon Apr 09, 2012 2:48 am Post subject: |
|
|
 Disciple
Joined: 02 Apr 2010 Posts: 186
|
My bad
Clearing the bar file did the job...
No need for the Validate node... Thanks Kimbert! |
|
Back to top |
|
 |
|