/xXSDHub

XML declaration allowed only at the start of the document

No whitespace, comments or second declaration may precede an XML declaration. Remove duplicated declarations when combining fragments and retain one document root. Check the exported bytes and encoding.

Move the declaration to the beginning

No whitespace, comments or second declaration may precede an XML declaration. Remove duplicated declarations when combining fragments and retain one document root. Check the exported bytes and encoding.

Reproduced engine diagnostics and complete fixes

Original minimal examples checked on 2 November 2026. Engine wording differs; follow the cause, not a message alone.

libxml2-wasm 0.7.2

XML declaration allowed only at the start of the document

Xerces2-J 2.12.2 / Temurin Java 21.0.13+9-LTS

The processing instruction target matching "[xX][mM][lL]" is not allowed.

lxml 6.0.2 / libxml2 2.14.6

XML declaration allowed only at the start of the document

.NET 10.0.14 / System.Xml

Unexpected XML declaration. The XML declaration must be the first node in the document, and no whitespace characters are allowed to appear before it. Line 2, position 3.

Before: fails

 
<?xml version="1.0"?><r/>
Open broken example →

After: passes

<?xml version="1.0"?><r/>
Open corrected example →

Repeat this check in your workflow

API, Python CLI and GitHub Actions starter are available for automation. The public API is early access; paid CI authentication and SLA are not offered. Pro: US$19/month, 25-file batches and 10 saved schemas. Team: US$49/month, 100-file batches, 100 schemas and five seats.