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

RE: Is an XPath processor responsible for catching mi

Subject: RE: Is an XPath processor responsible for catching misspelled tag names when there is an associated Schema?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 21 Feb 2008 14:53:45 -0000
RE:  Is an XPath processor responsible for catching  mi
You haven't shown the full context of your stylesheet/xpath expression.

The processor can't assume that because an element is named Book that it
will be a valid instance of the global element declaration Book in the
schema. It might for example be a temporary unvalidated element, and it's
perfectly legitimate to mix validated/valid trees and unvalidated/invalid
trees in the same program.

The XQuery/XPath formal semantics define an optional feature called "static
typing" that guarantees that if the type of $b is known to be
schema-element(Book), then $b/autr is a static type error. But static typing
unfortunately can reject many perfectly reasonable expressions as well, so
many products including Saxon choose not to implement it.

Saxon will give you a compile time warning for this situation. However, if
there is no static type information available, then it can't do this. To get
maximum benefit from schema-aware processing, you should declare the types
of your variables and function parameters (and especially, the type of the
principal input). 

> 
> QUESTIONS
> 
> 1. Is it the responsibility of a schema-aware processor to 
> catch misspelled tag names in XPath expressions?

Yes, provided (a) the type of the context of the path is known, and (b) the
processor implements static typing.
> 
> 2. Is there a flag that I can set in SAXON to tell it to 
> catch such misspelling errors?

You should declare the types of your variables and parameters as accurately
as you can.

The scope for this in freestanding XPath with Saxon is limited; if you want
this it's probably best to process your XPath expressions with the XQuery
processor.

Michael Kay
http://www.saxonica.com/

Current Thread

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
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.