How to remove empty tags in streamed XML?

Hi All,

In my stream XML rules, all the elements are marked as optional.

But, due to business UI requirement, we had to initialize all the page properties before loading the UI.

Due to this, although the empty scalar properties are not generated in output xml string ( via Property-Set-XML) , the complex elements (page/page lists) are still present ,since they are present on clipboard.

Is there any way to remove these XML tags after generation? OOT/Java probably?

In below example, highlighted tags shall be removed:

ns1:GrpHdr
ns1:CreDtTm2021-03-05T03:30:00.000Z</ns1:CreDtTm>
ns1:MsgRcpt
ns1:NmABC Bank</ns1:Nm>
ns1:PstlAdr
ns1:AdrTp
ns1:Prtry
</ns1:Prtry>
</ns1:AdrTp>
ns1:AdrLineNew Jersey</ns1:AdrLine>
</ns1:PstlAdr>
</ns1:MsgRcpt>
</ns1:GrpHdr>

Any help would be appreciated.

@kumap20 can you try one of the below :

  1. Use StreamXML/DetectEmptyProperties DASS as mentioned in Empty optional XML tags from page list | Pega which is a design time switch, meaning you will have to resave the corresponding Stream XML rule to apply changes to this DASS setting.

  2. Use tools.getServiceUtils().removeEmptyPropertiesFromPage(myStepPage); API to remove empty pages/pagelists before executing Property-Set-XML.

@ChandraSekharBk Thanks a lot for your response!

Option 1 was already in place, and worked fine for scalar properties but, since pages were there, their tags were getting created.

I tried option 2, and it seems to be working to a good extent. As of initial testing, the empty pages are actually removed.

Meanwhile, since messages are huge, I will get it tested and get back here :slight_smile: