cancel
Showing results for 
Search instead for 
Did you mean: 

No Namespace tag in XML file

Former Member
0 Kudos

Hi

I wish to read an XML file coming from another system and then update my data base using RFC.

The problem is that the incoming file does not contain a namespace tag which XI understands

(For e.g. <ns:UpdateTablexmlns:ns="urn:BuisScenario:TEST">)

Due to which it is not reading the data contained in the file.

If I use the XML file which is generated through XI then it is working fine as it contains the relevant namespace.

But as my XML file is coming from a different system and is not generated by XI, I wish to know how can we add the namespace tag to it so that XI can understand the file. Or is there any other way in which the file can be read.

Has anybody face similar problem?

Hoping for a quick response.

Regards

Satish

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Stephan

The problem of namespace is solved now, what I did was, I followed your suggestion and I have left the field for XML Namespace in the message type empty and the scenario works. Now I am facing another problem.

My incoming XML file looks like as given below:

<Case_Details>

<Case1> <Case_EPC>1232312313313</Case_EPC> <Item_ID>PR001</Item_ID> <Quantity>50</Quantity> </Case1>

<Case2> <Case_EPC>1232312313314</Case_EPC> <Item_ID>PR002</Item_ID> <Quantity>200</Quantity> </Case2>

<Case3> <Case_EPC>1232312313315</Case_EPC> <Item_ID>PR003</Item_ID> <Quantity>520</Quantity>

</Case3>

</Case_Details>

The problem is when I duplicate the cases while testing the message mapping I do not get the desired result as the tag names are different. The mapping which I have done does not cater for Case1, Case2, Case3 coming in the incoming XML file, Instead of this only case tag comes without the numbering(1,2,3) due to which my fields are not getting populated.

The sample XML generated from my mapping is given below.

<Case_Details>

<Case> <Case_EPC>1232312313313</Case_EPC> <Item_ID>PR001</Item_ID> <Quantity>50</Quantity> </Case>

<Case> <Case_EPC>1232312313314</Case_EPC> <Item_ID>PR002</Item_ID> <Quantity>200</Quantity> </Case>

<Case> <Case_EPC>1232312313315</Case_EPC> <Item_ID>PR003</Item_ID> <Quantity>520</Quantity>

</Case>

</Case_Details>

So in this scenario the different cases do not have numbering and thus the mapping fails when the original XML file is the input.

Kindly advice what is to be done.

Regards

Satish

Former Member
0 Kudos

Hi Satish,

I fear there is no easy solution for your problem.

Indeed, defining an XML document with enumerated tag names (like <case1>, <case2>,...) is fine from the XML point of view.

However, many standards built on top of XML assume that there is a fixed set of tags that can occur within an XML document. This remark holds especially for XSD (XML Schema Definition Language) which the Mapping Tool is based on. But it also is true for other standards like DTD or XSLT.

With other words the design of the XML as you describe it is rather cumbersome, as it excludes all tools built on these standards to process the XML.

Consequently, Message Mappings as well as XSLT mappings to me are not appropriate to deal with this XML structure.

Java or ABAP mapping will not have this problem.

As a workaround, you could enter elements 'Case1', 'Case2', ...'Case25' in your Data Type (replace 25 by the maximal number of cases that realistically can occur in your scenario). But I do not really want to recommend this, as it is tedious and error-prone. You probably would have to repeat the same structure mapping for each of these tags.

Greetings

Stephan

Former Member
0 Kudos

Hi,

Why do you need this namespace tag ? Just put the standard XML document through the plain HTTP adapter for instance.

Cheers

Colin.

Former Member
0 Kudos

Hi Satish,

I am not sure whether I get you right.

I assume you have defined a Datatype in the integration repository reflecting the structure of your XML. Then you have defined a Message Type based on the Datatype.

Finally you have used this Message Type to define e.g. a Message Mapping. Then the Message Mapping does not work if the namespaces do not match.

If this assumption is correct I recommend to change the XML namespace in the definition of the Message Type. This is possible in XI 3.0.

Unfortunately, in this case you will probably have to redefine your mapping.

Greetings

Stephan

udo_martens
Active Contributor
0 Kudos

Hi Satish,

XI should be able to read any xml.

Do you use the file-adapter?

What do you see in SXMB_MONI?

Regards Udo