Wednesday, 24 September 2014

How to create XML parser in Informatica using XMLSpy and .dtd?


How to create XML parser in Informatica?


Let’s say you are reading an XML and want to create an XML parser transformation to parse the XML. If the XML is not very complex, then a very simple way to generate the XML parser transformation might be to use XML spy to generate the .dtd file using the XML. Steps below:

How to generate .dtd in XML spy:

1)      Go to File Menu- Open the XML file

2)      Go to DTD/Schema and click on Generate DTD/Schema. It will ask do you want to associate the dtd with the xml file? Click yes and save the dtd file.

3)      Go to XML menu- Click validate. If any issues with the DTD , it will show up when you validate the XML. For the sample xml, I was working with I had to remove one of the child item in the .dtd to make it the validation successful. You can figure it out from the message the validation process throws at you.

Once you have generated the .dtd you can go to Informatica designer-transformation menu and create xml parser transformation using the .dtd schema you just generated. If you need to make any changes to the XML view, you can use the XML Editor that you can access from the midstream XML parser tab of the XML parser.