Project

Profile

Help

Revision c6dcd97a

Added by O'Neil Delpratt almost 6 years ago

Saxon/C update and bug fixes

View differences:

latest9.6/hec/samples/cppTests/testValidator.cpp
81 81

  
82 82
}
83 83

  
84
void testValidator4a(SaxonProcessor * processor, SchemaValidator * val){
85
  processor->exceptionClear();
86
  val->clearParameters(true);
87
  val->clearProperties();
88
  cout<<endl<<"Test 4: Validate source file with schema file. i.e. family.xml and family.xsd"<<endl;	
89

  
90
	val->registerSchemaFromFile("family-ext.xsd");
91
       //val->registerSchema("family.xsd");
92
	val->registerSchemaFromFile("family.xsd");
93
	XdmNode * node = val->validateToNode("family.xml");
94
	if(node != NULL) {
95
		if(!val->exceptionOccurred()) {
96
			cout<<endl<<"Doc1 is OK"<<endl;
97
	 	} else {
98
			cout<<endl<<"Error: Doc reported as valid!"<<endl;
99
		}
100
	} else {
101
	cout<<endl<<"Error: node is NULL"<<endl;
102
	}
103

  
104
}
105

  
84 106
void testValidator5(SaxonProcessor * processor, SchemaValidator * val){
85 107
  processor->exceptionClear();
86 108
  val->clearParameters(true);
......
105 127
	val->setProperty("verbose", "true");
106 128
	val->validate();
107 129
	XdmNode * node = val->getValidationReport(); 
108
	if(node != NULL) {
109
		cout<<endl<<"Validation Report"<<node->getStringValue()<<endl;
110
	} else {
111
		cout<<endl<<"Error: Validation Report is NULL"<<endl;
112
	}
130
	//if(node != NULL) {
131
		cout<<endl<<node->size()<<"Validation Report"<<node->getStringValue()<<endl;
132
	//} else {
133
	//	cout<<endl<<"Error: Validation Report is NULL"<<endl;
134
	//}
113 135

  
114 136
	
115 137

  
......
131 153
	processor->setConfigurationProperty("http://saxon.sf.net/feature/multipleSchemaImports", "on");
132 154
	SchemaValidator * validator2 = processor->newSchemaValidator();
133 155
	testValidator4(processor, validator2);
156
	testValidator4a(processor, validator2);
134 157
	processor->setConfigurationProperty("xsdversion", "1.1");
135 158
	SchemaValidator * validator3 = processor->newSchemaValidator();
136 159
	testValidator5(processor, validator3);

Also available in: Unified diff