[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
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/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|