I am experimenting with using XMLELEMENT, XMLFOREST, and XMLSERIALIZE to build XML in SQLRPGLE
What I would like to do, is instead of having one huge monolithic SQL Statement, is build the XML in chunks stored in host variables, and stitch them together later
But I cannot work out how to add one chunk of XML into another For example:
If :var2 is a char data type, it is parsed as a plain string, not as XML:
I cannot see a way of telling XMLFOREST/XMLELEMENT that this is parsed XML to append, rather than a regular string
Is there a way to accomplish what I want to accomplish?
What I would like to do, is instead of having one huge monolithic SQL Statement, is build the XML in chunks stored in host variables, and stitch them together later
But I cannot work out how to add one chunk of XML into another For example:
Code:
// var1 host var is a varchar containing: 'ABCD'; // var2 host var contains pre-built XML in whatever data type would make this work: '<var2subtag>DEFG</var2subtag>' xmlforest(:var1 as "somename", :var2 as "subXML") // Desired outcome (indented for legibility): // // <somename>ABCD</somename> // <subXML> // <var2subtag>DEFG</var2subtag> // </subXML> //
Code:
// <somename>ABCD</somename> // <subXML>>var2subtag<DEFG>/var2subtag<</subXML>
Is there a way to accomplish what I want to accomplish?
Comment