8

Currently we're only able to get one validation error from the codeunit XML Validation of the System Application.


It would be very useful if there was support for getting all the validation errors.


There is a good C# example from Microsoft on how to do this:

https://learn.microsoft.com/en-us/dotnet/standard/data/xml/xml-schema-xsd-validation-with-xmlschemaset#validate-xml-documents


I don't know if this can be implemented in AL, but maybe something like the following will work.


var

[WithEvents]

XmlReaderSettings: DotNet XmlReaderSettings;

 

trigger XmlReaderSettings::ValidationEventHandler(sender: Variant; e: DotNet ValidationEventArgs)

var

ValidationResult: Dictionary of [Text, Text];

XmlSeverityType: DotNet XmlSeverityType;

begin

if e.Severity = XmlSeverityType.Error then

; //TODO: Save Error

ValidationResult.Add('Severity', e.Severity.ToString());

ValidationResult.Add('Message', e.Message());

ValidationResultList.Add(ValidationResult);

end;

Category: Development
STATUS DETAILS
Needs Votes
Ideas Administrator

Thank you for this suggestion! Currently this is not on our roadmap. We are tracking this idea and if it gathers more votes and comments we will consider it in the future. Best regards, Business Central Team