Bug #5820
closed
SaxonCS QT3 test failures with -tree:dom
Applies to branch:
11, 12, trunk
Fix Committed on Branch:
11, 12, trunk
Fixed in Maintenance Release:
Description
The QT3 test driver has been enhanced to enable it to take input from a wrapped DOM tree. This reveals a number of test failures, listed below.
Summary
The main failures are:
- The DOM may include whitespace text nodes as children of the document node; these should be ignored in the XDM view
- xml:id attributes are not recognized by the id() function
- The code could be more robust when handling a programmatically-created DOM with inconsistencies such as missing namespace declaration attributes
Failures
31103 successes, 150 failures, 0 incorrect ErrorCode, 505 not run
Failing tests:
fn-count - 6
fn-doc - 2
fn-filter - 2
fn-for-each-pair - 2
fn-function-lookup - 4
fn-generate-id - 6
fn-has-children - 4
fn-id - 8
fn-idref - 6
fn-innermost - 30
fn-local-name - 6
fn-name - 6
fn-namespace-uri - 6
fn-outermost - 34
fn-path - 6
fn-string - 7
fn-transform - 2
fn-unordered - 2
op-union - 2
prod-AxisStep - 33
prod-AxisStep.preceding - 31
prod-Comment - 2
prod-CompDocConstructor - 4
prod-CompElemConstructor - 7
prod-DirElemContent - 2
prod-DirElemContent.namespace - 4
prod-ForClause - 4
prod-NamedFunctionRef - 4
prod-NodeTest - 16
prod-OrderingModeDecl - 4
prod-ParenthesizedExpr - 4
prod-UnorderedExpr - 4
prod-WhereClause - 2
misc-CombinedErrorCodes - 1
app-FunctxFn - 2
app-UseCaseNS - 2
app-UseCaseSEQ - 2
app-UseCaseXMP - 2
This is run with SaxonCS 12, but the chances are that the results for SaxonCS 11 will be similar.
Test NodeTest007-1 fails:
Saxon.Ejava.lang.IllegalArgumentException: Unsupported node type in DOM! XmlDeclaration instance System.Xml.XmlDeclaration
Fixed by skipping XmlDeclaration
nodes in DomNodeWrapper.getFirstChild()
. This fixes all the prod-NodeTest and prod-AxisStep failures.
Down to 51 failures:
31196 successes, 51 failures, 0 incorrect ErrorCode, 505 not run
Failing tests:
fn-doc - 2
fn-for-each-pair - 1
fn-has-children - 4
fn-id - 6
fn-innermost - 7
fn-outermost - 6
fn-path - 2
fn-string - 1
fn-unordered - 2
prod-AxisStep.preceding - 31
prod-DirElemContent.namespace - 4
misc-CombinedErrorCodes - 1
app-FunctxFn - 2
app-UseCaseNS - 2
app-UseCaseSEQ - 1
Test preceding-2 again fails "XmlDeclaration instance System.Xml.XmlDeclaration". It seems DomNodeWrapper.ChildEnumeration is skipping this node when traversing forwards, but not when traversing backwards.
Down to 29 failures.
In the test driver, when creating an XmlDocument
for a source document, we need to set doc.PreserveWhitespace = true
;
However, this increases the number of test failures to 53, probably because we are not skipping whitespace text node children of the document node.
Changed getFirstChild and getNextSibling to skip these nodes: results now
31222 successes, 28 failures, 0 incorrect ErrorCode, 505 not run
Failing tests:
fn-id - 6
fn-transform - 18
prod-CompAttrConstructor - 1
prod-CompCommentConstructor - 1
prod-CompPIConstructor - 1
prod-CompTextConstructor - 1
prod-DirElemContent.namespace - 4
app-UseCaseNS - 2
app-Walmsley - 2
fn-transform tests are crashing, for example
-s:fn-transform -t:fn-transform-14
in TestSet fn-transform
System.NullReferenceException: Object reference not set to an instance of an object.
at Saxon.Hej.tree.util.Navigator.copy(NodeInfo node, Receiver out, Int32 copyOptions, Location locationId) in /Users/mike/GitHub/saxon2020/build/cs/Saxon/Hej/tree/util/Navigator.cs:line 343
at Saxon.Impl.Dom.DomNodeWrapper.copy(Receiver out, Int32 copyOptions, Location locationId) in /Users/mike/GitHub/saxon2020/src/main/saxon-cs/engine/Saxon/Impl/Dom/DomNodeWrapper.cs:line 369
I think this is related to the change just made. When enumerating over the children of the document node (in DomNodeWrapper,ChildEnumeration
), hasNext()
is returning true, but next()
is then returning null, because in fact the only remaining nodes are ignorable,
Solved this by making ChildEnumeration no longer implement LookaheadIterator, which means it gets wrapped in a LookaheadIterator when required.
Results now:
31230 successes, 16 failures, 0 incorrect ErrorCode, 505 not run
fn-id - 6
prod-CompAttrConstructor - 1
prod-CompCommentConstructor - 1
prod-CompPIConstructor - 1
prod-CompTextConstructor - 1
prod-DirElemContent.namespace - 4
app-UseCaseNS - 2
The fn-id
test failures are because the Dom method GetElementById
does not recognize xml:id
attributes.
The specification of the method says:
The DOM implementation must have information which defines which attributes are of type ID. Although attributes of type ID can be defined in either XSD schemas or DTDs, this version of the product only supports those defined in DTDs. Attributes with the name "ID" are not of type ID unless so defined in the DTD. Implementations where it is unknown whether the attributes are of type ID are expected to return null.
Reimplemented DomDocumentTree.selectID()
to search the document using the descendant axis.
Test case
-s:prod-CompAttrConstructor -t:Constr-compattr-doc-1
is delivering the wrong result because whitespace text node children of the document node are not ignored when forming the string value of the document node.
The implementation of getUnicodeStringValue()
is relying on the DOM property XmlNode.InnerText
.
Fixed this by making getStringValue() of a document node concatenate the string values of the nodes on the child axis.
Now seeing failures:
prod-DirElemContent.namespace - 4
app-UseCaseNS - 2
The results for
-s:prod-DirElemContent.namespace -t:Constr-inscope-9
make it pretty clear what's wrong:
Actual results:
<new>
<child1 xmlns:foo="http://www.example.com/parent1"
xmlns:xmlns="http://www.w3.org/2000/xmlns/"
attr="child"/>
</new>
The code for DomNodeWrapper.getAllNamespaces() was adding the xmlns:xmlns namespace binding because its scan of attributes failed to exclude namespace attributes.
All QT3 tests with -tree:dom now passing on SaxonCS 12; will retrofit the changes to SaxonCS 11.
On the SaxonCS 11 branch, I've added support for -tree:dom to the QT3 test driver and the initial results are:
31103 successes, 271 failures, 0 incorrect ErrorCode, 505 not run
Successfully retrofitted the changes. (Still getting one failure in fn-collection, but I get that with -tree:tiny as well).
- Status changed from New to Resolved
- Priority changed from Low to Normal
- Fix Committed on Branch 11, 12, trunk added
- Description updated (diff)
- % Done changed from 0 to 100
- Fixed in Maintenance Release 11.5 added
Bug fix applied in the Saxon 11.5 maintenance release.
- Status changed from Resolved to Closed
- Fixed in Maintenance Release 12.1 added
Bug fix applied in the Saxon 12.1 maintenance release.
Please register to edit this issue
Also available in: Atom
PDF