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

Re: Reporting XML validation results in XML: is thisapproach s

normalize space . schematron
Thanks -- I will poke about with this, and see where it takes me.

Any suggestions as to other lists where this question might be relevant?


On Fri, 3 Jan 2003, Rick Jelliffe wrote:

> From: "Ian Graham" <igraham@i...>
> > Of course you're right that XPAth's won't work if the document is not well
> > formed: but I'm more interested in the case where it is well formed, and
> > where I want the error report to be somehow positioned in the 'business
> > layer' of the application as defined by the messages, rather than at the
> > mid-level layer of schema validation.  That is, I'd like the XML error
> > report to make sense from the application's business context -- and
> > hopefully be understandable to a business analyst reading response
> > messages, and potentially the business developer writing code.
> This is pretty much where Schematron can fit in.  Here is a (complete but
> untested) schema for your example.
> <schema xmlns="http://www.ascc.net/xml/schematron">
>     <title>Example for Ian</title>
>     <pattern>
>         <rule context="purchaseOrder/partType">
>                <assert test="string-length(normalize-space(substring-after(., '-'))) = 5
>             and number(substring-after( ., '-' ))"
>             diagnostics="d1" >
>             The piece of a partType after the - is should be 5 digits.
>             </assert>
>         </rule>
>         <rule context="purchaseOrder/deliverBy">
>             <assert test="number(.) &gt;  number(document('http://dateserver.eg.com/getCurrentDate')/date/.)"
>             diagnostics="d2">
>             The deliverBy date should be greater than the current date.
>             </assert>
>         </rule>
>     </pattern>
>     <diagnostics>
>         <diagnostic id="d1">InvalidPartNumber</diagnostic>
>         <diagnostic id="d2">dateInPast</diagnostic>
>     </diagnostics>
> </schema>
> In Schematron you can associate any assertion with a diagnostics section. 
> This can contain additional information for an application to use. In this
> case it is just your error type.  
> The current date could come from some function, but instead here we
> let it come from some web server which returns an xml file
>     <date>20030101</date>
> This will only work on the ISO 8601 date format with no decorations,
> treated just as a number.
> > I admit this is a lot of half-baked thoughts in one letter, but there
> > seems to be something interesting in here ....
> In order to generate the error format you want, you only need to customize
> the schematron 1.5 skeleton program: this already provides a template
> to generate the Xpath for a particular error, etc (thanks to Francis Norton
> and others), so you are 90% there.  If you are using Windows, my company provides
> a free drag-and-drop shell (Topologi Schematron Validator), which will make 
> development and testing easier. http://www.topologi.com/
> Cheers
> Rick Jelliffe
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
> The list archives are at http://lists.xml.org/archives/xml-dev/
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>


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.
First Name
Last Name
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.