Very Slow XSLTransform with XPathDocument

G

Guest

Framework 1.1 SP1.

Page.xml is about 1.5mg. m_oXSLTransform.Transform takes about 2 minutes.

When Page.xml is trimmed down to a smaller doc, it takes about 2 seconds.

Same code ran in about 4 seconds under asp.

not using <xsl:key>.

XslTransform m_oXSLTransform = new XslTransform();
m_oXSLTransform.Load("\default.xsl");
XPathDocument m_oXMLDocument = new XPathDocument("Page.xml");
XsltArgumentList xslArg = new XsltArgumentList();
m_oXSLTransform.Transform(m_oXMLDocument,xslArg,
context.Response.OutputStream);
 
G

Guest

As an xml doc is expanded into memory ( from the text string or file) it can
become enormous, so if it is already 1.5 mb it could be as big as 6mb in
memory (i think x4 is a rule of thumb)

what you may have to do is look at using one of the other objects to process
your doc e.g. sax (is this called xmlreader in .net? i forget) but basically
this processes the xml doc as a long stream, throwing out all that it has
processed up to a given point, it just raises a bunch of events for each
thing it finds

or

get a big fast box
 
G

Guest

Something like this?:
XmlReader m_oXMReader = new XmlTextReader("Page.xml");
XslTransform m_oXSLTransform = new XslTransform();
m_oXSLTransform.Load("\default.xsl");
XPathDocument m_oXMLDocument = new XPathDocument(m_oXMReader);
XsltArgumentList xslArg = new XsltArgumentList();
m_oXSLTransform.Transform(m_oXMLDocument ,xslArg,
context.Response.OutputStream);

MACHINE IS ALREADY BIG AND FAST! :)
 
G

Guest

hmmm not sure

DOM (aka xml document, xml data document)
this gives you a random access object that you can fully traverse
fast but 'expensive'

SAX (aka ? )
gives a foward only stream of xml which fires off events
(i only ever played around with this a bit in msxml)
e.g. series of events such as
elementfound,attribute found,attribute found, end of element found

you then needed to (in msxml at least)
implement an interface for each of these events that could be fired,
which in my example ended up as a big event handler with a massive case
statement

i'm not sure this helps you

i'm not even sure why you are trying to process such a huge xml doc in this
manner

why are you trying to do it out of interest?
 
G

Guest

web site is based on xml files stored in file a system with an xml <sitemap>
that stores the structure. The sitemap is very large and needed for the
presentation layer(xsl).

a future goal is to cut the page.xml down to only what the current xsl
demands, but for now it takes the whole sitemap. works fine in asp. :)

thx.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top