Solved

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

Posted on 2002-04-29
3
421 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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 …
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

863 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now