[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Using Saxon 9 as a Schematron 1.5 back end

  • From: Philippe Poulard <philippe.poulard@s...>
  • To: Dave Pawson <davep@d...>
  • Date: Mon, 21 Jan 2008 16:00:49 +0100

Re:  Using Saxon 9 as a Schematron 1.5 back end
Dave Pawson a écrit :
> Michael Kay wrote:
> 
>> Having said that, there's a reason Saxon doesn't give you column numbers,
>> which is that the column number reported by the SAX parser is usually not
>> very meaningful. 
> 
> This problem is repeated sufficiently often I'm surprised other 
> alternatives aren't available.
> 
> The best offering I've seen was from a Schematron process that generated
> an html version of the source 'highlighting' (as appropriate) the source
> of the problem, given an xpath location. I think it was from David 
> Carlisle on the html accessibility guidelines. Rick? Anyone?
> 
> Agreed it's likely that the eventual target is likely to be an editor
> on the source file, but a better way of finding it is surely more
> effective than a misleading column number (even worse for non 
> pretty-printed XML all on one line).

A useful output is what I called a canonical path, a structure composed 
of 2 parts :
-an XPath expression that starts from the root and descend from node to 
node by naming them and index them
-a mapping of the prefixes involved in the XPath expressions

example :
/foo:bar/FOO:BAR[3]/@foobar
foo -> http://foo.com
FOO -> urn:FOO:FOO

Other people already suggest to express the same things with another 
notation :
/{http://foo.com}:bar/{urn:FOO:FOO}:BAR[3]/@foobar
unfortunately it isn't a correct XPath expression although it is 
certainly not so hard to make a specific parser

You can use this canonical path for highlighting the pointed node in the 
source document ; just use your favorite XPath parser (most of them can 
compile an XPath expression from a string representation and a mapping 
of the prefixes)

I've got a class that does the job in RefleX :
http://reflex.gforge.inria.fr/javadoc/org/inria/ns/reflex/xml/CanonicalPath.html
it takes care of the prefixes used if some are remapped in the tree, and 
have convenience methods for displaying it or for adding it for example 
as an attribute hosted in an element (in this case it will use the ns 
URI declared in the element or its ancestor if any)

I use this class for example in XUnit test suites when I have to build 
an XML report that localize errors in source files ; I don't use it yet 
for highlighting the node in fault, but just for displaying it, as shown 
in this example :
http://reflex.gforge.inria.fr/xunit.html#checkingTheErrorReport
(scroll down until the table an click on [Display errors])

-- 
Cordialement,

               ///
              (. .)
  --------ooO--(_)--Ooo--------
|      Philippe Poulard       |
  -----------------------------
  http://reflex.gforge.inria.fr/
        Have the RefleX !


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.