ESQL : Check One of the incoming xml tag contains serialzed data

user2995546 picture user2995546 · Nov 15, 2013 · Viewed 9.9k times · Source

Need help to validate if one of the incoming XML tag contains serialized data or not. If ir doesn't contain then have to thow an user defined exception. This has to be achieved using ESQL.

example :

<input_data>
<source>ABCD</source>
<key_data>incoming serialized data</key_data>
</input_data>

here Key_data should be validated to check if it contains anything other than serialized data.

Answer

Mouli Kommineni picture Mouli Kommineni · Jul 8, 2014
IF FIELDNAME(rootTagname.*:input_data) = 'input_data' THEN

    -- do some thing as per your requirement 
ELSE

  THROW USER EXCEPTION MESSAGE 'some number' VALUES ('no value received for input_data.');

end IF;