Problem with loading the instance from a file

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with loading the instance from a file

jules_901
Hi everybody,

I'm doing a PHP script that makes Xforms. In the Xforms, I load the
instance from an xml file (the name of the xml file is written by
PHP). The problem is that when the xml file is changed, the form is
not updated the next time I load it. Even if I load it several times,
there is no change. I have to clear my clear browser cache and
sessions to see the form updated. I don't think this comes from PHP
because my PHP script only deals with the name of the xml file, not
with the content.

What is the problem? Should I use 'refresh' ?

Thank you in advance.

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: Problem with loading the instance from a file

Aaron Reed
Hi,

I assume you are talking about an instance document that lives on the
server, correct?  The way that XForms works is that upon an XForms
document load, the XForms processor will retrieve the external instance
documents that the xf:instance elements are pointing at and create
clones of them locally.   From there on out when the user is modifying
the instance documents through interaction with XForms controls that are
bound to the instance data, it is these local copies that the user is
changing.  Then when the form submits the data back to the server, it is
submitting these local copies to the target destination.

I would assume that the best way for you to keep the local copy in sync
with the server copy is to do constant polling with replace="instance".
  If your instance data is meant to be readonly, that might not be so
bad for the user.  But if the user is meant to be able to update the
instance, pulling the instance out from under the user while he is in
the middle of filling out the form and submitting it via some background
  processing might bring up some usability issues.

--Aaron

[hidden email] wrote:

> Hi everybody,
>
> I'm doing a PHP script that makes Xforms. In the Xforms, I load the
> instance from an xml file (the name of the xml file is written by
> PHP). The problem is that when the xml file is changed, the form is
> not updated the next time I load it. Even if I load it several times,
> there is no change. I have to clear my clear browser cache and
> sessions to see the form updated. I don't think this comes from PHP
> because my PHP script only deals with the name of the xml file, not
> with the content.
>
> What is the problem? Should I use 'refresh' ?
>
> Thank you in advance.
>
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

RE: Problem with loading the instance from a file

Klotz, Leigh
In reply to this post by jules_901
This sounds to me like your web server or an intermediate HTTP proxy
server is caching the file and not noticing that it has changed.
Please try this:

Install the Live HTTP Headers extension
[http://livehttpheaders.mozdev.org/] into Firefox, or use some other
network tool such as Wireshark to capture the communication that goes on
between Firefox and your web server or HTTP proxy.  

The first time the instance is fetched you should see something like
this:



    GET /2007/04/k3/k3-price-sheet.xml HTTP/1.1
    Host: wa5znu.org
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
    Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plai
n;q=0.8,image/png,*/*;q=0.5
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 300
    Proxy-Connection: keep-alive

    HTTP/1.x 200 OK
    Date: Fri, 18 May 2007 21:28:19 GMT
    Server: Apache/2.2.3 (Fedora)
    Last-Modified: Tue, 15 May 2007 04:41:09 GMT
    Etag: "2f4206-137a-d7a68340"
    Accept-Ranges: bytes
    Content-Length: 4986
    Content-Type: text/xml
    X-Cache: MISS from myproxy.example.com
    Proxy-Connection: keep-alive

Then, reload the page and look for the instance XML http GET request.

The example below shows tht the file was not cached by the proxy server,
and that Mozilla made the request, and that the request went all the way
to the web server, which returned a "304 Not Modified."

If your results look like this, then it means that your web server isn't
noticing that the file has changed, and it's an issue you need to take
up with the server.  If your results show that the new file is being
returned with a "200 OK" response, then you might need to use a better
tool (such as Wireshark) to examine the whole body of the returned
response, not just the headers.


    GET /2007/04/k3/k3-price-sheet.xml HTTP/1.1
    Host: wa5znu.org
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
    Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plai
n;q=0.8,image/png,*/*;q=0.5
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 300
    Proxy-Connection: keep-alive
    If-Modified-Since: Tue, 15 May 2007 04:41:09 GMT
    If-None-Match: "2f4206-137a-d7a68340"
    Cache-Control: max-age=0

    HTTP/1.x 304 Not Modified
    Date: Fri, 18 May 2007 21:30:48 GMT
    Server: Apache/2.2.3 (Fedora)
    Etag: "2f4206-137a-d7a68340"
    X-Cache: MISS from myproxy.example.com
    Proxy-Connection: keep-alive
    ----------------------------------------------------------

Leigh.
 

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of
[hidden email]
Sent: Thursday, May 17, 2007 7:37 PM
To: [hidden email]
Subject: Problem with loading the instance from a file

Hi everybody,

I'm doing a PHP script that makes Xforms. In the Xforms, I load the
instance from an xml file (the name of the xml file is written by
PHP). The problem is that when the xml file is changed, the form is
not updated the next time I load it. Even if I load it several times,
there is no change. I have to clear my clear browser cache and
sessions to see the form updated. I don't think this comes from PHP
because my PHP script only deals with the name of the xml file, not
with the content.

What is the problem? Should I use 'refresh' ?

Thank you in advance.

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms