XQuery Update: namespace propagation is not working
XQuery Update test case
id-insert-expr-086 is failing on the 11.x branch, and I suspect it probably fails on 10.x as well.
When we add a namespaced attribute p:att to an element E, we are adding a namespace binding for prefix p to element E, but we are not propagating it to descendants of E. In the past, we didn't need to do anything to achieve this propagation, but with namespaces now being held with each element as a NamespaceMap, it needs to be done explicitly.
#2 Updated by Michael Kay 28 days ago
I've now run these tests against 10.3 using the 10.x UpdateTestSuiteDriver, and surprisingly the tests appear to succeed.
More careful examination shows that this is a false positive. The comparison of actual results with expected results is actually failing with an IndexOutOfBoundsException, which is being ignored, so the test is reported as a pass when it should have reported a failure.
#4 Updated by Michael Kay 27 days ago
When child elements are inserted, the
InsertAction object contain a flag to indicate whether namespace inheritance is in force (in the query static context), and it looks like the logic has been changed for the 10.0 namespace model to reflect this: the instruction ends up calling (or not calling)
((ElementImpl) child).fixupInsertedNamespaces(inherit); to handle the namespace inheritance.
InsertAttributeAction has no flag for namespace inheritance. I suspect that under the old namespace model, namespace inheritance was always happening implicitly, and it is now never happening in the case of attribute insertion.
But RenameAction also has no flag for this.
#5 Updated by Michael Kay 27 days ago
So, I've been trying to find out how this ever worked, and I've discovered it never did. Looking back at 9.9, the RenameAction makes no attempt to distinguish between the inherit/no-inherit cases. It always (in effect) does "inherit", and the reason the no-inherit tests appear to work is because of the same bug in the UpdateTestSuiteDriver: the compare() method returns "true" when comparing an empty string with a non-empty string.
#6 Updated by Michael Kay 27 days ago
- Status changed from New to Resolved
- Applies to branch 10, 9.9, trunk added
- Fix Committed on Branch trunk added
I've fixed this in the development (11.x) branch.
I've decided not to fix it for 10.x or earlier releases. The problem has been present for years without anyone noticing, and the fix involves changes to the
MutableNodeInfo interface which people might be using, so on balance it's probably better to leave 10.x alone.
Please register to edit this issue