Solved

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

Posted on 2002-04-29
3
425 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

717 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