Streaming web service response as byte array..dtd error. - XML SOAP
This is a discussion on Streaming web service response as byte array..dtd error. - XML SOAP ; Hi, the following calls a webservice and returns the XML as a byte array
which I convert to a stream first. The 'xml' variable has XML, however, when
I try to load the XML into the XmlDocument, it can't find ...
-
Streaming web service response as byte array..dtd error.
Hi, the following calls a webservice and returns the XML as a byte array
which I convert to a stream first. The 'xml' variable has XML, however, when
I try to load the XML into the XmlDocument, it can't find the .dtd file. See
error below....any ideas what I need to modify? Thanks, Dave.
System.IO.MemoryStream stm = new
System.IO.MemoryStream(SomeWebServiceProxyclass.GetDataAsByteArray);
stm.Position = 0;
System.IO.StreamReader sr = new System.IO.StreamReader(stm);
string xml = sr.ReadToEnd();
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xml); <!---ERROR...
Message: "Could not find file 'C:\\Program Files\\Microsoft Visual Studio
8\\Common7\\IDE\\SomeWebServiceProvider.dtd'."
-
Re: Streaming web service response as byte array..dtd error.
Dave wrote:
> Hi, the following calls a webservice and returns the XML as a byte array
> which I convert to a stream first. The 'xml' variable has XML, however, when
> I try to load the XML into the XmlDocument, it can't find the .dtd file. See
> error below....any ideas what I need to modify? Thanks, Dave.
>
> System.IO.MemoryStream stm = new
> System.IO.MemoryStream(SomeWebServiceProxyclass.GetDataAsByteArray);
>
> stm.Position = 0;
> System.IO.StreamReader sr = new System.IO.StreamReader(stm);
> string xml = sr.ReadToEnd();
>
> XmlDocument xmlDoc = new XmlDocument();
> xmlDoc.LoadXml(xml); <!---ERROR...
>
> Message: "Could not find file 'C:\\Program Files\\Microsoft Visual Studio
> 8\\Common7\\IDE\\SomeWebServiceProvider.dtd'."
The solution depends on whether you want to load the DTD or not. If you
don't want to load the DTD then you should be able to solve the problem
simply by setting
xmlDoc.XmlResolver = null;
before you call Load or LoadXml.
Otherwise you need to implement a custom XmlUrlResolver that loads the
DTD from a location you control.
Also note that once you have a MemoryStream there is no need to use a
StreamReader first to get a string, you can simply pass the MemoryStream
to the Load method of XmlDocument.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
-
Re: Streaming web service response as byte array..dtd error.
Thanks!
"Martin Honnen" wrote:
> Dave wrote:
> > Hi, the following calls a webservice and returns the XML as a byte array
> > which I convert to a stream first. The 'xml' variable has XML, however, when
> > I try to load the XML into the XmlDocument, it can't find the .dtd file. See
> > error below....any ideas what I need to modify? Thanks, Dave.
> >
> > System.IO.MemoryStream stm = new
> > System.IO.MemoryStream(SomeWebServiceProxyclass.GetDataAsByteArray);
> >
> > stm.Position = 0;
> > System.IO.StreamReader sr = new System.IO.StreamReader(stm);
> > string xml = sr.ReadToEnd();
> >
> > XmlDocument xmlDoc = new XmlDocument();
> > xmlDoc.LoadXml(xml); <!---ERROR...
> >
> > Message: "Could not find file 'C:\\Program Files\\Microsoft Visual Studio
> > 8\\Common7\\IDE\\SomeWebServiceProvider.dtd'."
>
> The solution depends on whether you want to load the DTD or not. If you
> don't want to load the DTD then you should be able to solve the problem
> simply by setting
> xmlDoc.XmlResolver = null;
> before you call Load or LoadXml.
> Otherwise you need to implement a custom XmlUrlResolver that loads the
> DTD from a location you control.
>
> Also note that once you have a MemoryStream there is no need to use a
> StreamReader first to get a string, you can simply pass the MemoryStream
> to the Load method of XmlDocument.
>
>
> --
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/
>
Similar Threads
-
By Application Development in forum ADO DAO RDO RDS
Replies: 1
Last Post: 10-16-2007, 10:50 AM
-
By Application Development in forum Javascript
Replies: 1
Last Post: 09-07-2007, 07:20 PM
-
By Application Development in forum Adobe Acrobat
Replies: 0
Last Post: 12-21-2006, 04:38 PM
-
By Application Development in forum Adobe Acrobat
Replies: 0
Last Post: 12-20-2006, 04:30 PM
-
By Application Development in forum Java
Replies: 2
Last Post: 06-06-2006, 03:27 AM