473,769 Members | 5,724 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Very Slow XSLTransform with XPathDocument

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");
XsltArgumentLis t xslArg = new XsltArgumentLis t();
m_oXSLTransform .Transform(m_oX MLDocument,xslA rg,
context.Respons e.OutputStream) ;
Nov 18 '05 #1
4 1906
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

"Sean Hoffman" wrote:
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");
XsltArgumentLis t xslArg = new XsltArgumentLis t();
m_oXSLTransform .Transform(m_oX MLDocument,xslA rg,
context.Respons e.OutputStream) ;

Nov 18 '05 #2
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);
XsltArgumentLis t xslArg = new XsltArgumentLis t();
m_oXSLTransform .Transform(m_oX MLDocument ,xslArg,
context.Respons e.OutputStream) ;

MACHINE IS ALREADY BIG AND FAST! :-)
Nov 18 '05 #3

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,at tribute 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?

"Sean Hoffman" wrote:
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);
XsltArgumentLis t xslArg = new XsltArgumentLis t();
m_oXSLTransform .Transform(m_oX MLDocument ,xslArg,
context.Respons e.OutputStream) ;

MACHINE IS ALREADY BIG AND FAST! :-)

Nov 18 '05 #4
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.

"adolf garlic" wrote:

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,at tribute 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?

"Sean Hoffman" wrote:
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);
XsltArgumentLis t xslArg = new XsltArgumentLis t();
m_oXSLTransform .Transform(m_oX MLDocument ,xslArg,
context.Respons e.OutputStream) ;

MACHINE IS ALREADY BIG AND FAST! :-)

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5822
by: Anthony Bouch | last post by:
Can anyone tell me why I receive the following compiler warning after having recently upgraded to VS.Net 2003 and .Net 1.1? Warning CS0618: 'System.Xml.Xsl(System.Xml.XPath.IXPathNavigable, System.Xml.Xsl.XsltArgumentList, System.Xml.XmlWriter)' is obsolete: 'You should pass XmlResolver to Transform() method' XPathDocument xmlData = new XPathDocument(memStream); XslTransform xslTransform = new XslTransform();...
2
6044
by: Graham Pengelly | last post by:
Hi I am trying to transform on System.Xml.XmlDocument into another using XslTransform without writing the object out to a file. I am guessing it should work something like this... public XmlDocument TransformXmlDoc(XmlDocument docToTransform, string xsltFilePath) { //load the xslt
4
3594
by: David S. Alexander | last post by:
I am trying to transform XML to XML using an XSLT in C#, but the root node of my XML is not being matched by the XSLT if it has an xmlns attribute. Am I handling my namespaces incorrectly? My C# code is, // Create an XSLT transform object XslTransform xslTransform = new XslTransform(); // Load the stylesheet
0
1829
by: MedIt | last post by:
Hi all, Help needed in the xsl transformation in c# while passing with arguments. I am trying to transform an xml programtically (c#), while passing with two parameters using the XsltArgumentList class. My problem is in the transformed xml. Even when I set in my XmlWriter the Encoding to UTF-8, or even when I set it null, my output transformed xml is without the xml header encoding attribute:<?xml version="1.0" encoding="utf-8"?> Wether...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8870
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.