Document.IsValidEx
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.
Description
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.
Errors
1400 | The object is no longer valid. | |
1407 | Invalid parameter or invalid address for the return parameter was specified. | |
1408 | Unable to validate file. |
Example
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 );
}