473,473 Members | 1,847 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

XslTransform problem

I am trying to transform a dataset with xslt, and it continually fails
with a NullReference Exception after the transform when I try to read
the result into another dataset I have tested the XML and stylesheet,
so you can assume (ahem) that they are valid. I am using 1.1
The code is below:

Dim sre As System.IO.StringReader = New
System.IO.StringReader(ResultsDataSet.GetXml())

Dim xt As New XmlTextReader(sre)
Dim xp As New XmlDataDocument(ResultsDataSet)
Dim file As String = "/CMPDNet/support/xslt/"
If lyrName.ToLower = "reported incidents" Then
file += "IncidentsSummary.xsl"
Else
file += "CallSummary.xsl"
End If
Dim xslTran As New System.Xml.Xsl.XslTransform

xslTran.Load(Server.MapPath(file))
Dim resolver As XmlUrlResolver = New XmlUrlResolver
Dim xmlReader As XmlReader

xmlReader = xslTran.Transform(xp, Nothing, resolver)
Dim xmldoc As XmlDocument = New XmlDocument
xmldoc.Load(xmlReader)
SummaryDataSet.ReadXml(xmlReader) 'EXCEPTION HAPPENS HERE

Any ideas?
Nov 18 '05 #1
2 1461
Sorry...the problem was that I am stupid.

Didn't initialize the second dataset.

SummaryDataSet = new DataSet() fixed the problem

Ruprict wrote:
I am trying to transform a dataset with xslt, and it continually fails
with a NullReference Exception after the transform when I try to read
the result into another dataset I have tested the XML and stylesheet,
so you can assume (ahem) that they are valid. I am using 1.1
The code is below:

Dim sre As System.IO.StringReader = New
System.IO.StringReader(ResultsDataSet.GetXml())

Dim xt As New XmlTextReader(sre)
Dim xp As New XmlDataDocument(ResultsDataSet)
Dim file As String = "/CMPDNet/support/xslt/"
If lyrName.ToLower = "reported incidents" Then
file += "IncidentsSummary.xsl"
Else
file += "CallSummary.xsl"
End If
Dim xslTran As New System.Xml.Xsl.XslTransform

xslTran.Load(Server.MapPath(file))
Dim resolver As XmlUrlResolver = New XmlUrlResolver
Dim xmlReader As XmlReader

xmlReader = xslTran.Transform(xp, Nothing, resolver)
Dim xmldoc As XmlDocument = New XmlDocument
xmldoc.Load(xmlReader)
SummaryDataSet.ReadXml(xmlReader) 'EXCEPTION HAPPENS HERE

Any ideas?

Nov 18 '05 #2
Sorry...the problem was that I am stupid.

Didn't initialize the second dataset.

SummaryDataSet = new DataSet() fixed the problem

Ruprict wrote:
I am trying to transform a dataset with xslt, and it continually fails
with a NullReference Exception after the transform when I try to read
the result into another dataset I have tested the XML and stylesheet,
so you can assume (ahem) that they are valid. I am using 1.1
The code is below:

Dim sre As System.IO.StringReader = New
System.IO.StringReader(ResultsDataSet.GetXml())

Dim xt As New XmlTextReader(sre)
Dim xp As New XmlDataDocument(ResultsDataSet)
Dim file As String = "/CMPDNet/support/xslt/"
If lyrName.ToLower = "reported incidents" Then
file += "IncidentsSummary.xsl"
Else
file += "CallSummary.xsl"
End If
Dim xslTran As New System.Xml.Xsl.XslTransform

xslTran.Load(Server.MapPath(file))
Dim resolver As XmlUrlResolver = New XmlUrlResolver
Dim xmlReader As XmlReader

xmlReader = xslTran.Transform(xp, Nothing, resolver)
Dim xmldoc As XmlDocument = New XmlDocument
xmldoc.Load(xmlReader)
SummaryDataSet.ReadXml(xmlReader) 'EXCEPTION HAPPENS HERE

Any ideas?

Nov 18 '05 #3

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

Similar topics

2
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,...
2
by: John Meyer | last post by:
I have an application where I create an xml fragment using an XslTransform object. However, if I use the following output method, <xsl:output method="xml" version="1.0" encoding="UTF-8"...
1
by: Rodger McNab | last post by:
While parsing xpath expressions within an XSLT document the .NET XslTransform class seems to delete the first "/" after a "]" within an expression containing a "|". This problem can be demonstrated...
1
by: Tim Menninger | last post by:
When I use the XslTransform.Transform method to write to the HttpRequest.OutputStream The first byte of the output is always an invalid character, looks like an ascii zero or some other...
1
by: Ronald | last post by:
I just wrote some code on a dev machine, Imports System.Xml Imports System.Xml.XPath Imports System.Xml.Xsl Imports System.IO Imports System.Data.SqlClient Public Class ClassXMLtoHTML Dim...
3
by: Steve | last post by:
Is there any way of specifying the startMode when using the xslTransform class? We are updating code which used msxml to the system.xml classes but can find no way to specify the startMode. We...
1
by: manlio | last post by:
how can I load a XSL string (not an xsl file!!) with XslTransform ??? If I use the code: // Create a new XslTransform class and load the stylesheet XslTransform myXslTransform = new...
4
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#...
1
by: rmgalante | last post by:
Hello, I have a VB.Net component that uses the XslTransform object. I am using the FXSL randomizeList function in my XSL template. When I transform the XML in the VB.Net component, my...
9
by: WT | last post by:
Hello, I have code created with .net 1.0 and migrated to 3.5. Form 2.0 the XslTransform class is obsolete and the vs2008 compiler generates warnings that these classes are absolete suggesting to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.