Loading partial Data with xmlHTTPRequest ?

W

Wizfrog

Hello,

I'm working with a pretty large XML file, but I really only need to
display a few things that requires quite a few transforms. I already
limited to the transforms to the data i need to use, but I'd like to
speed things up by loading only the data I need.

I need to mention that this is for a local application that sometimes
will lookup updates on a server, but mostly, it is for local use
(offline)

I can use xmlHTTPrequest for both local or server data access. That
seems to work fine. Now I would like to be able to load only the data
I need.

I hear the Google suggest tool bar uses xmlHTTPrequest to look up a
list of known queries, so I am hoping they lookup "only" the necessary
data as one types. It's kinda what I want to do, but I'm not sure how
that would work, since the "url" parameter should be a destination
file name.

Any hints on how to load partial data from an xml file with
xmlHTTPrequest?

I'd love to hear from the experts (in simple terms if possible!)

Thanks for help.
 
B

Bart Van der Donck

Wizfrog said:
I'm working with a pretty large XML file, but I really only need to
display a few things that requires quite a few transforms. I already
limited to the transforms to the data i need to use, but I'd like to
speed things up by loading only the data I need.

I need to mention that this is for a local application that sometimes
will lookup updates on a server, but mostly, it is for local use
(offline)

I can use xmlHTTPrequest for both local or server data access. That
seems to work fine. Now I would like to be able to load only the data
I need.

I hear the Google suggest tool bar uses xmlHTTPrequest to look up a
list of known queries, so I am hoping they lookup "only" the necessary
data as one types. It's kinda what I want to do, but I'm not sure how
that would work, since the "url" parameter should be a destination
file name.

Any hints on how to load partial data from an xml file with
xmlHTTPrequest?

I'd love to hear from the experts (in simple terms if possible!)

I think you have two options:

(1) Perform a filter on your data on the server before the content is
sent, based on submitted information from the client. In other words,
the XML data is not a static file, but an application which outputs
content dynamically. You could use your favourite server-side
scripting to read out the sent POST/GET from XMLHttpRequest, and
decide what data it should return based on those parameters. The
benefits are that you'll have a smaller file to transfer (less
traffic), plus smaller data to parse at the client (less browser
memory). The drawback is that the application needs to start up over
and over again every time the XML file (or a part of it) is requested.
In case of large data, heavy queries and/or many requests, this might
consume more than acceptable resources on the server.

(2) Load the large XML-file as a whole in browser memory, then load it
into the XML parser, perform manipulation on data in javascript until
you have the part you need. Benefit is that server needs much less
resources, but the traffic overhead and browser CPU pay cash for that.

There is no "in between" way as far as I know.

Hope this helps,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top