cancel
Showing results for 
Search instead for 
Did you mean: 

Unnecessary Namespace declarations

Former Member
0 Kudos

Hi,

When mapping (graphic) to an externally defined XML schema where some elements belong to different namespaces I get namespace declarations on each element in the resulting XML instance even though they refer to the same ns name. The problem is that the XML document, even though valid, is very verbose. Is there a way to get all ns declarations in the root element instead without using XSLT?

Example output

<?xml version="1.0" encoding="utf-8" ?>

<ns1:RootElement xmlns:ns1="http://foo.com">

<ns2:Element1 xmlns:ns2="http://junk.com" />

<ns2:Element2 xmlns:ns2="http://junk.com" />

<ns2:Element3 xmlns:ns2="http://junk.com" />

</ns1:RootElement>

I would like to get something like this instead:

<?xml version="1.0" encoding="utf-8" ?>

<ns1:RootElement xmlns:ns1="http://foo.com" xmlns:ns2="http://junk.com">

<ns2:Element1 />

<ns2:Element2 />

<ns2:Element3 />

</ns1:RootElement>

Kind regards Johan

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

I was probably not clear enough in my question.

My Scenario is CRM -> Xi -> External system.

The inbound interface to the external system is a predefined XML Schema where not all components/elements belong to the same namespace.

When executing a mapping, created with the graphical mapping tool in Xi, the resulting XML document/Instance is valid but very verbose since XI put namespace declarations in every element over and over again instead of just putting them once in the root element.

I don't think this has anything to do with the XSD, but rather with the mapping program.

The result is that the receiving system takes a performance hit. I would like to find a way to force XI to just declare the same ns once in the root element instead of over and over again?

kind regards Johan

Former Member
0 Kudos

Johan Göthberg,

I am not sure if I am addressing your issue...but this would help in achieving better performance....

>try to edit it in XMLSPY. there should be some way in such tools to achieve what u wanted to do.

Using a verbose XML document will hit the performance as the size of the message increases when it comes to Integration server.

So try to edit XML document manually also if it is possible.

-Naveen.

former_member206604
Active Contributor
0 Kudos

Hi Johan,

You can try adding those namespace in the XSD which is imported. If that dose'nt work as far as I know it is not possible using Graphical mapping. You need to either go for XSLT/JAVA/ABAP mapping to achieve the same.

Regards,

Prakash

Former Member
0 Kudos

Hi,

Please check this:

Regards,

Wojtek

Former Member
0 Kudos

Hi,

When you are using XML Schema, you ofen have namespace errors which you define in the XML SChema for that first you validate the XML Schema in the XML Spy then seein the result you can procceed i guess it will show the source and target namespace is not matching...

Amaresh