web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :

Business Central XmlPort: Why the XML Declaration Looks Missing

Khushbu Rajvi. Profile Picture Khushbu Rajvi. 18,989 Super User 2025 Season 2

I have read this doubt somewhere: “My XmlPort is exporting XML correctly, but the header <?xml version="1.0" encoding="UTF-8"?> seems to be missing.”
At first glance, it looks like Business Central is not generating the declaration — but in reality, it’s more about how the file is viewed.

Properties of XMLPORT:

If you open the file in Edge or any other browser, you will not see the line <?xml version="1.0" encoding="UTF-8"?>.

If you open the file in Notepad, you will be able to see the <?xml version="1.0" encoding="UTF-8"?>.



🔍 Why It Looks Missing

  • When you open the XML in a browser (like Edge or Chrome), the browser parses the XML and hides the declaration, showing only the structured nodes.

  • When you open the same XML in a text editor (like Notepad), the header becomes visible because the editor shows the raw file content.

  • So the XML declaration is there, but browsers simply don’t display it.

🎯 Conclusion

Your XML is not wrong — the content is complete and valid. The declaration line may simply be hidden by the tool you use to open the file. If your integration or external system requires it, you can easily add it with a few lines of AL code in the XmlPort.


Thanks For Reading..!!😊

Regards,
Khushbu Rajvi


This was originally posted here.

Comments

*This post is locked for comments