Unexpected identifier: 'ÿþ'

2.2k views Asked by At

I have a BizTalk solution which is broken down into three projects: Orchestrations, Maps and Schemas. A few of my maps, I had to build in the Orchestrations project because they needed multiple input schemas and there is no easy way that I've found to do that with just the BizTalk Mapper. Once I got them working, I moved them to my Maps project. But when I try to build that project, I get the following errors for each of the moved maps (same spot on all the maps):

Error unexpected identifier: 'ÿþ' (Line 2, Column 2)

Error unexpected token: '<' (Line 2, Column 4)

I can't find those values anywhere in the map or anywhere they're not supposed to be. I've tried saving the map in different formats, copying and pasting to a fresh document, eliminating Line 2 (which is just an automatically generated comment of when the document was created), moving the maps back to the Orchestration project, everything short of completely recreating the maps from scratch.

Has anyone seen this before and know what is going wrong?

Thanks! Stephanie

3

There are 3 answers

1
MarnixKlooster ReinstateMonica On

I have no knowledge about BizTalk. At all.

But from the above errors I deduce that there is some file which looks like this:

  • It start with an empty line (at most some whitespace).
  • Then it probably has a space as the first character of line 2.
  • Then it has bytes 0xFF and 0xFE, which is the Unicode Byte Order Marker (BOM) used in UTF-16 encoded files.
  • Then it has '<', which suggests the beginning of XML.

The intention of a BOM is to be the first two bytes of an UTF-16-encoded file.

Therefore it looks like the file is an UTF-16-encoded XML file, however with some whitespace prepended at the beginning of the file.

I have no idea about what the file format should be, nor where the whitespace was introduced, nor where this should be fixed. But perhaps this analysis helps.

2
Maxime Labelle On

As you've found out, there are no easy ways to create a map with multiple inputs or multiple outputs directly from the BizTalk Mapper. The correct way is indeed to do this from a BizTalk orchestration.

One way to do this that do not require to move the generated maps afterwards is to create an empty orchestration in your Maps project. This orchestration can be discarded when no longer needed.

If you must move maps from one project to another, however, please, pay attention to the following points :

  • Imported Schema Location
  • .Net Namespaces

Imported Schema Location

When you create a map, the location of the input and output schemas is recorded in the generated .btm file. This location, however, takes two forms, depending upon the location of the map relative to the location of the imported schemas.

If the map uses a schema that is declared in a referenced assembly, the location looks like the fully qualified name of the .net type that is generated. This is certainly the case if you have generated your maps from your Orchestrations project but it references schemas from your Schemas and Maps project.

If the map uses a schema that is declared in the same project/assembly, the location is recorded as a relative path name.

When you move your maps from one BizTalk project to another, you must restore the correct way to declare the schema locations. Open up the .btm file in a text editor and change the fully qualified name to a relative path like this:

".\imported_schema.xsd"

.Net Namespaces

Additionnaly, if you have moved your maps from one project to another, you might want to update their .Net namespace. At the time of creation, a .net namespace is associated with your map and corresponds to the one from the project it has been generated in.

You can change this namespace from from the .btmp file properties in Visual Studio Solution Explorer. This way, you will always have consistent naming across all artifacts from the same project.

0
oleschri On

Like marnix, my first response to 'ÿþ' was Unicode, too. Maybe your files were somehow saved in a different format.

Try to do the following on your working and non-working map files:

In Visual Studio

 File > Open > File ... >
 Select your map file > Open With ... (the small dropdown on the Open button) >
 Binary Editor > OK

Maybe you can spot the difference between your files.

Another try would be to open your map files in Visual Studio with

 ...(as above)... > Open With ... >
 XML Editor > OK

Then

 File > Advanced Save Options

Now see what Encoding is shown there. Maybe you only have to change the Encoding for your non-working map files here (say, from UTF-16 to UTF-8) and save them again to make BizTalk's build engine happy.