473,387 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Loading partial Data with xmlHTTPRequest ?

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
2 4966
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: blackhawk | last post by:
I need to build a web page that has to potentially display a large amount of data in two grids on the same page. The HTML file with all of the formatting is about 7MB in size. This is too large...
76
by: kwilder | last post by:
This works, but it doesn't load the latest version of the xml if it was just modified without closing and reopening the browser. Here's the scenario: I have an xml doc called results.xml. It...
1
by: Al-Bot | last post by:
Hey to all! How can I load data from a simple .txt file into a drop down box using HTML or javascript. I have this: <select name="Soup_1"> <option value="Soup Choice 1">-------------- Choice...
2
by: hbchai | last post by:
I'm adapting the ajax-like asynchronous request pattern mentioned in this article: http://www.xml.com/pub/a/2005/11/09/fixing-ajax-xmlhttprequest-considered-harmful.html?page=2 for my Sudoku...
1
by: ozzy.osborn | last post by:
Hello All, I have been struggling with a cross browser solution to loading external javascript files on the fly. I have been successful using the following code in IE6: var newScr =...
6
by: Shigun | last post by:
On a website I am working on I am trying to load another page into a div on the the page the user does his work from. What I have works correctly in FireFox, but not in IE. I've rummaged Google for...
20
RMWChaos
by: RMWChaos | last post by:
Currently testing in: WinVista / IE7 I have been working on getting xmlhttprequest going for weeks now. I have finally gotten a semi-working script going. Pulling up text or xml files works great...
2
by: joe | last post by:
I am loading a text file to a variable with XMLHttpRequest() There seems to be some sort of timing issue since loadXML (source code below) returns the contents of the file on seconds try. In...
1
by: bizt | last post by:
Hi, I have a webpage where Im creating AJAX type requests by loading dynamic pages containg JavaScript into hidden iFrames. The reason I am opting for this method over XmlHttpRequest object...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.