|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
CREATE ... PARSE XML Validation |
« View previous topic :: View next topic » |
Author |
Message
|
fabyos |
Posted: Tue Jun 02, 2009 5:11 am Post subject: |
|
|
Apprentice
Joined: 15 May 2009 Posts: 37
|
ok, continuing..
I've already validated the message with validation property from Compute Node and it throws the correct exception that is caught and saved with trace node...
I've changed the short value to 'a', 'xpto' and etc... and it pass!
There is another invalid data for date which is written in the format yyyy-mm-ddThh:mm:ssZZZ. With MRM the validation only accept with a unique Z terminal.
@fjb_saper
I've already tried to use
Code: |
CREATE LASTCHILD OF OutputRoot.XMLNSC DOMAIN ... |
and it didnt work too.. |
|
Back to top |
|
 |
fabyos |
Posted: Tue Jun 02, 2009 10:16 am Post subject: |
|
|
Apprentice
Joined: 15 May 2009 Posts: 37
|
Hi, I finally made it!
I dont know if there is anymore concerns to be defined, but this simple code works.
Code: |
DECLARE ccsidCode INTEGER InputRoot.Properties.CodedCharSetId;
DECLARE parseOptions INTEGER BITOR(ValidateContentAndValue, ValidateException);
DECLARE xmlAsBlob BLOB CAST(xml AS BLOB CCSID ccsidCode);
CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNSC') PARSE(
xmlAsBlob
OPTIONS parseOptions
ENCODING InputRoot.Properties.Encoding
CCSID ccsidCode
SET 'My_Message_Set');
|
The key point here, that differs from my previous code was the addition of ValidateException.
What I've read is that ValidateException is a default value, if NO options is passed. However, when I was passing ValidateContentAndValue directly it wasnt setted to throw the first exception that it meets, because the bitmask changed and that ValidateExceptions isnt setted... only ValidateContentAndValue...
Actually, I only figure out when I setted ValidateExceptionList, which runs completelly and register all exceptions founded, and finishes with a error number 2030 which is the write code error, due to the past exceptions...
Thanks for all that helped me to solve this... |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jun 03, 2009 12:34 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Great news!
Many thanks for your patience and persistence - many people would have given up and raised a PMR. I'll make sure that this gets investigated. |
|
Back to top |
|
 |
fabyos |
Posted: Fri Jun 05, 2009 10:20 am Post subject: |
|
|
Apprentice
Joined: 15 May 2009 Posts: 37
|
Sorry, it was a false positive..
But I discovered that if I parse a VARCHAR/CHAR value to create a tree for OutputRoot it only validaes the XML syntax (I think), which is the tag names, unclosed tags, things which is used to create the tree properly.
The ValidateContentAndValue property do not affect the result produced on the tree... the OutputRoot.XMLNSC is generated without error, even if the value of the element is incorrect...
But, if you use the ASBITSTREAM function, the validation is done correctly, but it is valid only to tree object references... which means, only InputRoot and OutputRoot, or any of its childs...
There is an impact on doing this to validate the tree instead of using the property from compute node? the result is the same?
Why would I use the bitstream?
What I know about bitstream is that the flow reads the messages on this way, in order to produce the inputroot, am I correct?
So, the out of a ComputNote is related to the OutputRoot, correct? |
|
Back to top |
|
 |
fabyos |
Posted: Tue Jun 23, 2009 11:51 am Post subject: |
|
|
Apprentice
Joined: 15 May 2009 Posts: 37
|
Just to close this topic, its possible to validating when parsing. After a lot of tests I realized what was missing. Actually, I discovered this after I migrated to MRM, due to some problems that I have.
Code: |
DECLARE ccsidCode INTEGER InputRoot.Properties.CodedCharSetId;
DECLARE parseOptions INTEGER BITOR(ValidateContentAndValue, ValidateException, ValidateComplete);
DECLARE xmlAsBlob BLOB CAST(xml AS BLOB CCSID ccsidCode);
CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNSC') PARSE(
xmlAsBlob
OPTIONS parseOptions
ENCODING InputRoot.Properties.Encoding
CCSID ccsidCode
SET 'My_Message_Set'); |
The point here is that the ValidateComplete or ValidateImmediate wasnt setted. I think that the default is partial parsing (on demand), and since I was just trying to validate the message, without using the tree, no exception is throw (there is no meaning to throw an exception if its never used, which makes sense)...
When setted to immediate or complete it parses and validate at that moment, and if occurs a problem it is throw.
On my previous post I mentioned that I when using ASBITSTREAM function after the parsing it was validating, that happens because I was using the tree parsed...
Now this topic is really close and I think that this will help a lot of people.
This is valid for MRM and XMLNSC... |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jun 23, 2009 12:46 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Many thanks - I should have spotted that before. |
|
Back to top |
|
 |
deepak_paul |
Posted: Thu Sep 22, 2011 8:34 am Post subject: |
|
|
Centurion
Joined: 04 Oct 2008 Posts: 147 Location: US
|
This is a very good thread with helpful info on the validation in ESQL.
Just to add few more info. Below is the set of actual values for validate options captured in user trace.
Quote: |
2011-09-22 10:26:25.418712 21060 UserTrace BIP2539I: Node 'Validate.Compute': Evaluating expression ''ValidateContentAndValue'' at ('.Validate_Compute.Main', '28.36'). This resolved to ''ValidateContentAndValue''. The result was ''12288''.
2011-09-22 10:26:25.418722 21060 UserTrace BIP2539I: Node 'Validate.Compute': Evaluating expression ''ValidateValue'' at ('.Validate_Compute.Main', '28.61'). This resolved to ''ValidateValue''. The result was ''8192''.
2011-09-22 10:26:25.418734 21060 UserTrace BIP2539I: Node 'Validate.Compute': Evaluating expression ''ValidateContent'' at ('.Validate_Compute.Main', '28.76'). This resolved to ''ValidateContent''. The result was ''4096''.
2011-09-22 10:26:25.418742 21060 UserTrace BIP2539I: Node 'Validate.Compute': Evaluating expression ''ValidateNone'' at ('.Validate_Compute.Main', '28.93'). This resolved to ''ValidateNone''. The result was ''0''.
2011-09-22 10:26:25.418750 21060 UserTrace BIP2539I: Node 'Validate.Compute': Evaluating expression ''ValidateExceptionList'' at ('.Validate_Compute.Main', '28.107'). This resolved to ''ValidateExceptionList''. The result was ''3072''.
2011-09-22 10:26:25.418760 21060 UserTrace BIP2539I: Node 'Validate.Compute': Evaluating expression ''ValidateLocalError'' at ('.Validate_Compute.Main', '28.130'). This resolved to ''ValidateLocalError''. The result was ''1024''.
2011-09-22 10:26:25.418770 21060 UserTrace BIP2539I: Node 'Validate.Compute': Evaluating expression ''ValidateUserTrace'' at ('.Validate_Compute.Main', '28.150'). This resolved to ''ValidateUserTrace''. The result was ''0''.
2011-09-22 10:26:25.418782 21060 UserTrace BIP2539I: Node 'Validate.Compute': Evaluating expression ''ValidateBasicConstraints'' at ('.Validate_Compute.Main', '28.169'). This resolved to ''ValidateBasicConstraints''. The result was ''0''.
2011-09-22 10:26:25.418792 21060 UserTrace BIP2539I: Node 'Validate.Compute': Evaluating expression ''ValidateException'' at ('.Validate_Compute.Main', '28.194'). This resolved to ''ValidateException''. The result was ''2048''.
2011-09-22 10:26:25.418804 21060 UserTrace BIP2539I: Node 'Validate.Compute': Evaluating expression ''ValidateDeferred'' at ('.Validate_Compute.Main', '28.212'). This resolved to ''ValidateDeferred''. The result was ''0''.
2011-09-22 10:26:25.418814 21060 UserTrace BIP2539I: Node 'Validate.Compute': Evaluating expression ''ValidateComplete'' at ('.Validate_Compute.Main', '28.229'). This resolved to ''ValidateComplete''. The result was ''512''.
2011-09-22 10:26:25.418830 21060 UserTrace BIP2539I: Node 'Validate.Compute': Evaluating expression ''ValidateImmediate'' at ('.Validate_Compute.Main', '28.247'). This resolved to ''ValidateImmediate''. The result was ''256''.
|
I believe these values are derived as below. Please correct me if this is wrong.
Code: |
1111110000000
||||||
||||||
||||||____>> ValidateImmediate
|||||_____>> ValidateComplete
||||______>> ValidateLocalError
|||_______>> ValidateException
||________>> ValidateContent
|_________>> ValidateValue
ValidateContentAndValue = ValidateContent BITOR ValidateValue
ValidateExceptionList = ValidateLocalError BITOR ValidateException
|
WMB v7.0 Infocentre link:
http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/topic/com.ibm.etools.mft.doc/ak04950_.htm
Thank you. _________________ Regards
Paul |
|
Back to top |
|
 |
|
|
|
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
|
|
|
|