cancel
Showing results for 
Search instead for 
Did you mean: 

Return As XML in a UDF

former_member189354
Contributor
0 Kudos

I have a requirement where I need to achieve the functionality of Return As XML for an output of UDF. UDF outputs XML in string format where I am mapping to a cloned node ( Duplicate Subtree). UDF XML Output automatically encapsulating in CDATA where I require to be return As XML. Is there anyway I can achieve this. Appreciate for your response for the same.

Thank you,

Rao

former_member190293
Active Contributor
0 Kudos

Hi Rao!

Wouldn't you please provide an example of your UDF output and your desired result structure?

Regards, Evgeniy.

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member190293
Active Contributor

Hi Rao!

You can try something like this:

UDF:

public String addSubTree(String inputTree, Container container) throws StreamTransformationException{

StructureNode node = (StructureNode)(container.getParameter("STRUCTURE_NODE"));
node.setPreValue(inputTree);

return "";

I've passed xml fragments as constants to simplify mapping. You should remove CDATA tag and xml header string from your source string and pass it as parameter to UDF.

Regards, Evgeniy.

former_member190293
Active Contributor
0 Kudos

Also remove ObjectEvent tag as well.

Regards, Evgeniy.

former_member237514
Participant
0 Kudos

Hello Evgeniy Kolmakov,

I am also facing the same issue.

Could you please help me on that.

Can you explain your udf how it will remove the [cdata ]tags in output xml.

Thanks

Kavitha

prabhudynamo
Explorer
0 Kudos

Hi Evgeniy,

This is awesome.

former_member189354
Contributor
0 Kudos

Output of UDF GetQuery is xml in string format. When I am assigning it to ObjectEvent element its getting encapsulating in CDATA. Where I want return As XML functionality. Appreciate for your response.