Validate XML string against XSD
validate_xml_against_schemaValidate raw pain.001 or pain.008 XML string against official XSD to check compliance before processing.
Instructions
Validate a raw pain.001 / pain.008 XML string against its official XSD.
Use this to check XML you already have as a string (e.g. received from
another system) without touching the filesystem. To validate records
*before* they become XML, use ``validate_records``; to parse a statement
or status-report file, use ``parse_camt053`` / ``parse_pain002``.
Wraps :func:`pain001.xml.validate_via_xsd.validate_xml_string_via_xsd`.
Args:
xml_content: The XML document as a string.
message_type: A supported ISO 20022 pain message type.
Returns:
``{"valid": bool, "message_type": str, "error": str?}`` -
``error`` is present only when ``valid`` is ``False``.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| xml_content | Yes | The full pain.001 / pain.008 XML document as a string, validated against the message type's official XSD. | |
| message_type | Yes | A supported ISO 20022 pain message type. Must be exactly one of: 'pain.001.001.03', 'pain.001.001.04', 'pain.001.001.05', 'pain.001.001.06', 'pain.001.001.07', 'pain.001.001.08', 'pain.001.001.09', 'pain.001.001.10', 'pain.001.001.11', 'pain.001.001.12', 'pain.008.001.02' (see list_message_types). |