Altova XMLSpy 2024 Enterprise Edition

Method: IsValidEx (nXSDVersion as SPYValidateXSDVersion, nErrorLimit as int, nErrorFormat as SPYValidateErrorFormat, out strError as Variant) as Boolean



Return Value

True if the document is valid, false if not.




IsValidEx validates the document against its associated schema or DTD.


In parameters:

nXSDVersion which is an enumeration value of SPYValidateXSDVersion that selects the XSD version to validate against.

nErrorLimit which is an integer. Values must be 1 to 999.

nErrorFormat which is an enumeration value of SPYValidateErrorFormat that selects the XSD version to validate against.


Out parameter:

strError is the error message, and is the same as that received when validating the file within the GUI.





The object is no longer valid.


Invalid parameter or invalid address for the return parameter was specified.


Unable to validate file.




The following C++ code snippet provides an example of how to use the IsValidEx method.


#import "XMLSpy.tlb"



CComPtr< XMLSpyLib::IDocument12> ipDoc = ipXMLSpy->GetActiveDocument();

if ( ipDoc )


      CComVariant variantErrorEx;

      bool bIsValidEx = ipDoc->IsValidEx( XMLSpyLib::spyValidateXSDVersion_AutoDetect, 100, XMLSpyLib::SPYValidateErrorFormat_LongXML, &variantErrorEx ) == VARIANT_TRUE;


      //     // retrieve values from out parameters

      CString strErrorEx = (V_VT( &variantErrorEx ) == VT_BSTR ? V_BSTR( &variantErrorEx ) : _T( "" ));

      if ( !strErrorEx.IsEmpty() )

              AfxMessageBox( "Validation failed - " + strErrorEx );



© 2018-2024 Altova GmbH