XML Optimization through custom Properties

Posted by Prabhu Srinivasan
Comments (3)
October 15th, 2012

1. Problem Statement:

I am creating a XML file as an output . If my source is empty, is there a way to  avoid the creation of an empty XML file?

Sample output Data with source data :

Case 1 : Empty Source – Creation of Minimal XML file

We have to set the following properties of an XML Target at session level under the Mapping tab.

Null Content Representation – “No Tag”

Empty String Content Representation – “No Tag”

Null Attribute Representation – “No Attribute”

Empty String Attribute Representation – “No attribute”

The Output file is as follows

Note: It generates the minimal XML and parent tag. The parent tags are shown as Unary Tag in the browser.

Case 2:  Creation of Zero Byte XML file.

Even though setting all the above property you will get an empty XML file with no data or only with parent tags. If downstream system Like MFT (Managed File Transfer) consumes this garbage file, you will end up with errors while processing.  To avoid these kinds of errors we have to set two custom properties in the Integration Service:

WriteNullXMLFile = No

The WriteNullXMLFile custom property skips creating an XML file when the XML Generator transformation or Target doesn’t receive data . The Default value for this parameter is Yes and. if you set No , the minimal XML document will not be generated and the target XML file size will be of zero byte.

2) Suppress the Empty Parent Tag

A PowerCenter session with an XML target writes empty parent tags to the XML file when all child elements are null.  This may occur even when the Null Content Representation option is set to No Tag in the session properties.

SuppressNilContentMethod = ByTree

The SuppressNilContentMethod server parameter will suppress the parent tags as well as the child tags when all the child elements are null. To achieve this, set the custom property to “ByTree”.


The ByTree flag suppresses non-leaf elements up to (but not including) the document root, when the entire element chain originating at the specified element contains no data. ByTree flag is always optimal.

For example the Street1 and Street2 values are empty, without setting the property you will get the below output with Street Unary tag:

If you set the Property SuppressNilContentMethod = ByTree the entire Street tag will be vanished.

3) To reduce the Session log size while using XML as Target

XMLWarnDupRows =No

By default; it is Yes, the Informatica Server writes duplicate row warnings and duplicate rows for

XML targets to the session log.

4 ) To reduce the cache file size created by XML target and increase the performance of reading large XML files.


How to set the Custom Properties?

Infa 8.x and Above

1. Connect to the Administration Console

2. Stop the Integration Service

3. Select the Integration Service

4. Under the Properties tab, click Edit in the Custom Properties section

5. Under Name enter WriteNullXMLFile = No

6. Under Value enter No

7. Under Name enter SuppressNilContentMethod

8. Under Value enter ByTree

9. Click OK

10. Restart the Integration Service

Starting with PowerCenter 8.5, this change could be done at the session task itself as follows:

These custom properties would override the DI service level properties.

1. Edit the session

2. Select Config Object tab

3. Under Custom Properties add the attribute WriteNullXMLFile=No and SuppressNilContentMethod=ByTree

4. Save the session

Session Properties:

Comments (3)

Arun - October 8th, 2013

Hi all, I have a question on Informatica Target XML load order. When we load to Target XML, Informatica treats each group as separate target and loads them in it's own order. Is there any session or custom property to tell Informatica to load the different groups from root group to child group instead of loading as it's own way? Thanks a lot in advance for your thoughts.

prabhu - July 5th, 2013

Hi Nithin , First create the target instance using client provided XSD. To know step by step process of importing the XML/XSD refer “getting started guide –Chapter 6 “ in Informatica help file. In your mapping you are creating the target as flat file. Change the mapping as below. Src RDBMS ->SQ -> Target as XSD/XML Thanks, Prabhu

nithin - May 7th, 2013

Hello Prabhu, First of all it is a really a great article on xml optimization I am having an issue while generating the xml file. I created the xml file from the xsd which client provided me used that one in the xml generator transformation My requirement is to create a xml file from a relational table(oracle). I tried this logic Source --->sq---->xml generator transformation ----->flatfile problem is it reads the data from the source and in the output i get like this number of records in source = 87 k number of records generated in flat file = 87 k exactly the same as source only thing is I get the output like which i have mentioned above. Can you advise me where am i going wrong?

Comments are closed.