Hello everyone,

i have got a problem with the validation with a schema. I am using the DOMBuilder, which has a DOMErrorHandler. When I try parsing a invalid document, it is only parsed up to the wrong element, value, etc without any error message / exception. How can I handle a schema error? I set the features the following way:

DOMBuilder* probParser_ = impl->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS,0); XNSQ DOMErrorHandler* errHandler = (DOMErrorHandler*) new XNSQ HandlerBase();
      probParser_->setErrorHandler(errHandler);


probParser_->setProperty( XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation,
                       "file.xsd" );
    probParser_->setFeature( XMLUni::fgDOMNamespaces, true);
  probParser_->setFeature( XMLUni::fgXercesSchema, true);
  probParser_->setFeature( XMLUni::fgXercesSchemaFullChecking, true);


try{
XNSQ DOMDocument* newProblem = probParser_->parse(sourceWrapper); ; }
  catch(const XMLException& toCatch){
  char* message = XNSQ XMLString::transcode(toCatch.getMessage());
  std::cerr << "Parsing Error.XML Exception message is:\n"
            << message << "\nPlease check your Problemfile!\n";
    XNSQ XMLString::release(&message);

    return false;
}

catch(const DOMException& toCatch){
   char* message = XNSQ XMLString::transcode(toCatch.msg);
  std::cerr << "Parsing Error. DOM Exception message is:\n"
            << message << std::endl;
  XNSQ XMLString::release(&message);    }

catch(const SAXException& toCatch){
  std::cerr << "error\n";
}

catch(...){
   ;//...
}


Thanks for your help.

Tim

Reply via email to