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 (680)
11/15/2007 2:31:02 PM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
808 Views

Similar Articles

[PageSpeed] 26

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 (1777)
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 (680)
11/15/2007 3:59:01 PM
Reply:

Similar Artilces:

Web Query question
I am trying to download stock options through the following vba code, however i am having problem with separator between "m" field which is month and "s" field which is stock symbol, I appreciate any help i can get, With ActiveSheet.QueryTables.Add(Connection:= _ "URL;http://finance.yahoo.com/q/op?s=" & Range("b1").Value;&m=2010-05", Destination:=Range("$A$11")) thanks david I think you are mising (at least) one quote? Reg Migrant "David" wrote: > I am trying to download stock optio...

error sending from 5.5 to 2000
When a user sends from an exchange 5.5 mailbox to a user in exchange 2000, they receive the following error: The message was undeliverable because the recipient specified in the recipient postal address was not known at this address The MTS-ID of the original message is: c=US;a= ;p=Express-Scripts;l=TEMMS014-041001192533Z-210060 <mail5.express-scripts.com #5.1.1> The same user on the 5.5 server can send to other users on the 2000 server. I looked the error up in technet and got 3 kb articles with only 1, kb295377 being anything close to my problem. I checked the entr...

When launching Outlook I recieve the following error... please he
When launching Outlook 2003 I recieve the following error: The add-in "C:\PROGRAM~1\SPAMBL~1\Bin\461~1.0\SBOLExt.dll" could not be installed or loaded. This problem may be resolved by using Detect and Repair on the Help menu. I ran the Detect and Repair and that didn't work. I ran the repair option from Add and Remove Program in Control Panel and that didn't work. I also un-installed and then re-installed Outlook 2003 and that didn't work. I'm running Windows 2000. Any ideals...? Did you have something possibly called SpamBlocker installed at some point?...

Money 2006 file repair application error
I cannot delete an old account because I get a "file may be courrupt" error so I am trying to repair my 2006 file. Following the deirections, when the progress bar almost completes, I get an application exception and send an error report to MS. My event log has 2 app errors 1) Event Type: Error Event Source: Application Error Event Category: None Event ID: 1001 Date: 4/12/2006 Time: 10:47:26 PM User: N/A Computer: xxx Description: Fault bucket 02266399. For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. Data: 0000: 42 75 63 6b 65 ...

Error #2950
Hi, I have three tables from which data I use to create a single table. The data is entered into the three tables via a form. I have a macro set up to create/update the single table through some make table queries and update queries of data within the first three tables. I have this macro tied a close form event and I keep getting a 2950 error when in a multiuser environment however the macro works in a single user envioronment. I only really need to have the single table updated daily. Do you have any good tips on error handling procedures so I can skip running of the qu...

Clip art works on first try from web then doens't.
Alright I am back. I got something to come up for the web collections clip art now but it seems to only work the first time I do a search right after I open the program, after that I either get a bunch of picture symbols with the little globe in the corner or I get nothing. This clip art thing is really driving me crazy. Anybody know what is up? ridergroov <ridergroov1@comcast.net> was very recently heard to utter: > Alright I am back. I got something to come up for the web collections > clip art now but it seems to only work the first time I do a search > right after I ope...

Operating a small passenger service
I am hoping someone has managed to customise outlook in a way that allows you to use the programe to manage bookings on a small passenger service. I.e input a new booking, number of people, location etc. Then email the days bookings to the different drivers. Maybe it could also be set up to know how many seats are avialale to reduce the risk of double booking? Im using Outlook 2003. ...

is DCOM error 0x00080012 (Not all the requested interfaces were available) not an error ?
Im checking the return value of a DCOM call by using the macro: FAILED(HRESULT). One particular function call returns the error 0x00080012 (Not all the requested interfaces were available) if the DCOM service is down. Calling FAILED with this HRESULT returns false, meaning that it isnt an error! I think it should be reported as an error as my program cannot call ANY interfaaces beyond this point and crashes. The FAILED macro checks the HR to see if it is negative and 0x00080012 is positive!? Any suggestions? Thanks Andy ...

Exchg2003 First Storage Error
Exchange Enterprise 2003, SP1 on Win2003 - When I attempt to view the mailbox information store within First Storage Group I get an error (Id no. 80040d1b). The only ref. to this error I have found is: http://support.microsoft.com/default.aspx?scid=kb;en-us;817309 - checked my registry & server - they match; registry looks fine. I also am getting Veritas Exchg Info Store errors - "database corrupted". I ran the Eseutil defrag - ran successful, but still can't see mailboxes. I found MS tech net info that suggests re-installing Exchange (to repair): http://www.micr...

Error saving a Shared Workbook
I have a user using a shared workbook and gets an error everytime she does this ONE specific change. She deletes a line and then saves and gets a message that says, "EXCEL.exe has generated errors and will be shutdown by Windows... blah blah blah". If she makes anyother type of changes it saves just fine. I also had another user do the SAME change and that person also got that error message. When the file is changed to "Not Shared" then the line is deleted it saves fine also. The problem is obviously with the file itself and that is shared out. can anybody ...

SMTP service stalled
Hi, We're running Exchange 2003 SP2 on Windows 2003 R2 which doubles as a secondary domain controller. We are periodically running into an issue where e-mail is not able to come in or go out and attempting to restart the SMTP service results in an error that the service did not respond in a timely manner. Rebooting the server fixes the problem temporarily until it occurs again, usually several days later. I'm assuming it's a memory issue, but the performance monitor shows that there is a minimal amount of memory in use (4 GB total, 3 GB free). Once service is restored it ca...

Outlook error message #4
Microsoft Visual C++ Runtime Error. What's the problem? ...

web preview not same as publisher view
Reading past postings it appears others too are having serious problems with Web preview in both 2002 and 2003. I think the problem is that text handling within text boxes in normal Publisher view simply does not reflect that as seen in Web Preview (currently Explorer 6) On a totally blank (wide setting) webpage, using standard Times New Roman 12pont (no italic underline or bold) I typed six lines of Mary had a little lamb into a 3.85x3.029cm text box with all margins set to 00. I outlined the box with a 1/4pt line Whereas the text just fitted into the box in Publisher view, in Web ...

Error Code 80070424 12-21-09
I keep getting this Windows update error every time I boot my PC. In the window, it says Windows can't check for updates. Does anyone have any ideas? Recently I installed BitTorrent so could that be my problem? "Norm" <Norm@discussions.microsoft.com> wrote in message news:D2E5CF0C-D31B-4034-B4A8-A8204763A623@microsoft.com... > I keep getting this Windows update error every time I boot my PC. In the > window, it says Windows can't check for updates. Does anyone have any > ideas? > > Recently I installed BitTorrent so could that be my proble...

Installation errors. 01-09-04
I'm setting up CRM 1.2 on a completely clean test environment of windows 2000 servers. Near the end of the installation a message pops up "Setup was unable to register the security service." What could be causing this The usual story: To get the MCCRMSecurityService starting, have you tried re-registering it as follows: On your crm server, at command prompt, go to program files - microsoft crm - bin, then run these commands crmsecurityservice -u crmsecurityservice -r -s Peter Lynch "J. Bridger" <Bridger@nospam.ofllc.com> wrote in message news:0aa001c3d6...

Error in Code
Following is some VBS code I have in my Custom Form developed in Outlook 2003. Line 61 is giving me an error stating: Object doesn't support this property or method: 'Item.GetInspector.ModifiedFormPages' Line No: 61 If you look Line 51 is the same method and it works fine. The funny thing is when I run the code, I get the error, I continue on to the Form, and the code after it works. The code that follows line 61 is dependent on line 61 as evident by if I ' comment it out, I get a separate error asking for objPage2. The code also works if I change the value of one of...

Active X error
I have tried removing the signature, unchecking the Smart Tags, changing the editor to Plain Text as well as to Rich text all to no avail....here is the error one of my users gets when she tries to send and email from Outlook - she can receive just fine: "One or more ActiveX controls could not be displayed because either: "1) Your current security settings prohibit running ActiveX controls on this page, or "2) You have blocked a publisher of one of the controls. As a result, the page may not display correctly." ...

Serializing array of userdefined types
Hello, I want to have a class that contains only a collection of another class. For example: public __gc class Alignment { public: Alignment(); ... }; // Probably using XmlIncludeAttribute such as this is wrong... [System::Xml::Serialization::XmlIncludeAttribute(__typeof(Alignment))] public __gc class Alignments : public System::Collections::ArrayList { public: Alignments(); ... }; I figured I could use Alignments like this: Alignment* alignment = new Alignment; Alignments* alignments = new Alignments; alignments->Add(alignment); BTW, I am using XmlSerializer and XmlTextWriter....

Errors found Code 80070490
This appears to be one of those problems that no one seems to have a working solution. Reinstalling an operating system is not a solution it’s a reason to change operating systems. This type of problem was not supposed to happen with Vista. Let’s see some big guns on this one! Update Error: Some Updates not installed: 2 Failed updates (KB967723, KB972145) Errors found Code 80070490 (Unknown Error) Problem signature: Problem Event Name: WindowsUpdateFailure ClientVersion: 7.4.7600.226 Win32HResult: 80070490 UpdateId: AE2C61ED-AC12-4369-BED6-4375CD79CA...

OWA - change password
Getting the "Object Required" error, when somebody is trying to change their password through OWA. (Win2003/Ex FE 2003) Any ideas what could be causing this? TIA! / Per Did you follow the steps in: http://support.microsoft.com/kb/297121 ? -- Pablo D. Vernocchi Microsoft Exchange MVP MCSA + M / MCSE + Sec https://mvp.support.microsoft.com/profile=8E94A6C0-F6D9-4686-96D5-04230CC0141F http://www.itpros.com.ar http://www.msglue.org http://msmvps.com/exchangebloglatino "Per Hagstrom" <per.hagstrom@swic.eduNOSPAM> wrote in message news:Ojo%23EozNHHA.1240@TK2...

iisadmpwd change pw gives error
Just cannot get password change to work on Exchange2003 (front-end server) & IIS 6.0 Is this a known issue Any help would be greatly appreciated. It could be that you are not (yet) allow to change your password either because password change is prohibited or because user has to wait for x days before he is allowed to change his password (domain policies). Whenever you reset a password for a user and the 'Cannot change pass before X days' is enforced, the user is not allowed to change it. David. "ss" <anonymous@discussions.microsoft.com> wrote in message news...

VLookup #VALUE! error help needed to resolve
The following is the funcation I have: =VLOOKUP(B10,'FA CC Summary Report 1141'!F$9:G$92,2,0) I have all the columns formatted the same; as in the column that the function is using to lookup is text and so is the column for this figure in order to pull back the appropriate answer. I have keyed the data instead of having links. I have replaced the final '0' with TRUE & FALSE then put it back. I have formatted the columns for text and for numbers. But I am getting the #VALUE! error in SOME of the cells NOT all of the cells. I don't know what else to d...

Import excel named range into Access error 3011
Hi, I've read a few posts on this topic, but none addresses my particular problem. I use Office 2003 on an XP SP3 machine. I am using transferspreadsheet to import a named range in an excel file into Access. This has worked beautifully until suddenly it stopped working. I find now that if I extract the address of the named range from within the Access VBA code, it looks like this: =#REF!$A$1:$Z$166 rather than this, which is what it should be: =Data!$A$1:$Z$166 When I open the spreadsheet and get the address of the named range in the immediate window, it also has the #REF error....

'Incorrect username/password' error, even though both are correct!
Version: 2004 Operating System: Mac OS X 10.4 (Tiger) Processor: Power PC I've installed a G5 running Tiger on a network in our London offices, it's the first Mac I've put in there. It auto-configured its net connection, MSN and shared drives without me doing a thing - but Entourage hasn't been so simple. As with my own set up back at base I have configured Entourage to pick up mail from the server (Windows Server 2000) using POP but here it's not working (I've tried using Exchange too - without luck) I just keep getting an 'Incorrect username/password' error. ...

Odd attachment error
This has only started occurring today. I am able to open all my attachments, with the exception of any attachment that consists of the same file name "resume.doc" of which I receive 100s of this name. I am repeatedly receiving the "...check folder permissions" error. I have renamed all other files with this name, but nothing changes. I'm using WINXP and Outlook 2003. Check your C:\Documents and Settings\<<username>>\Local Settings\Temp folder. With Outlook and all other apps closed, try deleting all the .tmp files beginning with ~ in this folder. Res...