By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,654 Members | 1,422 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,654 IT Pros & Developers. It's quick & easy.

Loading partial Data with xmlHTTPRequest ?

P: n/a
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.

Oct 14 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Wizfrog wrote:
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,

--
Bart

Oct 14 '07 #2

P: n/a
This is what I understood from following
* http://www.w3.org/Protocols/rfc2616/....html#sec14.16
* http://www.w3.org/Protocols/rfc2616/....html#sec14.35
* http://www.w3.org/Protocols/rfc2616/...3.html#sec3.12
If you know from which byte and how long(in bytes) you need to read
you can use "Range" request header.
ie, to read 1000 bytes from 501 byte is (you need to give offset in
base 0)

Range:bytes=500-1499

Oct 14 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.