Last active
August 29, 2015 14:14
-
-
Save prichelle/80978fe4103fadb9f310 to your computer and use it in GitHub Desktop.
inline XML parsing from BLOB using ESQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- input of this sample is a XML message <XmlCollection><Collection>3c586d6c436f6c6c65637</Collection></XmlCollection> | |
-- Collection is a XML data in hexadecimal (BLOB) representation | |
--Create an element of type parser | |
CREATE LASTCHILD OF OutputRoot DOMAIN 'XMLNSC' NAME 'XMLNSC'; | |
-- Create the root tag element of your output XML | |
CREATE LASTCHILD OF OutputRoot.XMLNSC NAME 'RootTag'; | |
DECLARE ptrCollection REFERENCE TO InputRoot.XMLNSC.XmlCollection.Collection; | |
WHILE LASTMOVE(ptrCollection) DO | |
--Parse the BLOB into XML using the PARSE function | |
CREATE LASTCHILD OF OutputRoot.XMLNSC.RootTag.RecSec PARSE(CAST(ptrCollection AS BLOB) OPTIONS FolderBitStream CCSID 1208 FORMAT 'XMLNSC'); | |
MOVE ptrCollection NEXTSIBLING; | |
END WHILE; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment