UBL Invoice
What goes wrong in UBL Invoice
The 9 errors this corpus records against UBL Invoice documents, keyed by the message your parser printed. Nothing here is written for this page — each error declares the formats it bites, and this is that declaration read the other way round.
Start with the message you were given
Every entry below states the message our validator emits, verbatim, and a test asserts it still does. If you are holding a broken document rather than a question, XML validator will tell you which of these you have.Parse errors · 2
These stop the document being read at all. Nothing downstream sees a file with one of them, because it is not XML.
- PCDATA invalid Char value (control character)
PCDATA invalid Char value 1 (line 2)A raw control character reached element content. XML 1.0 forbids most of them, and no escaping makes them legal — they must be removed at the source. - Invalid numeric character reference
xmlParseCharRef: invalid xmlChar value 0 (line 2)A numeric character reference points at a code point XML does not allow — usually � or another control character that escaping cannot make legal.
Schema errors · 7
These appear only once a schema is applied. A document can be perfectly well-formed and fail every one of them.
- The attribute is required but missing
Element 'order': The attribute 'id' is required but missing. (line 2)The schema marks an attribute use="required" and the document does not carry it. Well-formed, and rejected by the first consumer that validates. - This element is not expected
Element 'note': This element is not expected. (line 10)An element appeared where the schema's content model does not allow one — an extra child, an unknown child, or the right children in the wrong order. - Missing child element(s)
Element 'order': Missing child element(s). Expected is ( line ). (line 2)The element ended before its content model was satisfied. The schema names what it was still waiting for, which makes this the most actionable schema error. - Not a valid value of the atomic type
Element 'issued': '31/01/2026' is not a valid value of the atomic type 'xs:date'. (line 4)The element's text does not fit its declared datatype. Dates are the usual culprit, because XSD accepts exactly one format and humans write several. - The value is not an element of the set
Element 'state': [facet 'enumeration'] The value 'pending' is not an element of the set {'open', 'closed'}. (line 5)The value is not one of the permitted options. The message lists the full set, which makes it the one schema error that tells you the answer outright. - The value is not accepted by the pattern
Element 'code': [facet 'pattern'] The value 'widget' is not accepted by the pattern '[A-Z]{2}-\d{4}'. (line 7)The value does not match the regular expression the schema constrains it with — the usual guard on SKUs, references, IBANs and postcodes. - No matching global declaration for the validation root
Element 'invoice': No matching global declaration available for the validation root. (line 2)The validator could not find the root element in the schema at all — nearly always a namespace mismatch rather than a genuinely unknown element.
Back to UBL Invoice — root element, namespaces, constraints and a worked example.
Get started
Bring order to the XML your team can't afford to ignore.
Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.