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

RE: The use of XML syntax in XML Query


ensuring xml syntax
At 5:23 PM -0500 1/3/02, Champion, Mike wrote:


>Strong typing - There is a real-world use case for ensuring that queries
>return schema-valid results, for example ensuring that they can be displayed
>in valid XHTML.  (Whether anyone outside the W3C cares about schema-valid
>XHTML is another matter, but it is a "real world" example that I'm sure has
>counterparts with more data-oriented schemas in the REAL real world)

I'm interested in hearing more about this requirement. Personally, my 
general reaction is that the only thing that should be guaranteed out 
of an arbitrary XQuery result is well-formed XML. Any particular 
syntax beyond that is a question for the author of the query. By 
metaphor with SQL, a SQL SELECT statement produces a table. However, 
there's no guarantee that this table has the same schema as any other 
table in the database. It may or may not depending on what the SELECT 
statement did. I view XQuery similarly.

Suppose I do write an XQuery and I want its output to be valid 
according to some schema. If I run the query and it produces invalid 
data, then that's a bug in the query, which will likely be detected 
by a validation performed in a different, later layer. I will then 
fix my code, just as I would for any other bug.

What else would you want XQuery to do? Should it throw an exception 
of some kind? Return a default document? Start global thermonuclear 
war? What?

I view a query as a function that operates on an arbitrary 
well-formed XML document, and which kicks out a defined result for 
any well-formed document. If the results don't really make sense for 
some inputs, then I'll attach a validation layer to the input 
documents before I make the query. If I'm worried about what comes 
out of the documents, I'll attach a validation layer after the query 
has run to check the output. I'm just unclear on why this needs to be 
part of the XQuery layer.
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo@m... | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
|              http://www.ibiblio.org/xml/books/bible2/              |
|   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/     |
+----------------------------------+---------------------------------+

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.