XMLValidator Usage to Validate Schemas in Leif 2.2

Article ID: 1217
Last updated: 22 Feb, 2008
Article ID: 1217
Last updated: 22 Feb, 2008
Revision: 1
Views: 1742
Posted: 01 Jan, 2000
by Dean J.
Updated: 22 Feb, 2008
by Dean J.
Problem


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

This article was:   Helpful | Not helpful
Report an issue
Article ID: 1217
Last updated: 22 Feb, 2008
Revision: 1
Views: 1742
Posted: 01 Jan, 2000 by Dean J.
Updated: 22 Feb, 2008 by Dean J.

Others in this category