cancel
Showing results for 
Search instead for 
Did you mean: 

How to read XML and map it to target message?

Former Member
0 Kudos

Hi Experts,

I have been thinking this since long that how XI will read XML file and map it to target message? The scenario is File to File. The source file is in XML format given by third party. I want to convert this file in some other XML format and put it in the target filesystem. Third party has given only XML file and they do not have XSD for it.

The file Structure contains around 24 segments. So for test we can think of below structure.

<R>

<MR1/>

<MR2/>

<MR3/>

<MR4/>

</R>

<Q>

<MQ1/>

<MQ2/>

</Q>

I am not concerned about mapping. Please tell me how should I create IR part for the source message and in runtime how will it work. We need to keep in mind that hird party can not make any changes to its XML file and we also need to follow our XI/PI naming conventions.

Had this been the simple text file, I would have specified this structure manually in IR and used the FileContentConversion to convert plain text to XML. But since we are directly getting XML, how should we create DT and MT for it?

Please revert if I am not clear.

Br,

Nilz

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

>>> I would have specified this structure manually in IR and used the FileContentConversion to convert plain text to XML. But since we are directly getting XML, how should we create DT and MT for it?

Procedure is same even if you get text file or XML file. If third party is not providing any xsd then you have to create the DT & MT manually. Only the difference is in case of txt you have to do FCC and in case of XML you don't.

--Sarvesh

Former Member
0 Kudos

Thank you Suraj and Sarvesh. If I will create my DT and MT manually, I would follow XI naming convention i.e. the format would be

<MT_MTRREAD>

<Structure Pasted in Original Question>

</MT_MTRREAD>

But the third party can not change their XML file and add root nodes <MT_MTRREAD> and also the namespace which we give in XI.

In that case, the file structure would be different than what is being sent. Ii will not work in runtime? Correct? What is the workaround?

Br,

Nilz

former_member200962
Active Contributor
0 Kudos

Following naming convention in XI is a good practice....not a forced practice!

develop your DT, MT with root nodes as they appear in your customer-provided file.

Regards,

Abhishek.

former_member187339
Active Contributor
0 Kudos

Hi,

>>. Ii will not work in runtime? Correct? What is the workaround?

Yes correct.

Alternative will be to use the structure as a External Definition (ED), so that the structure will be same, but the ED name will be according to naming convention

Regards

Suraj

Former Member
0 Kudos

Don' worry abt namespace it can be taken care. If you don't want the namspace then simply delete it from your target Message Type from 'XML Namespace'.

As abhishek said is correct you can create DT & MT without naming conventions But one thing that you have to keep in mind is you to take care of CASE. So create the tags as per the case sensitivness given in your source xml.

--Sarvesh

Former Member
0 Kudos

Thank you all for the response. So that means, in any case I will need to create XSD myself.

To keep naming conventions in place, I can import it as External Definition. Else it can be a Normal DT MT object. About NameSpace problem, I can remove namespace from MT.

At runtime will it create any issues if I will not give namespace? In ID, Receiver Determination, Interface Determination, Sender Agreement would be without namespace? Am I right?

Br,

Nilz

former_member187339
Active Contributor
0 Kudos

Hi Niz,

>>At runtime will it create any issues if I will not give namespace? In ID, Receiver Determination, Interface Determination, Sender Agreement would be without namespace? Am I right?

Did you meant binding the namespace with External definition or MT. If yes, then this will not create any problem in ID

and all your other objects :

1. Target DT, MT, MI

2. Source MI and external Definition

3. Message and Interface Mapping

will have their own namespaces.

Regards

Suraj

Former Member
0 Kudos

In ID you have to provide the namespace otherwise it will not recoginze your interface properly. As I mentioned before if you don't want the name space in your target side then simply remove it from your MT only.

--Sarvesh

Former Member
0 Kudos

Hi Suraj,

I am keeping this question open and will try one test scenario. If it works fine, I will close it and award the points for all useful answers.

Thank you for the support.

Br,

Nilz

Former Member
0 Kudos

Hi Sarvesh,

I am not worrying about the namespace on target side. While creating Sender MT, I do not want to give namespace because the Source File does not contain any namespace. Does this create any problem? And will it work?

I will create sender DT/MT Structure as per the Source File. The MT name will be the name of the root element from the source file. But we will need to keep in mind that the Source File will not have any namespace as well. And having NS in MT will create problem? Isnt it?

br,

Nilz

former_member187339
Active Contributor
0 Kudos

Hi Nilz,

>>I will create sender DT/MT Structure as per the Source File. The MT name will be the name of the root element from the source file. But we will need to keep in mind that the Source File will not have any namespace as well. And having NS in MT will create problem? Isnt it?

If you create DT and MT for Source side

1. you might not be adhering for Naming convention.

2. To remove XML Namepsace from the structure keep the XML Namespace enty in MT as blank.

Regards

Suraj

former_member200962
Active Contributor
0 Kudos

absence of the prefix ns wont cause any harm.

Removing the namespace reference from the Message Type (in IR) will solve the problem of namespace not occuring.

Just the element names and structure (hierarchy) should be maintained.

1. you might not be adhering for Naming convention.

Adhering to naming convention is nowhere specified as compulsory......ultimately the development is to be created keeping in mind the runtime data and business needs.

Regards,

Abhishek.

Edited by: abhishek salvi on Sep 1, 2009 4:44 PM

Former Member
0 Kudos

> I am not worrying about the namespace on target side. While creating Sender MT, I do not want to give namespace because the Source File does not contain any namespace. Does this create any problem? And will it work?

No it will not create any problems at all and it will work. Simply delete the namespace from both source ans target MT.

> I will create sender DT/MT Structure as per the Source File. The MT name will be the name of the root element from the source file. But we will need to keep in mind that the Source File will not have any namespace as well. And having NS in MT will create problem? Isnt it?

As soon as you will remove the namespace from your MT, NS will disappier from your source automatically. Just confirm this out in your MM under test tab by pressing the SRC button.

--Sarvesh

former_member187339
Active Contributor
0 Kudos

Hi Niz,

As mentioned by Krish, there is only two option:

1. Create teh structure yourself (DT, MT)

2. else create XSD from XML. You can use this online link http://www.flame-ware.com/products/xml-2-xsd/. This is not as simple as it looks, since after you make the XSD you need to be able to import it into XI. Before that I will suggest you to use XMLSpy and validate your XSD. Once all minute changes are doen you can import the structure as an external definition in XI.

Regards

Suraj

Former Member
0 Kudos

Hi,

Because the third party has not given you the XSD, you need to generate it one using tools like XMLSPY and other XSD generator tools.

It would be rather difficult to upload the source without XSD.

Regards

Krish

Former Member
0 Kudos

Hi Krish,

But in that case, how will you create XSD for above structure?

Br,

Nilesh

rajasekhar_reddy14
Active Contributor
0 Kudos

how to conver XSD??

its very simple ...

answer here

download XML spy (search in google 30 days free taril available dowload it).then sleect new in XML spy and paste your XML file , then go to DTD/SHEMA in XML spy tab,then select genarate XSD .

if you want to chnage occurace , the edit XSD add minoccurs max occurs.

cheers,

raj