This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 9583 - Return code position consistently across the tests that output code extracts
Summary: Return code position consistently across the tests that output code extracts
Status: RESOLVED FIXED
Alias: None
Product: mobileOK Basic checker
Classification: Unclassified
Component: Java Library (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 enhancement
Target Milestone: ---
Assignee: fd
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-22 16:58 UTC by fd
Modified: 2010-05-03 10:06 UTC (History)
0 users

See Also:


Attachments

Description fd 2010-04-22 16:58:38 UTC
Tests often return code extracts, but there is no easy way to determine where this code was extracted from in the resource under test.

The <position> tag should be returned more systematically with at least the number of the line in the source code where the code was extracted from.

This should be possible if we use Saxon's specific DOM implementation (TinyTree) that makes it possible to preserve the line number of the element in the source when the DOM tree is created.

Note that the version of Saxon used by the Checker does not preserve the index of the column where the element appears. Saxon 9.x would be needed, but we cannot switch to Saxon 9.x for licensing reasons (license changed, and extension functions that we need are not integrated in Saxon-HE AFAICT).
Comment 1 fd 2010-04-26 12:00:31 UTC
The mobileOK Checker now uses Saxon's DOM implementation to parse the document under test. Line numbering is activated.

Node position is then serialized in the "docContent" moki node as a "line" attribute in the moki namespace (a "col" attribute would also be used if we knew something about the column) on each node.

This position is then used by tests that apply at the markup level to output the position (at least the line number) in the report along with the code extract.

Most tests updated consequently. The following list should be exhaustive:
AUTO_REFRESH
CACHING-3 and CACHING-6
DEFAULT_INPUT_MODE
IMAGE_MAPS
IMAGES_SPECIFY_SIZE
LINK_TARGET_FORMAT-3
NO_FRAMES
NON_TEXT_ALTERNATIVES
OBJECTS_OR_SCRIPT
PROVIDE_DEFAULTS
STYLE_SHEETS_USE
Comment 2 fd 2010-04-29 16:51:39 UTC
The use of TinyTree creates a number of "interesting" problems in the end. Most of them are resolved by now, but there seems to be a bug in Saxon that prevents using an entity resolver to parse a document with DocumentBuilderImpl.

Among the problems solved, getXmlEncoding always returns null in Saxon, so I implemented it in XhtmlContent.
Comment 3 fd 2010-05-03 10:06:11 UTC
Bug in Saxon confirmed but there is an easy way to work around it, as suggested by Michael Kay:
https://sourceforge.net/mailarchive/message.php?msg_name=209D7731E68043DC8F6695AF79CD6397@Sealion

I used the Configuration.buildDocument method, and wrapped the returned DocumentInfo node into a DOM document that can then be processed by the rest of the code.

Note it would be a good idea to switch to Saxon 9.1 that also supports column numbering.