Converting Document to XmlNode - Performance Issue
Hi,
My problem is about performance, or maybe technique. I need
an XmlNode for some later processing, so I do the below call on an Umbraco document
to get this XmlNode.
XmlNode n = doc.ToXml(new
System.Xml.XmlDocument(), true); //
taking 17 seconds to complete.
The tree it is working on has maybe a few hundred nodes, but
will potentially grow to become even bigger as nodes are dynamically added to
it over the websites lifetime.
Not sure if this is relevant, but what I actually need is an
XElement – and it the above ToXml call that gets me the XmlNode I need to use XElement.Parse.
So I may well be going about the whole thing in a less than optimal way?
XElement surveyGroupEl = XElement.Parse(doc.OuterXml); //
using the above XmlNode to get an XElement
(I get errors on these forums when trying to edit posts. Cant even ubold text without going into html view, which also causes errors. Really wish theyd get some better forum software at this stage in the game!!)
This is really quite strange. After 3 days of it taking 17 seconds (despite server restrats and numerous other such things) it suddenly now only takes 3 seconds. The only difference being the addition of of a few hundred more nodes via copy operation on the node tree.
Can someone explain to me why this can vary so much - and actually be faster with more nodes? This is read NOT from a database operation but from the in memory version of the node tree, right?
Converting Document to XmlNode - Performance Issue
Hi,
My problem is about performance, or maybe technique. I need an XmlNode for some later processing, so I do the below call on an Umbraco document to get this XmlNode.
XmlNode n = doc.ToXml(new System.Xml.XmlDocument(), true); // taking 17 seconds to complete.
The tree it is working on has maybe a few hundred nodes, but will potentially grow to become even bigger as nodes are dynamically added to it over the websites lifetime.
Not sure if this is relevant, but what I actually need is an XElement – and it the above ToXml call that gets me the XmlNode I need to use XElement.Parse. So I may well be going about the whole thing in a less than optimal way?
XElement surveyGroupEl = XElement.Parse(doc.OuterXml); // using the above XmlNode to get an XElement
Cheers,
Andles.
Code sample corection: XElement surveyGroupEl = XElement.Parse(n.OuterXml); // (not doc.OuterXml)
(I get errors on these forums when trying to edit posts. Cant even ubold text without going into html view, which also causes errors. Really wish theyd get some better forum software at this stage in the game!!)
This is really quite strange. After 3 days of it taking 17 seconds (despite server restrats and numerous other such things) it suddenly now only takes 3 seconds. The only difference being the addition of of a few hundred more nodes via copy operation on the node tree.
Can someone explain to me why this can vary so much - and actually be faster with more nodes? This is read NOT from a database operation but from the in memory version of the node tree, right?
is working on a reply...