Bug #6033
closed
Invalid warning about field in xs:key
Category:
Schema-Aware processing
Applies to branch:
11, 12, trunk
Fix Committed on Branch:
11, 12, trunk
Fixed in Maintenance Release:
Description
When I validate the attached XSD file with Saxon 11.4 I get an warning:
"The field expression (t:UnitName) may select no nodes, which would make the instance document invalid"
I think that Saxon should not display this warning.
The attached file is a small example from an Oxygen user that has a bigger schema.
Files
What's happening here is that that the field expression child::t:UnitName
gets rewritten as child::t:UnitName[1]
. I'm not sure exactly why that happens but it's not unreasonable. But the computed cardinality of a FirstItemExpression
is zero-or-one, even if the base expression has cardinality one-or-more.
However, I've tweaked FirstItemExpression.computeCardinality()
to be a bit smarter and the problem remains. That's because the computed cardinality of child::t:UnitName
is itself wrong.
- Status changed from New to In Progress
Well, I'm very puzzled, because AxisExpression.computeCardinality()
seems to make no attempt to calculate a schema-aware cardinality for the child axis. It does so for the attribute and descendant axis (which is much more complicated) but the code for the child axis seems to be missing. Of course there are few symptoms of calculating a cardinality that's not as precise as it could be.
- Category set to Schema-Aware processing
- Status changed from In Progress to Resolved
- Assignee set to Michael Kay
- Priority changed from Low to Normal
- Applies to branch 11, 12, trunk added
- Fix Committed on Branch 11, 12, trunk added
- Platforms .NET, Java added
Added JUnit test case to TestValidator
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 12.3 added
Bug fix applied in the Saxon 12.3 maintenance release.
- Status changed from Closed to Resolved
Leaving this bug issue as resolved until resolved against Saxon 11.
- Status changed from Resolved to Closed
- Fixed in Maintenance Release 11.6 added
Bug fix applied in the Saxon 11.6 maintenance release.
Please register to edit this issue
Also available in: Atom
PDF