Jump to content
Registration disabled at the moment Read more... ×
Sign in to follow this  
AndrewHoward

validate XML against XSD

Recommended Posts

Hi,

This code validates XML against XSD but it returns the first error.

 How can I make it return all erros in XML in one go ?

 

Thank you.

function TXmlValidator.ValidateXml(const XmlFileName: string; const SchemaCollection: IXMLDOMSchemaCollection2): Boolean;
var
  XmlDocument: IXMLDOMDocument3;
  parseError: IXMLDOMParseError;
begin
  XmlDocument := TmsxmlFactory.CreateXMLDOMDocument3WithValidateOnParseFromFile(XmlFileName);
  XmlDocument.schemas := SchemaCollection;


  parseError := XmlDocument.validate();
  FValidationResult := TXMLDOMParseErrorToString.ToString(parseError);

  Result := ValidationResult = NullAsStringValue;;
end;

 

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×