BizTalk Schemas – Unexpected XML declaration. The XML declaration must be the first node in the document, and no white space characters are allowed to appear before it

Posted: October 10, 2010  |  Categories: BizTalk Schemas

Today I found an error in MSDN forum that I encountered and suffered with him in the past:

“Unexpected XML declaration. The XML declaration must be the first node in the document, and no white space characters are allowed to appear before it. Line 1, position 4.”

Cause

  • You have a single whitespace character on the first line of your schema before the start of the XML declaration.

Or

  • You have a single whitespace character on the first line of your XML file before the start of the XML declaration.

Solution 1

  • Open your XSD file in Notepad and remove the character, save and then re-validate- the problem should go away.

Solution 2

  • When using XML file you must start declaration in the first row with <?xml version=”1.0″ encoding=”UTF-8″ ?> right away. No space is allowed in the beginning of the xml file.

Tags: BizTalk | Schemas | Errors and Warnings, Causes and Solutions

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.

2 thoughts on “BizTalk Schemas – Unexpected XML declaration. The XML declaration must be the first node in the document, and no white space characters are allowed to appear before it”

  1. I am facing this issue while calling a WCF service. surprisingly the message states Line(44,9) or Line(46,9) when the request is not more than 26 lines. I am still clueless. Can anyone share their experience

Leave a Reply

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

BizTalk360
BizTalk Server

Over 500+ customers across
30+ countries depend on BizTalk360

Learn More
Serverless360
Azure

Manage and monitor serverless
components effortlessly

Learn More
Atomicscope
Business Users

Monitor your Business Activity in iPaaS
or Hybrid integration solutions

Learn More

Back to Top