[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

need advice on loading XML file

Subject: need advice on loading XML file
From: "Mason Burley" <mason.burley@xxxxxxxxx>
Date: Wed, 23 Jan 2002 09:49:59 -0800
xmldocument load xml file
I have created an XML application for users to view information about
project datasets (www.nwcsr.com/meta).  The page works great, but the
data island takes quite awhile to load (5mb).  The current approach (in
XSL) looks like this:

*************************************************************
function rewriteOtherFrame(xslURL, variable, datTbl) {
xslStyle.async=false;
xslStyle.XMLDocument.load(xslURL);	
var curPattern =
xslStyle.XMLDocument.selectSingleNode('//xsl:for-each/@select'); 
curPattern.text = "codeBook/fileDscr[@ID='" + variable + "']";
myid.innerHTML = xmlData.transformNode(xslStyle.XMLDocument);
				 }
//</SCRIPT>
    	</HEAD>
    	<BODY>
<XML>
<xsl:attribute name="ID">xslStyle</xsl:attribute>
</XML>			
<XML>
<xsl:attribute name="ID">xmlData</xsl:attribute>
<xsl:attribute name="SRC">metaman.xml</xsl:attribute>
</XML>
*************************************************************

My question:  Can I find a more efficient way to access this data
(easily) using DOM, or should I try a different approach?  I am leary of
using SAX2, because it looks like a big code rework would be necessary.
I did see a SAX example using MSXML 4 and scripting that had a quick
load time (below).

My last question:  Can I use transformNode or something else in the
example below to filter the XML file?

Thanks in advance, I am a XSL/XML newbie and appreciate the help,

Mason Burley

  

*************************************************************
<SCRIPT>
   //Create the XSLTemplate object (xslt).
   var xslt = new ActiveXObject("Msxml2.XSLTemplate.4.0");

   //Create and load the stylesheet (transform1.xsl) as a DOMDocument.
   var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0");
   var xslProc;
   xslDoc.async = false;
   xslDoc.load("transform1.xsl");

   //Connect the XSLTemplate object to stylesheet DOMDocument.
   xslt.stylesheet = xslDoc;

   //Create XSLT processor using stylesheet for XSL template.
   xslProc = xslt.createProcessor();

   //Create and load sample XML file (books.xml) as a DOMDocument.
   var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
   xmlDoc.async = false;
   xmlDoc.load("books.xml");

   //Create SAX writer.
   var xmlWriter = new ActiveXObject("Msxml2.MXXMLWriter.4.0");

   //Assign XML sample file as input of the transform() method.
   xslProc.input = xmlDoc;

   //Use a SAX writer as the output of the transform() method.
   xslProc.output = xmlWriter;

   //Do transformation on the sample XML file.
   xslProc.transform();

   //Use SAX writer ouptut to generate inner HTML for page.
   result.innerHTML = xmlWriter.output;
</SCRIPT>
*************************************************************


Mason Burley
Northwest Crime and Social Research, Inc.
215 Legion Way SW
Olympia, WA 98501

Tele: (360) 528-3339
FAX: (360) 570-7533
Web: www.nwcsr.com



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.