Newbie Question...Error Produced while Loading XML from DataSet

A

Adam

Hi,

I have a web project produced in asp.net, vb.net and it uses a SQL
Server 2000 database. I am trying to load an xml document from data
passed in from the database in the form of a database. Below is the
code I am using and it is followed by the error message I am
receiving. if I comment out the XML document, a simular error message
is fired for the LoadXSL document call. Does anyone have any
suggestions? Thanks.

Try
Dim myCustomer As Customer = New Customer
Dim myAuditData As DataSet
myAuditData = myCustomer.GetCustomerAuditInfo

Dim tr As TableRow = New TableRow
Dim td As TableCell = New TableCell

Dim xml As XmlDocument = New XmlDocument
Dim xsl As New XslTransform
Dim io As System.IO.StringWriter = New
System.IO.StringWriter
Dim resolve As New XmlUrlResolver

xml.Load(myAuditData.GetXml)
xsl.Load(Server.MapPath("Audit.xslt"), resolve)
xsl.Transform(xml, Nothing, io, Nothing)
td.Text = io.ToString
tr.Cells.Add(td)
tblAudit.Rows.Add(tr)

Catch ex As Exception
lblStatus.Text = ex.ToString
End Try

ERROR MESSAGE PRODUCED:



System.ArgumentException: The path contains illegal characters. at
System.IO.Path.nGetFullPathHelper(String path, Char[]
invalidPathChars, Char[] whitespaceChars, Char directorySeparator,
Char altDirectorySeparator, Char volumeSeparator, Boolean fullCheck,
String& newPath) at System.IO.Path.GetFullPathInternal(String path) at
System.IO.Path.GetFullPath(String path) at
System.Xml.XmlResolver.ResolveUri(Uri baseUri, String relativeUri) at
System.Xml.XmlTextReader..ctor(String url, XmlNameTable nt) at
System.Xml.XmlDocument.Load(String filename) at
MyStore.ViewAuditTrail.Page_Load(Object sender, EventArgs e) in
C:\Inetpub\wwwroot\MyStore\ViewAuditTrail.aspx.vb:line 56


If anyone has any suggestions it would be greatly appreciated!
 
L

LOZANO-MORÁN, Gabriel

1.
You need the LoadXml()

xml.LoadXml(myAuditData.GetXml)

2.
Try it withouth the XmlUrlResolver

xsl.Load(Server.MapPath("Audit.xslt"))

Gabriel Lozano-Morán
 
A

adam farr

Hi thanks for the quick response.

I may not have explained the situation correctly the first time around.
I am not commenting the xml.Load(...GetXml) line out when the error
message is produced. So disregard the comment about commenting out the
LoadXml line. The same error is still produced. If you have any other
advice it would be greatly appreciated.

Thanks again,

Adam.
 
A

Adam

I just wanted to add that the error produced was first produced when
the xml.LoadXml(..) line was not commented out.
 
G

Gabriel Lozano-Morán

Comment all the lines in your Page_Load() and try
Response.Write(Server.MapPath("audit.xslt")) and post the return value

Gabriel Lozano-Morán
Software Engineer
Sogeti
 
A

Adam

If I comment out everything as you suggested and add the following
line of code, Response.Write(myAuditData.GetXml) , above the one you
wanted me to add this is the output

2 Jonny Smith 2005-04-17 18:48:03 890.2500 260.0500
c:\inetpub\wwwroot\MyStore\Audit.xslt

This is what is displayed as the content of the myAuditData.GetXml
when I add a watch on the myAuditData.GetXml funciton.

<NewDataSet>
<audit>
<cid>2</cid>
<FullName>Jonny Smith</FullName>
<timeupdated>2005-04-17 18:48:03</timeupdated>
<oldvalue>890.2500</oldvalue>
<newvalue>260.0500</newvalue>
</audit>
</NewDataSet>

When I am debugging the page the line of code

xml.Load(myAuditData.GetXml)

is the line that throughs the exception if I print the exception out
it provides the following error message

System.ArgumentException: The path contains illegal characters. at
System.IO.Path.nGetFullPathHelper(String path, Char[]
invalidPathChars, Char[] whitespaceChars, Char directorySeparator,
Char altDirectorySeparator, Char volumeSeparator, Boolean fullCheck,
String& newPath) at System.IO.Path.GetFullPathInternal(String path) at
System.IO.Path.GetFullPath(String path) at
System.Xml.XmlResolver.ResolveUri(Uri baseUri, String relativeUri) at
System.Xml.XmlTextReader..ctor(String url, XmlNameTable nt) at
System.Xml.XmlDocument.Load(String filename) at
MyStore.ViewCustomerAuditTrail1.Page_Load(Object sender, EventArgs e)
in C:\Inetpub\wwwroot\MyStore\ViewCustomerAuditTrail1.aspx.vb:line 48


Any Suggestions????
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top