Biztalk mapping with namespace prefix

2k views Asked by At

I got a requirement to produce an output messages with namespace prefix on all nodes.

Could someone please help me?

My problem is that after mapping in BizTalk, the output message has inline namespace.

For example, I expect:

<ns0:root xmlns:ns0="http://www.domain1.com" xmlns:domain2="http://www.domain2.com">
    <domain2:element1>abc</domain2:element1>
    <ns0:element2>abc</ns0:element2>
</ns0:root>

But it was:

<root xmlns="http://www.domain1.com">
    <element1 xmlns="http://www.domain2.com">abc</element1>
    <element2 xmlns="http://www.domain1.com">abc</element2>
</root>

The namespace aliases ns0, domain2 are not important to me.

3

There are 3 answers

3
Vikas Bhardwaj On BEST ANSWER

Both of these Xml are same, it does not matter if prefix is used or not as good as Xml elements belong to the namespace as per defined scheme. Its not a valid requirement to request xml with specific prefix. Even if you need to do it, use custom Xslt.

2
Dan Field On

Set the ElementFormDefault property on the target schema to Qualified:

Qualified Property

This property can be viewed by clicking on the <Schema> node in the tree for the schema in question; note it's a change to the schema, not being done in the map (despite what the image might look like):

Schema node

0
mahieddine On

There are many legacy parsers that rely on ns prefix. Even if it's the same thing. the solution here is to set your schema to XML type and you will have your namespace, if you have a flat file schema you have to as mentioned by Dan Field set your ElementFormDefault to Qualified, and write what you want in XSLT