Removing Empty Tags from PIP Document

Hi All,

Is there a service or a way to remove Blank tag from generated PIP XML?
My flow service is generating PIPXML but some FreeFormText fields are set as Zero Lentgh string where the minimum is 1. It is generated cause the back document has EMPTY in it and it is creating Blank Tags in PIP XML. Is there a way to remove blank tag before sending it to partner?

Copy Condition is not an option for me at this point.



When you use the documentToXMLString (there is an option called generateRequired just set it to false or unset it)doing this XML will not show that blank tag,actually this setting is based on the PIP Schema indicates that Fields must exist in the runtime which will show blank tags.


Using the documentToXMLString with generateRequiredTags = false does not produce the results I need.


In our situation we would like no tag at all if the value is empty (i.e. phone). I could do a Copy Condition in the mapping of the values to the document. But there are a lot of fields and I am wondering if there is an easier way to replace all empty tags?



After your documentToXMLString try using a regex condition with the replace service,use

<.?><.?> as your search string, It will clean your file of empty tags.


hello again ,

I meant the pub.string:replace service with regex set to true.
and nothing as your replaceString.


Sorry to state the obvious, but the best way to deal with this is not to mapping the value in the first place. That is, use conditional mapping to copy value(s) only when they are actually available. It saves you from the performance hit of having to do documentToXMLString -> StringReplace -> xmlStringToXMLNode -> xmlNodeToDocument. Can be a factor in heavily loaded IS.

If you’re dealing with largeDocs, then you can’t even do StringReplace on the whole document. That’ll really be a phenomenal performance bottleneck.


I have many optional fields inside a documentList and while copying (mapping) from one doc to another document, the optional fields are coming as null, which i do not want. I tried copy condition, but that doesn’t work for fields inside doclist. Is there any other way i can get rid of the optional field if there is no value in the input field.
Thanks in advance.



Once your mapping is done and if you use the DocumentToXMLString there is an option for empty strings to be eleminated in the xmldata unless your DTD/Schema requires it to have just with empty tags for example: < /Emp >