[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Saxon .Net API performance


Subject: RE: [xsl] Saxon .Net API performance
From: "Merrilees, David" <David.Merrilees@xxxxxxxxxxxx>
Date: Wed, 1 Sep 2010 17:49:46 +0100

Thanks Michael, that's really helpful. However, I don't understand how
Tinytree is used by the Saxon API in .Net.

I'm using a .Net XmlTextWriter to serialize my objects to XML which are then
built into an XdmNode (see code excerpt below), which is used as the input for
transformation. As I understand, using the XmlTextWriter avoids using DOM.
Does this use Saxon's tree model efficiently?

public XdmNode ReadObject(object objectToSerialize, Uri baseUri) {
            XdmNode result;

            using (MemoryStream stream = new MemoryStream())
         {
        XmlSerializer xmlSerializer = new
XmlSerializer(objectToSerialize.GetType());
                using (XmlTextWriter xmlWriter = new XmlTextWriter(stream,
Encoding.UTF8))
                {
                    xmlSerializer.Serialize(xmlWriter, objectToSerialize);

                    DocumentBuilder builder =
XsltHelper.Processor.NewDocumentBuilder();
                    builder.BaseUri = baseUri;

                    stream.Seek(0, SeekOrigin.Begin);
                    result = builder.Build(stream);
                }
           }
            return result;
}

-----Original Message-----
From: Michael Kay [mailto:mike@xxxxxxxxxxxx]
Sent: 31 August 2010 21:45
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Saxon .Net API performance

That's a very broad question!

I think probably the most important advice is to use Saxon's native tree model
rather than running over the Microsoft DOM (which is possible, but slow). Most
of the other things one can say are pretty generic, applying equally to any
XSLT processor.



This is a confidential email. Tesco may monitor and record all emails. The
views expressed in this email are those of the sender and not Tesco.

Tesco Stores Limited
Company Number: 519500
Registered in England
Registered Office: Tesco House, Delamare Road, Cheshunt, Hertfordshire EN8
9SL
VAT Registration Number: GB 220 4302 31


Current Thread
Keywords