Hi
Exception of type 'System.OutOfMemoryException' was thrown.
at System.Xml.XmlEventCache.NewEvent()
at System.Xml.XmlEventCache.AddEvent(XmlEventType eventType)
at System.Xml.XmlEventCache.WriteEndAttribute()
at System.Xml.Xsl.Runtime.XmlAttributeCache.FlushAttributes()
at System.Xml.Xsl.Runtime.XmlAttributeCache.StartElementContent()
at System.Xml.Xsl.Runtime.XmlQueryOutput.StartElementContentUnchecked()
at System.Xml.Xsl.Runtime.XmlQueryOutput.ConstructWithinContent(XPathNodeType rootType)
at System.Xml.Xsl.Runtime.XmlQueryOutput.WriteStartElement(String prefix, String localName, String ns)
at System.Xml.Xsl.Runtime.XmlQueryOutput.WriteStartElementLocalName(String localName)
at <xsl:template name="QuickTable">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, IList`1 source,
XPathNavigator id, XPathNavigator print, IList`1 prefName, XPathNavigator class, XPathNavigator tableFrameClass, XPathNavigator classOdd, XPathNavigator classSelection, XPathNavigator classHighlight, XPathNavigator useAltRowColor, XPathNavigator childClass,
XPathNavigator tableWidth, XPathNavigator cellpadding, XPathNavigator cellspacing, XPathNavigator useWordWrap, XPathNavigator emptyListText, XPathNavigator showTitle, XPathNavigator headerControls, IList`1 title, XPathNavigator showColHeaders, IList`1 canClose,
IList`1 isClosed, XPathNavigator showChildren, XPathNavigator hide1stCol, XPathNavigator columns, String sortCol, String sortDir, XPathNavigator iconSortUp, XPathNavigator iconSortDown, XPathNavigator maxRows, XPathNavigator rowsPerPage, XPathNavigator rowHeightPx,
XPathNavigator isPageable, XPathNavigator initialPage, XPathNavigator startRecord, XPathNavigator classPageNav, XPathNavigator classPageNavMouseOver, XPathNavigator pageNavInHeader, XPathNavigator sortable, String onmouseover, String onmouseout, XPathNavigator
onclick, String ondblclick, XPathNavigator menu, IList`1 onExpandChildren, XPathNavigator expandAllChildren, XPathNavigator iconExpand, XPathNavigator iconCollapse, XPathNavigator iconFirst, XPathNavigator iconPrev, XPathNavigator iconNext, XPathNavigator
iconLast, XPathNavigator useTemplates, XPathNavigator useClassAdditionTemplate, XPathNavigator copySourceXML, IList`1 portletId, XPathNavigator isThisTheChild, String showChildColHeaders, IList`1 stopChildLevel)
at <xsl:template match="/">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current)
at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer, Boolean closeWriter)
at System.Xml.Xsl.XmlILCommand.Execute(XmlReader contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results)
at System.Xml.Xsl.XslCompiledTransform.Transform(XmlReader input, XsltArgumentList arguments, XmlWriter results)
at XCMapper.TransformDoc(String name, XmlDocument pXMLParent, String pSource)
I got this exception when tried to transform an XML file, here is the piece of code im using to transform
public XmlDocument TransformDoc(string name, XmlDocument pXMLParent, string pSource)
{
XslCompiledTransform objXslCompiled = new XslCompiledTransform();
objXslCompiled.Load("c:\\test\\sample.xsl");
XmlDocument objXMLoutput = new XmlDocument();
using (MemoryStream objOutStream = new MemoryStream())
{
XmlTextWriter writer = new XmlTextWriter(objOutStream,Encoding.UTF8);
objXslCompiled.Transform(new XmlNodeReader(pXMLParent), null, writer);// exception thrown here
objOutStream.Seek(0, SeekOrigin.Begin);
if (objOutStream.Length > 0)
{
try { objXMLoutput.Load(objOutStream); }
catch {//..doing something here}
}
}
//------ doing something here
return objXMLoutput;
}
is this exception because of this code or because of this <xsl:template name="QuickTable"> xsl..?
is there any alternative code for this..?
Could anyone please xplain why is this happening...?
Thanks in advance,
Madhu Mahesh