| | | | Browse by category |
The isValid() method returns a bool value indicating whether the data for each simple type in an instance document is valid or not. The LEIF::XmlValidator class provides the means for determining the exact nature of the errors found by the isValid() method. The XMLOL User Guide incorrectly documents this procedure.
Action
The isValid() method is overloaded to accept an instance of the class LEIF::XmlValidator. The code below shows how to use this method and class to obtain details about errors in the instance document for the PurchaseOrder example.
LEIF::XmlValidator validator("temp");
if (!po.isValid(validator)) {
LEIF::List<LEIF::XmlSchemaException> errs = validator.getErrors();
LEIF::ListIterator<LEIF::XmlSchemaException> itr(errs);
while(itr()) {
std::cout << itr.key().why() << std::endl;
}
}
Click here to download a working example: Download
Reference: XMLOL User Guide Section 4.5.3 - Validating the Instance Document