Thursday, February 10, 2011

BizTalk XML Schema - Invalid type name

In many cases when developing a BizTalk app in Visual Studio, you'll get an existing schema from some other sytem/source. When validating it, you may get an error "Invalid type name." as shown below.


Just recently, I've come across this. Double-click on the error within the Error List box and Visual Studio should take you to the offending record within the schema pane.

From there, take a look at the properties window, and you will see something similar to the below image.


When you build a BizTalk solution, the schema compiles a into C# object. The .Net framework doesn't allow the "-" within TypeNames because the "-" is reserved.

The solution is to change the RootNode Typename to have something other than a "-". In my case, I changed the "-" to an underscore "_".

You need to leave the Node Name alone, since this part is what will validate the schema against the actual XML document.