473,320 Members | 2,161 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 1455
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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.