[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qexo-general] Include, Http Post
From: |
Per Bothner |
Subject: |
Re: [Qexo-general] Include, Http Post |
Date: |
Wed, 16 Jul 2003 20:08:52 -0700 |
User-agent: |
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.4) Gecko/20030612 |
Terje Pedersen wrote:
I N C L U D E
Is there or would it be some function to include other .xql files like
xsl:include in xsl or include() in php?
The May XQuery draft has a module facility. I haven't implemented it
yet, partly because I think it is poorly conceived. (I have reported my
concerns to the committee,but perhaps shoudl do so again.)
Is it possible to compile an xql program and use functions from this class
just like you can do with java, scm classes? I have tested using functions
written in a custom scm class from xql which worked on the command line but
for some reason I didn't get i working with tomcat ie. from a servlet.
Note sure what you're asking here. Yes, you can compile an xql program
to a Java class, and yes you can call Java methods from XQuery. The
problem is these features aren't really integrated and consistent yet.
This is a high priority issue.
H T T P P O S T
I needed atleast HTTP POST so I added the following lines to KawaServlet.java
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
doGet(request,response);
}
I guess we could do that, if it is needed.
Which makes it also possible to post form data. But what I really would like
to have is a function returning the posted form data as xml so that I can
treat it just like an xml document with the possibilty to lets say join it
with some other xml data.
<form method="post" name="vote" action="#">
<input type="radio" name="answer" value="true"/>yes<br/>
<input type="radio" name="answer" value="false"/>no<br/>
<input type="submit" name="button" value="Vote"/>
</form>
==>
<vote>
<answer>true</answer>
<button>Vote</button>
</vote>
But HTTP doesn't give you that. It gives you (some encoding of):
answer="true"
button="Vote"
These can get accessed at the Java servlet level using getParameter,
getParameterNames, and related ServletRequest methods.
In Qexo, you can use request-parameter("answer") or
request-parameters("answer").
We could implement: string($param/answer) where teh string is usually
automatic. But there are some issues here.
I'm not certain about the possibility to extract the form name attribute, is
it possible?
Not as far as I know. The HTML 4.01 spec suggests it is for
(client-side) scripting.
Or maybe naming the input elements with slashes is better solution like this :
<input name="address/name"/>
<input name="address/postal/code"/>
==>
<address>
<name>Terje Pedersen</name>
<postal>
<code>5563</code>
</postal>
</address>
That may be possible. But I don't know if it's compatible with XForms,
which we may want to work towards.
--
--Per Bothner
address@hidden http://per.bothner.com/