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:CreDtTm>2021-03-05T03:30:00.000Z</ns1:CreDtTm>
<ns1:MsgRcpt>
<ns1:Nm>ABC Bank</ns1:Nm>
<ns1:PstlAdr>
<ns1:AdrTp>
<ns1:Prtry>
</ns1:Prtry>
</ns1:AdrTp>
<ns1:AdrLine>New Jersey</ns1:AdrLine>
</ns1:PstlAdr>
</ns1:MsgRcpt>
</ns1:GrpHdr>
@kumap20 can you try one of the below :
1) Use StreamXML/DetectEmptyProperties DASS as mentioned in https://community.pega.com/support/support-articles/empty-optional-xml-tags-page-list 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.