[xquery-talk] flowrrr - how to structure a function?
per at bothner.com
Wed Oct 18 00:49:09 PDT 2006
Martin Probst wrote:
> Per Bothner wrote:
>> Qexo has a function response-header("Name", "value") which returns a
>> "response-header value". There are no side effects per se. However,
>> when a response is "serialized" to HTTP by the Qexo servlet any initial
>> response-header value causes the appropriate HTTP response headers to be
>> set. (A response header value is actually a top-level attribute node.)
> 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 ...
> Using PIs has the benefit that the result is still a well-formed XML
> document (well, if it was one without the PIs). Also, from my limited
> understanding of XML in general, I think this is exactly what processing
> instructions were invented for :-)
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?
It doesn't really matter what kind of value is used to represent
the result values, as long as they can be easily distinguished
from the response proper.
per at bothner.com http://per.bothner.com/
More information about the talk