BizTalk Server debug map issue: Prefix ‘ns2’ cannot mapped to namespace reserved for “xml” or “xmlns”

A few weeks ago, while I was testing and troubleshooting a RosettaNet BizTalk Server map inside Visual Studio, I endup getting the following error:

XslLoadException
——————-
XSLT compile error.

XmlException
—————
Prefix ‘ns2’ cannot mapped to namespace reserved for “xml” or “xmlns”. Line 2, position 484.

Just to clarify, this map is a normal BizTalk Server map, but it uses a RosettaNet schema — a PIP schema — as input or output.

Cause

In some, if not all, RosettaNet PIP schemas, we must include an XML schema in the PIP for them to work and open in the Schema Editor.

However, when we try to debug a BizTalk Mapper inside Visual Studio, the Visual Studio raises this error, complaining about the prefix. We can test it, and it will provide the output of that test, but it will fail if we try to debug it.

Solution

The solution to be able to solve this limitation is a small workaround.

  • Once you first try to debug the map and it fails, it also produces the XSLT output behind the BizTalk Mapper.
  • Access the XSLT code and look for the prefix that is causing the problem. In my case, it was xmlns:ns2
    • Remove that prefix – that means remove the entire sentence: xmlns:ns2=”HTTP://www.w3.org/XML/1998/namesapce”
  • Now, within the XSLT code, from the Visual Studio menu, click Debug -> Start XSLT Debugging.

Now, you will be able to debug the map. Of course, you must do this workaround whenever you want to debug your map.

I hope you find this helpful! If you liked the content or found it useful and want to help me write more, you can buy (or help me buy) my son a Star Wars Lego! 

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

Leave a Reply

Your email address will not be published. Required fields are marked *

turbo360

Back to Top