Blog Network Home > Informatica Way > XML Optimization through custom Properties

XML Optimization through custom Properties

by Prabhu Srinivasan on October 15, 2012 in Informatica Way

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”.

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.

XMLSendChildFirst=Yes

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:

You might want to read these awesome related posts


{ 3 comments }

1 nithin May 7, 2013 at 6:29 pm

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?

2 prabhu July 5, 2013 at 3:49 am

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

3 Arun October 8, 2013 at 2:11 pm

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.

Comments on this entry are closed.