[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

flowrrr - how to structure a function?

Martin Probst martin at x-hive.com
Wed Oct 18 11:47:24 PDT 2006


  flowrrr - how to structure a function?
>> What kind of a result is the "response-header (name?) value" pair?  
>> Does it fit into the XQuery data model?
>
> I guess you missed the last sentence you quoted ...

Ouch, no responses before 9 AM in the future ;-)

> PIs would also work.  But attributes work just as well, I think,
> and it makes sense: an attribute is a property with a name and a
> string value - and a response header is the same thing.

> Using PIs would actually be more ambiguous, just because it can
> be part of a well-former XML document:  When should be PI be
> transmitted as part of the result "body", and when should be
> it extracted as a result header?

Yes, it's kind of a pity that PIs don't carry namespaces. However in  
your case you might swallow programming errors (returning attributes  
toplevel). I think you won't get around that unless you use special  
"magic" values (that are not part of the XQDM), which I rather  
wouldn't. If it's  possible to construct the expected result within  
XQuery, you always might accidentally swallow a value that was not  
supposed to go that way. However if you e.g. only swallow PIs with a  
certain local name of (for example) "xquery-web" it's pretty unlikely  
you run into errors.

Using well-formed XML documents as responses might make caching  
easier. Apart from these minor and probably quite hypothetical issues  
it's probably totally irrelevant whether it's attributes or PIs.

I think Wolfgang's function library in eXist (http://demo.exist- 
db.org/xquery/functions.xq) also includes functions to create user  
sessions, this might be more difficult to make side-effect free. I.e.  
if session:create(), session:set-current-user() and session:invalidate 
() return values if called in the right order, but give errors if  
called in the wrong order, it's much more difficult because you need  
to provide access to those values. I'm not picking on you Wolfgang, I  
rather think your library is a good example of what one does need in  
webapps.

On the other hand, RESTafarians might argue that all kinds of storing  
stuff in sessions (or sessions in general?) are evil anyways ;-)

Regards,
Martin

-- 
Martin Probst
X-Hive Corporation
http://x-query.com/mailman/listinfo/talk




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-2007 All Rights Reserved.