[xsd-users] Large XSD-schema, speed and identity constraint validation
Stefan de Konink
stefan at konink.de
Thu May 14 17:58:36 EDT 2020
Hi Boris,
On Thursday, May 14, 2020 2:43:28 PM CEST, Boris Kolpackov wrote:
> I haven't looked into this in detail but maybe you can resolve the schema
> names referenced in the error message back to schema locations based on
> the loaded schema grammar.
It took some cozy debugging setting, a couch, gdb, two people looking at a
screen, you get the setting.
Xerces luckely has only one place where the Identity Constraints are
checked. So that suggests one place to improve;
302 {
303 FieldValueMap& valueMap = iter.nextElement();
304
305 if (!keyValueStore->contains(&valueMap) &&
fDoReportError) {
306
307
fScanner->getValidator()->emitError(XMLValid::IC_KeyNotFound,
308 fIdentityConstraint->getElementName());
309 }
310 }
311 }
The getElementName resolves the elementName under which in the Schema the
key-constraint has been placed. Personally I am more interested in:
p fIdentityConstraint.fIdentityConstraintName
$34 = (XMLCh *) 0x590070 u"ToPointRef"
p fIdentityConstraint.fSelector.fXPath.fExpression
$40 = (XMLCh *) 0x590390 u".//netex:ToPointRef"
p fIdentityConstraint.fFields.fElemList[0].fXPath.fExpression
$32 = (XMLCh *) 0x590930 u"@ref"
print keyValueStore.fIdentityConstraint.fIdentityConstraintName
$70 = (XMLCh *) 0x57cf10 u"ScheduledStopPointId"
print *valueMap.fValues.fElemList
$41 = 0x8ce9d90 u"CXX-ALL:RoutePoint:78210040"
(gdb) p fIdentityConstraint->getElementName()
$77 = (XMLCh *) 0x5902f0 u"ServiceFrame"
I could envision an error message creating an error similar to the Java
output.
Key 'ToPointRef' with value 'CXX-ALL:RoutePoint:78210040' not found for
identity constraint of element 'ServiceFrame'.
But I would need to figure out how a compound key, but even a naive
approach significantly improves the current output.
And I would also love the line number of the actually checked object. (Help
appreciated!)
Opened an issue here <https://issues.apache.org/jira/browse/XERCESC-2197>
--
Stefan
More information about the xsd-users
mailing list