Project

Profile

Help

Bug #2673

returning validation with getValidationReport

Added by Roger Martin about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Category:
C++ API
Start date:
2016-03-12
Due date:
% Done:

100%

Found in version:
1.0.0
Fixed in version:
1.0.1

Description

Testing validate and then SchemaValidatior::getValidationReport

After setting up and calling validate everytihng seems ok. Then trying to retrieve the results with getValidationReport causes a jet crash

@
#include <string>
#include <cstdlib> //std::system
#include <vector>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <exception>
#include <memory>
#include <iostream>

#include "SchemaValidator.h"
#include "XdmNode.h"

//Main function.
int main(int argc, char *argv[]) {
std::shared_ptr<SaxonProcessor> processor(new SaxonProcessor(true));
std::shared_ptr<SchemaValidator> schemaValidator(processor->newSchemaValidator());
schemaValidator->registerSchemaFromFile("/home/roger/NodeProjects/saxon-node/test/examples/query/books.xsd");
std::cout<<"validate... "<<std::endl;
schemaValidator->validate("/home/roger/NodeProjects/saxon-node/test/examples/query/books.xml");
//XdmNode* vp=schemaValidator->validateToNode("/home/roger/NodeProjects/saxon-node/test/examples/query/books.xml");
std::cout<<"getValidationReport... "<<std::endl;
XdmNode* vp=schemaValidator->getValidationReport();
std::cout<<"vp size "<<vp->size()<<std::endl;
std::cout<<"vp\n "<<vp->getStringValue()<<std::endl;
return 0;
}
@

https://github.com/rimmartin/saxon-node/tree/master/test/examples/query for the xml and xsd


Related issues

Related to Saxon/C - Bug #2675: Validation report properties missing from documentation Closed 2016-03-14 Actions

History

#1 Updated by O'Neil Delpratt about 2 years ago

  • Category set to C++ API
  • Status changed from New to In Progress
  • Assignee set to O'Neil Delpratt
  • Priority changed from Low to Normal

Thank you for reporting this error. We will be investigating it and will report back shortly.

#2 Updated by O'Neil Delpratt about 2 years ago

Before calling the validate() and getValidationReport() methods you should set the property to switch on validation reporting. i.e.:

schemaValidator->setProperty("report-node", "true");

Alternatively you can save validation report to file:

val->setProperty("report-file", "filename.xml");

Without the first property being set the variable vp will be NULL (see: http://www.saxonica.com/saxon-c/doc/html/classSchemaValidator.html#a6f630753665ec7dc169ed6ca168066b5). Jet intercepts the seg. errors and produces an error log file, which is probably not that helpful. Running gdb is probably more useful when debugging.

I have noticed that the documentation has these properties missing in http://www.saxonica.com/saxon-c/doc/html/index.html#getting-started. I will raise another bug against the documentation to add these properties.

#3 Updated by O'Neil Delpratt about 2 years ago

  • Status changed from In Progress to AwaitingInfo

#4 Updated by O'Neil Delpratt about 2 years ago

  • Related to Bug #2675: Validation report properties missing from documentation added

#5 Updated by Roger Martin about 2 years ago

We're making progress!

saxon-node wrapper is now supporting validation and xpath for EE edition users of Saxon provided they get a license from you

The other method to XdmNode I''ll add after your patch release; users have the other way till then

#6 Updated by O'Neil Delpratt about 2 years ago

  • Status changed from AwaitingInfo to Resolved
  • % Done changed from 0 to 100
  • Found in version set to 1.0.0

Bug fixed and committed to subversion

#7 Updated by O'Neil Delpratt about 2 years ago

  • Status changed from Resolved to Closed
  • Fixed in version set to 1.0.1

Bug fix applied in the Saxon/C 1.0.1 maintenance release.

Please register to edit this issue

Also available in: Atom PDF