Last post Aug 11, 2011 09:26 PM by Decker Dong - MSFT
Aug 08, 2011 05:49 PM|porterboy|LINK
First I'm semi novice on XML so sorry if I explain this incorrectly.
I am getting a response XML file that references a DTD file in the header.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE XML_Response SYSTEM "XML_Response.dtd">
I'm not using the dtd file so I don't care about it. In my process I use an XML Data Source with a xslt transform file.
I then use this source for a Gridview to display to the end user. My problem is that I get an error when I DataBind the Gridview.
Could not find file 'c:\windows\system32\inetsrv\XML_Response.dtd'.
Here is my code
XDSTDRTA.Data = trestxml 'This is my XML Response file
GVRTA.DataSource = XDSTDRTA
GVRTA.DataBind() 'This is where I get the error
Is there a way that I can have it ignore the dtd file and avoid the error?
I read somewhere that they stated to :...
Before you load your XML File, try setting the XMLResolver property = nothing.
But I'm not sure how to do that. And I also read where that didn't work anyway.
Thanks in advance.
Aug 10, 2011 11:11 PM|Decker Dong - MSFT|LINK
Plz remove this——<!DOCTYPE XML_Response SYSTEM "XML_Response.dtd">
Because your defination like this can be wrong, I pasted it into my VS xml file newly created. It occrus wrongly.
Plz just read the whole xml contents and do binding.
Aug 11, 2011 10:13 AM|porterboy|LINK
I ended up just doing a string.replace and removing the XML_Response.dtd and it works
I actually wanted to remove the entire string but I couldn't get the correct syntax because of the " in the string.
string.replace("<!DOCTYPE XML_Response SYSTEM "XML_Response.dtd">","") doesn't work because of the syntax.
I also tried
string.replace("<!DOCTYPE XML_Response SYSTEM " & """ & "XML_Response.dtd"& """ & ">","") Still didn't work.
If you know the correct syntax I can remove the entire line. Thanks
Aug 11, 2011 09:26 PM|Decker Dong - MSFT|LINK
You should use the "\"——
string s = "abc<!DOCTYPE XML_Response SYSTEM \"XML_Response.dtd\">";
s= s.Replace("<!DOCTYPE XML_Response SYSTEM \"XML_Response.dtd\">", "");