Skip to content

XMLMessages

do- edited this page Apr 21, 2026 · 10 revisions

XMLMessages is a static utility class for consistent error reporting across xml-toolkit.

It centralizes:

  • error code definitions (human-readable templates),
  • message formatting with argument substitution,
  • error object creation with debug metadata.

Error Code Vocabulary

All messages are stored in XMLMessages.VOCABULARY — a Map<code, template>.

Prefixes

Prefix Scope Example codes
XML- Core XML parsing XML-00001, XML-00002, XML-00003
XSD- XML Schema definitions XSD-00001, XSD-00002
XVC- Validation: structure/constraints XVC-00001XVC-00005
XVS- Validation: simple type values XVS-00001XVS-00041

Selected Messages

XML Parsing (XML-*)

Code Template When raised
XML-00001 maxLength=%i exceeded XMLLexer encountered a lexeme longer than maxLength option
XML-00002 Unbalanced end element </tag> without matching <tag>
XML-00003 Unmatched end element, %s expected </wrong> when </expected> was anticipated

Schema Definitions (XSD-*)

Code Template When raised
XSD-00001 Unknown namespace: %s Referenced namespace not found in loaded schemas
XSD-00002 The element %s is not found in %s Element used but not declared in schema

Structural Validation (XVC-*)

Code Template When raised
XVC-00001 No nested elements allowed inside %s Complex type with simpleContent received child elements
XVC-00002 %s is unexpected here; should be %s Element order violates xs:sequence/xs:choice
XVC-00003 Unknown attribute: %s Attribute not declared in schema
XVC-00004 The attribute "%s" must have the value "%s", not "%s" Fixed-value attribute mismatch
XVC-00005 Missing required attribute: "%s" Required attribute absent

Simple Type Validation (XVS-*)

Code Template When raised
XVS-00001 The value "%s" doesn't match the pattern %s xs:pattern facet mismatch
XVS-00003 The value '%s' is not in list: %s xs:enumeration facet mismatch
XVS-00004006 Length constraint violations xs:minLength/maxLength/length
XVS-000070010 Range constraint violations xs:minInclusive/maxExclusive etc.
XVS-0001100012 Boolean parsing errors Invalid true/false/1/0
XVS-0001300019 Decimal parsing errors Invalid format, digit count, precision
XVS-0002000021 Float parsing errors Invalid floating-point syntax
XVS-0002200041 Date/time parsing errors Invalid date, time, timezone, separators

Clone this wiki locally