Validate well-formed XML for record content

This commit is contained in:
Sebastian Meyer 2024-01-08 19:47:48 +01:00
parent 2dc049a1cf
commit c0321ab38d
1 changed files with 2 additions and 2 deletions

View File

@ -249,11 +249,11 @@ class Record
$xml, $xml,
[ [
new Assert\Type('string'), new Assert\Type('string'),
// TODO: Validate well-formed XML.
new Assert\NotBlank() new Assert\NotBlank()
] ]
); );
if ($violations->count() > 0) { if ($violations->count() > 0
or simplexml_load_string($xml) === false) {
throw new ValidationFailedException(null, $violations); throw new ValidationFailedException(null, $violations);
} }
return $xml; return $xml;