Very Slow XSLTransform with XPathDocument

Discussion in 'ASP .Net' started by =?Utf-8?B?U2VhbiBIb2ZmbWFu?=, Nov 18, 2004.

  1. 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);
    =?Utf-8?B?U2VhbiBIb2ZmbWFu?=, Nov 18, 2004
    #1
    1. Advertising

  2. 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");
    > XsltArgumentList xslArg = new XsltArgumentList();
    > m_oXSLTransform.Transform(m_oXMLDocument,xslArg,
    > context.Response.OutputStream);
    =?Utf-8?B?YWRvbGYgZ2FybGlj?=, Nov 18, 2004
    #2
    1. Advertising

  3. 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! :)
    =?Utf-8?B?U2VhbiBIb2ZmbWFu?=, Nov 18, 2004
    #3
  4. 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?





    "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);
    > XsltArgumentList xslArg = new XsltArgumentList();
    > m_oXSLTransform.Transform(m_oXMLDocument ,xslArg,
    > context.Response.OutputStream);
    >
    > MACHINE IS ALREADY BIG AND FAST! :)
    =?Utf-8?B?YWRvbGYgZ2FybGlj?=, Nov 18, 2004
    #4
  5. 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,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?
    >
    >
    >
    >
    >
    > "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);
    > > XsltArgumentList xslArg = new XsltArgumentList();
    > > m_oXSLTransform.Transform(m_oXMLDocument ,xslArg,
    > > context.Response.OutputStream);
    > >
    > > MACHINE IS ALREADY BIG AND FAST! :)
    =?Utf-8?B?U2VhbiBIb2ZmbWFu?=, Nov 18, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. D
    Replies:
    2
    Views:
    599
  2. srikar

    XPathDocument

    srikar, Oct 25, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    426
    Guest
    Oct 26, 2003
  3. Keith Chadwick

    Placing dataset into XPathDocument

    Keith Chadwick, Nov 23, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    3,259
    Stephen Cook
    Nov 24, 2003
  4. ThatsIT.net.au

    RSS, XPathDocument and ISA proxy server

    ThatsIT.net.au, Mar 24, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    316
    ThatsIT.net.au
    Mar 24, 2007
  5. .NETed
    Replies:
    3
    Views:
    1,033
    bruce barker
    Nov 6, 2009
Loading...

Share This Page