Author |
Message
|
my_mqmb |
Posted: Tue Jan 24, 2012 1:58 am Post subject: VALIDATION for Junk characters ?? |
|
|
Voyager
Joined: 08 Jun 2011 Posts: 84
|
Dear All MB experts ,
I have a requirement to validate/filter all my incoming XML and throw exceptions in case any tag has JUNK characters ..
What could be the simplest and the most efficient way?
i have to implement this in almost 100 existing services
Best brains please stand up ... |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Jan 24, 2012 2:13 am Post subject: Re: VALIDATION for Junk characters ?? |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
my_mqmb wrote: |
I have a requirement to validate/filter all my incoming XML and throw exceptions in case any tag has JUNK characters ..
|
would you care to define by what you mean JUNK Characters?
The first question you have to ask yourself is
Do I want to modify the code or can I do it in the MessageSet?
If it is the latter then you could apply an Enumeration pattern to the fields in the XSD/MessageSet. Some fields may well have character that are valid but would be regarded as JUNK in others.
This is a nice explanation as to what I mean.
Ok, it is a Pain in the Posterior to have to go through all the XSD's to apply them individually. BUT you can define what is valid/invalid for exch field if that is the granularity you desire.
[/b] _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
my_mqmb |
Posted: Tue Jan 24, 2012 2:28 am Post subject: Re: VALIDATION for Junk characters ?? |
|
|
Voyager
Joined: 08 Jun 2011 Posts: 84
|
smdavies99 wrote: |
my_mqmb wrote: |
I have a requirement to validate/filter all my incoming XML and throw exceptions in case any tag has JUNK characters ..
|
would you care to define by what you mean JUNK Characters?
The first question you have to ask yourself is
Do I want to modify the code or can I do it in the MessageSet?
If it is the latter then you could apply an Enumeration pattern to the fields in the XSD/MessageSet. Some fields may well have character that are valid but would be regarded as JUNK in others.
This is a nice explanation as to what I mean.
Ok, it is a Pain in the Posterior to have to go through all the XSD's to apply them individually. BUT you can define what is valid/invalid for exch field if that is the granularity you desire.
[/b] |
thnx mate for yr reply .. what i mean by junk characters is that sometimes due to inter-system language encoding [arabic mostly] issues we get junk instead of a valid character set..
like for example :
<Cmpny_Nm>شركÙ‡ اسواÙ‚ عبدالله اÙ„عثيÙ… ا</Cmpny_Nm>
now what might be the easiest way in ESQL for throw an exception outright ?
i guess message sets would be a pain , but a code replacement much easier ..
what say ?? |
|
Back to top |
|
 |
my_mqmb |
Posted: Tue Jan 24, 2012 2:32 am Post subject: |
|
|
Voyager
Joined: 08 Jun 2011 Posts: 84
|
also to add , we have multi language , english and arabic sometimes ...
so patter matching can also be complex in a msg set
but i do use a common flow to handle the incoming messages for all the flows .. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jan 24, 2012 3:34 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
what i mean by junk characters is that sometimes due to inter-system language encoding [arabic mostly] issues we get junk instead of a valid character set.. |
So the sender fails to set the CCSID correctly, right?
Quote: |
also to add , we have multi language , english and arabic sometimes ...
so patter matching can also be complex in a msg set |
It might be enough to find one or two elements/attributes in the input that are only allowed to take a restricted set of values. Validate those fields using a set of enumerations that includes both the English and Arabic values, and you will be able to reject documents which have been parsed using the wrong encoding.
The other fields can be declared as xs:string if you really don't care about their values, although it's best practice to create a schema that accurately describes the entire input document. |
|
Back to top |
|
 |
|