473,795 Members | 2,847 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5003
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
3286
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 and I need to implement some kind of "client side" lazy loading. What I mean is this: I want to display a grid that only shows, say, 20 records. I need an external scrollbar control that I can then show on the screen next to the grid. When...
76
4101
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 can contain lots of data. <Results> <Data>Stuff</Data> <Data>More stuff</Data>
1
3236
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 1 -------------- <option value="CREAM OF BROCCOLI">Cream of Broccoli <option value="FRENCH ONION W/ CROUTONS">French Onion W/ Croutons <option value="HAMBURGER TOMATO SOUP">Hamburger Tomato
2
1895
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 implementation: http://ttwhy.org/code/mosudoku.html By changing the "src" attribute of a script tag, I can dynamically load
1
3811
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 = document.createElement("SCRIPT"); newScr.src = "newScr.js"; newScr.type="text/javascript";
6
10924
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 quite a bit and found similar problems, but no actual solutions. Here is the JavaScript I have to load a URL into a Div: function setResponseHtml(pUrl, pDiv) { var lHttp = getHTTPObjectHtml(); var lUrl = pUrl; lUrl =...
20
4048
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 and populates into the webpage; however, executing javascript has a few problems: 1. Opens on a blank page, but not a new page. It appears to compeltely overwrite the original page. I want it to update the existing page by loading within a <div>...
2
1298
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 Firefox I get an empty string. No errors are reported. If I look at the code with Firefox debugger (Venkman) everything works fine. I should probably put a loop somewhere to check when loading the file is finished. var xmlhttp;
1
1947
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 requests is because I wish for some of my requests to be over a secure https:// connection and other not so private requests to be made over http:// .. using XmlHttpRequest I am unable to make requests between two domains http/ https from the one...
0
9522
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10217
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9046
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6784
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2922
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.