473,387 Members | 1,890 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,387 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 1458
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.