Solved

dhtml, xml, table sub table to xml query... I think...

Posted on 2002-04-29
3
423 Views
Last Modified: 2006-11-17
I've got a 10Mb+ XML table.  For ease, let's say that the table has year, make, and model of cars.

I'd like to show the table with year only.  If the user clicks on the year, I'd like it to go back and query the parent xml and return all the makes of the cars.  If the user clicks on the make of the car, I'd like it to go back and query the xml by year and make and return all the model cars.

It's important that the entire XML doc is not loaded... it's too big.  Basically, user interaction queries and returns data.

Thanks,
Doug
0
Comment
Question by:douglaskarr
  • 2
3 Comments
 
LVL 9

Expert Comment

by:AlfaNoMore
ID: 6980923
What are you going to use to parse the XML? And will this be client-side or server-side (in which case, what programming language will you use?)

If you do this Server-side using Microsoft's XML 3.0 Parser, and VBscript as your ASP language, then it can be done, but the server will still need to load the XML doc before ot can parse/ translate it.

Is there any other way to break the file into smaller ones?
0
 
LVL 23

Expert Comment

by:b1xml2
ID: 6981159
If the size is an issue,
1. Store the data inside a database e.g. Access, MySQL, SQL Server, Oracle for example.
2. Use SQL Queries to retrieve the data into a recordset.
3. With ADO 2.5+, Save the recordset into an XML Object.
oRS.Save oXML
4. Do your transforms then.

Do not misuse XML. It is good as a delivery system but is not good as a storage system. Databases are good for that especially large amounts of data.

10 Mbs of data would roughly translate to 30 to 50 MBs of RAM taken just to load the entire tree into memory. If this operation is performed using a FreeThreadedDOMDocument, then the initial loading would take some time (relative) and only at point of loading.

e.g.
global.asa
===========
<object id="oPersist" progid="Msxml2.FreeThreadedDOMDocument.4.0" runat="server">
<script language="VBScript">
Sub Application_OnStart()
oPersist.async = False
oPersist.load Server.MapPath("xml/data.xml")
End Sub

Sub Application_OnEnd()

End Sub
</script>


page.asp
========
<%@language="VBScript"%>
<%
Response.ContentType = "text/xml"
Response.Expires = -1
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma","no-cache"

Dim oXML, oMain, oNodeList, oNode
Dim szMake, szYear, szXPath
szMake = Response.QueryString("make")
szYear = Response.QueryString("year")
szXPath = "//cars[@make = '" & szMake & "' and @year = " & szYear & "]"
Set oMain = Application.StaticObjects("oPersist")
Set oXML = Server.CreateObject("Msxml2.FreeThreadedDOMDocument.4.0")
oXML.async = False
oXML.appendChild oXML.createProcessingInstruction("xml","version='1.0' encoding='iso-8859-1")
oXML.appendChild oXML.createElement("root")
Set oNodeList = oMain.selectNodes(szXPath)
For Each oNode in oNodeList
 oXML.documentElement.appendChild oNode.cloneNode(True)
Next

oXML.save Response
%>

Notes
=====
1. What this does is to access the FreeThreaded DOM Document.
2. Get The XPath Statement
3. Append the found nodes to another XML Tree (thereby reducing the amount of data to be sent to the client)
4. Saving the XML as a Stream to the Response Object which implements the IStream Interface.

Regards,

Brandon Driesen
0
 
LVL 23

Accepted Solution

by:
b1xml2 earned 100 total points
ID: 6983955
slight typo in the global.asa code
===================================
<object id="oPersist" progid="Msxml2.FreeThreadedDOMDocument.4.0"
runat="server"
scope="application">
<script language="VBScript">
Sub Application_OnStart()
oPersist.async = False
oPersist.load Server.MapPath("xml/data.xml")
End Sub

Sub Application_OnEnd()

End Sub
</script>
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
classic asp checkbox uncheck and check 2 69
HTML in email body has extra  tick marks 3 88
JQuery to parse xml string and get element by id 4 48
JS does not refresh 6 30
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question