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'."


0
dave871 (679)
11/15/2007 2:31:02 PM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
715 Views

Similar Articles

[PageSpeed] 16

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/
0
mahotrash (1778)
11/15/2007 2:54:28 PM
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/
> 
0
dave871 (679)
11/15/2007 3:59:01 PM
Reply:

Similar Artilces:

Verify Domain User account SPN error
Does anybody have any ideas where to look to solve the following error installing crm 3.0? "Verify Domain User account SPN for the Microsoft CRM ASP.NET Application Pool account." I hadsimilar errors. You need the SetSPN tool from the windows server registry kit. http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/setspn-o.asp has the tool. Then you need to register accounts in Active Directory. Good luck. took me like a week of searching trhough newsgroups to get my upgrade working. Perhaps you could also post the exact setspn commands you used. I have the ...

Service Packs for older versions of GP
I have a client who is running version 6.0 Ctree and we need to get them to GP 10 on SQL. I believe the best approach would be: 1. Apply SP12 for 6.0 2. Upgrade to 7.5 Ctree with SP7 3. Migrate to 7.5 SQL with SP7 4. Upgrade to GP 9 5. Upgrade to GP 10 6. Upgrade SQL I am having trouble getting my hands on the service packs for 6.0 and 7.5. They don't seem to be in partnersource. Does anyone know where I can download these service packs from? -- thanks, Jeff Winters, Rimrock Corporation -Microsoft Gold Partner -Dynamics CRM | Dynamics GP Jeff, If you are a Microsoft Par...

CRM Outlook client problem! Error 16930
Event Type: Error Event Source: MSCRMAddin Event Category: None Event ID: 16930 Date: 4/6/2006 Time: 16:53:09 User: N/A Computer: Computer1 Description: Initialization of the Microsoft CRM UI failed. Try restarting Microsoft Outlook. HR=0x80040154. Context=. Function=CAddin::HrActivateAddin. Line=505. For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. I have tried reintall CRM Client, reinstall Office XP, using new profile. Nothing works! Any ideas? We faced the same issue on an Outlook Laptop client. We installed the XML 4 SP2 and it ...

VB Executable as Web Application
I have good working knowledge of Excel VBA and am thinking of learning to create Web Applications. Without much knowledge in ASP.NET or PHP, and wanting to take the easiest path, I was wondering if it would be easier to just develop VB.NET executable applications (using MS Visual Basic 2008 Express Edition) as web applications. This would of course necessitate users to download the executable file and install it on their computers. Is this practice generally frowned upon, and has anyone gone down this path and with what pros and cons ? Thanks. If you have full trust on the user com...

Convert Publisher Web page for use on Bell (Canada) Web Hosting
I have created my dream web site using Publisher, followed the steps to convert it to a web site. When I try to upload it to my pre-arranged domain, using Firezilla, there is a problem. The Tech assistants at Bell tell be that Publisher is not Bell friendly, but that there is some magical way to create an index file that is acceptable. Does anyone have any insight into this problem? -- Can''t we get together on this If you are talking about http://www.bellhosting.ca/en/index.htm then it appears that the hosting plans have FTP uploading, so you must be making a mistake when u...

rpc errors every 10 days
I've got a weird problem. I have and E2k3 server and and E5.5 server in two different sites. Every 10 days I have to reboot the E2k3 server to get mail flowing between them again. Event log shows continuous RPC errors. Restarting Exchange services on either box doesn't fix it, nor does rebooting the E5.5 box; it takes a reboot of the E2k3 box to get everything working again, and mail flows perfectly for 10 days when, like clockwork, the RPC errors start again. Any ideas? I'm going crazy with this one! No KB articles regarding RPC errors seem to apply. Thanks, Scott On W...

sql200 SQLSERVERAGENT service won't start
Just started happening. Can't understand why. It uses the local system account to login but it can't login. Event Viewer application log states: "SQLServerAgent could not be started (reason: SQLServerAgent must be able to connect to SQLServer as SysAdmin, but '(Unknown)' is not a member of the SysAdmin role" Can anybody help? Rockitman (Rockitman@discussions.microsoft.com) writes: > Just started happening. Can't understand why. It uses the local > system account to login but it can't login. Event Viewer application > lo...

Video player for streaming
Hi, I have a problem with streaming video. I want to create a player for streaming video. For do it, I use the ActiveX control "Windows Media Player" but with it i can only open video file stored on the PC. I want buffering the video data in the memory and seeing the video in streaming. Is possibile do it whitout saving the entire data in a file? There are other solution to see a streaming video with VC++? PS: I realized the streaming using socket lib. thanks, bye ...

web access stops working
Hi NG We are using exchange on a windows 2003 SBS. The strangest thing happens. When the server starts up, outlook web access works for about half a minute, then stops working. Im suspecting that some slow starting process is killing it, but I cant figure out what happens. The error we get is quite simple: 500 Internal server error. No entry in the event viewer... any surgestions? - Kasper Any local AV with port blocking rules on the server? Or is there a local firewall installed? Nue "Kasper Birch Olsen" <i-wont-tell@no-spam.com> wrote in message news:uqRG%232oI...

Copy BYTE* to CByteArray
Hi, how can I copy an allocated buffer of type BYTE* (e.g. BYTE* buffer = new BYTE[200];) into a variable of type CByteArray? I could not find a solution in the samples provided... Best wishes, Peter "Peter Schmitz" <PeterSchmitz@discussions.microsoft.com> wrote in message news:7C7199FF-6117-4F03-B8B6-B4608C921B46@microsoft.com... > Hi, > > how can I copy an allocated buffer of type BYTE* (e.g. BYTE* buffer = new > BYTE[200];) into a variable of type CByteArray? I could not find a > solution > in the samples provided... CByteArray barray; barray.Set...

Playing video clip from stream
Is there any control that can be put on dialog and that can play .avi or ..mpeg video clip from a stream (IStream) instead of file or URL? DirectShow is the way to go with that. There might be some filters out there that you can use off the shelf, or with a little tweaking. AliR. "Sasha" <Sasha@discussions.microsoft.com> wrote in message news:90671BA6-3D94-47A3-B649-D1085623A16E@microsoft.com... > Is there any control that can be put on dialog and that can play .avi or > .mpeg video clip from a stream (IStream) instead of file or URL? ...

Employee Master Table error after V10 SP3
i have updated V10 to SP3, from SP1, and all seems to be fine except if I try to access the employee master table. Either from cards>payroll>Employee, or payroll transaction entry. Anytime I need to do a lookup on an employee id. Here is the message: A Get Change operation on table UPR_MSTR failed accessing SQL Data If I go to the more information or details button: [Microsoft][SQL Native Client][SQLServer] Invalid column name 'EMPLSUFF' [Microsoft][SQL Native Client][SQLServer] Invalid column name 'Dex_Row_TS' -- Doug It looks like an upgrade script failed...

Move Mailbox Error 2010
I am unable to move some mailboxes from Exchange 07 Server To Exchange 2010 Server. The error indicates that I do not have access rights. However the user id is in the Domain Admins AND Exchange Admin Group. What else is left? see error below... Error: Active Directory operation failed on taylor02.asp.webdev.com. This error is not retriable. Additional information: Insufficient access rights to perform the operation. Active directory response: 00002098: SecErr: DSID-03150A45, problem 4003 (INSUFF_ACCESS_RIGHTS), data 0 The user has insufficient access rights. Exchange ...

80070005 error
I am getting this error from system manager when trying to view property of public folder. This issue is same as what you can read from http://forums.msexchange.org/ultimatebb.cgi? ubb=get_topic;f=19;t=000114 I have already tried suggestion from the article. It seems there is no solution for this. Can anyone have a clue? ...

when trying to access CRM i get "0x80040E4D"-Error
hello board, i had a working installation of ms-crm 1.2 on a windows 2000 server (sp4), with ms-sql 2000 (sp3). all was fine. now i have updated this server to windows 2003. after the update i could not access the ms-crm-webiste anymore. i get http://server/_common/error/errorhandler.aspx?errNum=0x80040E4D displayed. when i search at google (groups) i found this anwer from this board: >This error tends to indicate that the SQL authentication is failing. One >suggestion I've seen is to add NT AUTHORITY\NETWORK SERVICE login access to >the DB and give it SA rights. I don't kn...

Archive skips store due to error
Hi all, I got a problem with Outlook 2000 SP3. When auto archiving, after a while, Outlook tells me: "Archive skips store due to error. Failed to open a source store. The information store could not be opened." Maybe somebody can help me cause I don't have any idea of how to solve that issue. I changed the pst file name for autoarchiving, I made a "Detect and Repair", I opened each mail to see whether one of them was corrupted... But nothing helped... Maybe somebody has a solution...? Thanks in advance, Jeremie. ...

saving to web page
I have a spreadsheet that I have grouped into different subtotals using the subtotals tool under tools. Is there a way to save this as an excel webpage and give users the ability to expand and collapse the groups in the same way that is available in the workbook? My closest attempts thus far have resulted in the columns being hidden in the webpage but not easily collapsed and expanded. Thanks j-rod --- Message posted from http://www.ExcelForum.com/ ...

bank transfer error numbers display from workbook to csv
Dear all, I have a an excel file 99-2003 workbook that includes bank code and salary details, it is required from me to save it as csv but when i do so all the account numbers are corrupted example 201018537554 but when i open in csv it shows 2.21037E+11 Please help the bank is rejecting my applicatio due to the unredable numbers and plus how can i get a number that contains 0000031456789 and keep the zeros once it is in a number format it will only work when i use the special format num portugese "numero de seguranca social" Please help You should convert your numbe...

This message uses a character set that is not supported by the Internet Service.
This message uses a character set that is not supported by the Internet Service. To view the original message content, open the attached message. If the text doesn't display correctly, save the attachment to disk, and then open it using a viewer that can display the original character set. <<message.txt>> Any idea's how to resolve this, can't view the message? ...

reading and writing xml using a tcp stream
Hi, I am writing a client/server application with a desktop and a pocketPC which transfers a xml string which is to be loaded by a dataset on the client. the server uses this code to prepare and send the xml: Dim stringbuilder As New StringBuilder Dim textwriter As StringWriter = New StringWriter(stringbuilder) Dim xmltextwriter As New Xml.XmlTextWriter(textwriter) xmltextwriter.Formatting = Xml.Formatting.Indented Dataset.WriteXml(xmltextwriter, XmlWriteMode.WriteSchema) 'this is the connection to the client Dim w As New IO.StreamWriter(mobjClient.GetStream) ' the &qu...

Get Xml from web .
This is a link to an address where I would like to access xml. http://setiathome2.ssl.berkeley.edu/fcgi-bin/fcgi?cmd=user_xml&email=XXXX The XXXX is the email address of a user. All I want to do is access the xml and view it in a datagrid. I have read several tuturials and articles and have not been able to find something that would explain how to do this. Does anyone know of a sample code or something close I could use as a reference. I am using visualstudio.net. and visual basic. THX Take a look at using the following classes on your app: HttpWebRequest HttpWebResponse DataSe...

timeout expired error when creating new activity
When a user attempts to create a new activity the following error is generated on the CRM server. MSCRM Platform Error Report: -------------------------------------------------------------------------------------------------------- Error: Timeout expired Error Message: Timeout expired Error Details: Details on this error have not been provided by the platform. Source File: Not available Line Number: Not available Stack Trace Info: at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain() at System.Web.UI.Page.ProcessRequest() at System.Web.UI....

VC++6.0 Memory reference error
Hi I am developing n activeX control in VC++ 6.0 using MAPI , 50% of the times when I execute my application using ActiveX Test Container (or sample VB project) I get a memory reference error , however other 50% of times it runs just fine. I am really not sure what is the reason of this error message. Why this error occours half the time and why the application runs fine the rest of the time. Error details are as follows : Error : "The instruction "<hexadecimal number>" referenced memory at "<hexadecimal number>". The memory could not be "read&quo...

Wild Card in response
In a report / Query, I'd like for the database to recognize all inputs that are similar to the field. In the Query I am putting [Title?]. What do I need to add so the responses will e.g. include all titles that include the word "happy"? -- Glenda On Thu, 20 May 2010 12:17:01 -0700, Glenda <Glenda@discussions.microsoft.com> wrote: >In a report / Query, I'd like for the database to recognize all inputs that >are similar to the field. In the Query I am putting [Title?]. What do I >need to add so the responses will e.g. include all titl...

link up accts from mymoney and msn money on web
Currently using MNY2004, and trying to download creditcard stmts(macys credit account) into my mny file from msn money web site, but it does not link up. So by upgrading to MNY2007, would I be able to acheive it. Using url : http://www.microsoft.com/money/bankonline.aspx, to determine whether my CreditCard Company(macys credit account) is results in a windowthat states: Statements Direct Services* are the fastest, easiest way to connect with your financial institution and have your statements automatically downloaded into Money. * This service is provided by a third party provider, n...