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
796 Views

Similar Articles

[PageSpeed] 47

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:

c10306a7 error when access public folders
While access public folders through Exchange Admin, I get the following error: _ The available memory is not sufficient. Close some applications or windows and try again. ID no: c10306a7 Exchange system manager - This is a 2000 server standard running Exchange 2003 enterprise (upgraded from Exchange 2000) This error message was happening in Exchange 2000 as well, and I was hoping the upgrade would resolve the issue. This error message prevents me from access public folders and performing any maintenance. I am guessing this is more of a rights issue rather than a memeory issue. I have ...

multi-page document published on web as one document
how do i publish my multi-page publisher doc on my website w/o needing to convert each page to web format??? (for example, my monthly newsletter.) thanks in advance! ron ps: i'm using ms pub 2003 and fp 2003. revron wrote: > how do i publish my multi-page publisher doc on my > website w/o needing to convert each page to web format??? > (for example, my monthly newsletter.) > > thanks in advance! > > ron > > ps: i'm using ms pub 2003 and fp 2003. ======================================= Maybe converting to a .pdf would be an alternative? -- John In...

excel encounters an error when editing comments
I've tried repairing, uninstalling & reinstalling excel but I can no longer edit comments in one of my Excel spreadsheets. Each time I hover over a cell with a comment, Excel crashes. On rare occasions, rebooting fixes the problem but not for long. I also have the same problem with another Excel file in which I created a graph. Hi, Annie. Try these: http://www.officearticles.com/excel/troubleshoot_your_workbook_in_microsoft_excel.htm ************ Anne Troy www.OfficeArticles.com "AnnieJ" <AnnieJ@discussions.microsoft.com> wrote in message news:730AABE6-6F67-447C-...

Error when loading crm default page
Hello, when loading my crm default page i've got this error: Microsoft CRM Unhandled Error Details: Server Error in '/' Application. -------------------------------------------------------------------------------- Badly Formed FieldXml: Field name itau_company Does not correspond to any Attribute on Entity: contact. Field Xml = <field name="itau_company" requiredlevel="na" maxlength="100" format="text"><displaynames><displayname description="Company" languagecode="1033" /></displaynames></f...

error when connecting to internet
Money 2001 worked fine for several months, but now when I try to connect to setup an account or download a statement, an error pops up and the program closes. That's nice. Seriously, was there a question here? What is the error that pops up? What have you tried to do to fix this? What happened then? What has changed in your environment? Has you ISP environment changed? What kind of connection do you use? Does this behavior duplicate in the sample file? (Lots more possible questions come to mind.) We try to help here, but we are not psychics. (Psychotics, maybe...) "Laura" ...

Appointment Accepts and Responses, Forwards do not go
I just received an e-mail appointment. Kind of neat in one sense, broken in another. All I had to do was click the accept button and it but it on my calendar. However, the response I tried to send with that acceptance didn't go through. Outlook leaves it in my outbox giving me a message to check my internet connection (all is fine with it). I had to respond separately saying I had accepted the appointment (that e-mail went through perfectly). I then tried to forward the appointment to someone else. That e-mail didn't go through either. I am using WinXP Pro with Office 2003 (Outl...

Unknown Message Header & Pop3 Error Message
Windows Live Mail: I will start with 2 problems out of many. I get messages with unknown in the header. What could be causing this? I have messages popping up, at what I have now set at 120 seconds, that my pop3 server has not responded. How do I fix this? Why does Microsoft think they more about program interfaces than the people that actually use the programs? I am sure people like WLM but I do not. I wonder how Microsoft could be made to realize some people would like an OE6 for Windows 7. I am running Windows 7 Professional. -- <Bill> Brought to you f...

Cell information error
I type a numerical date in a cell but when I move the cursor, a string of "#" signs appear. Have you tried to widen your column? "UnWiz Kid" wrote: > I type a numerical date in a cell but when I move the cursor, a string of "#" > signs appear. ...

retoring error
'C:\Program Files\Microsoft Money\YourData.mny' is corrupted or is not a Money data file. Make sure you are opening a file with an MNY extension. If you have chosen the correct file and it could not be accessed, you will need to open your most recent backup file to access your data. I have always had only one version of Money (2001 Deluxe). I can open most backup file with the exception of the one I need that dates back to 2001. Why can't I open a certain backup file? In microsoft.public.money, dts wrote: >'C:\Program Files\Microsoft Money\YourData.mny' is corru...

When choosing default file location get error "the folder is not valid"
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel I am trying to specify a networked drive as the default file location for my Word documents. I can open files from the drive within Word, and I'm connected to the server/network drive. But when I try to specify it as the default location I receive this error. That's amazing: Your post has already been copied to six websites that are stealing our content :-) I do not know the answer for sure, but I "think" there is a hard-coded check in there that specifies that a network drive cannot be us...

Web client 03-11-05
We have a client with a mix of Windows 2000 and Windows XP machines. All 15 computers have no problem opening and using the web client, APART from 2 machines, one XP and one 2000. The entire network is on one domain and runs through one switch. The problem pc's can use all network resources and log on correctly and browse the web. The firewall/pop-up securities are identical on all pc's as they recieve these settings off the server via a group policy. When you type the host header 'crm' in the bottom left of the window you see it referancing http://crm and then it goes ...

user manager error 05-12-04
i can't run the user manager within deployment manager. It tells me the localhost is unavailble or i don't have permissions. I am running sbs 2003 premium server, i have checked the tech knowledge and found a similiar problem related to the integrated security on the website, but i followed the instructions and still nothing. I think it is a permission thing, but i honestly don't know where to begin. Please give me some insight! Jim Are you able to access the web client? Did you assign a license to the user you used when you installed the app? Matt Parks ---------...

Error #4
I try and use Outlook and get this message: Unable to display the folder. Errors have been detected in the file C:DOcuments and Settings/Dawn ____/Local Settings/Application Data/Microsoft/Outlook/Outlook.pst. Quit all mail-enabled applications and then use the Inbox Repair Tool. >I try and use Outlook and get this message: Unable to >display the folder. Errors have been detected in the >file C:DOcuments and Settings/Dawn ____/Local >Settings/Application Data/Microsoft/Outlook/Outlook.pst. >Quit all mail-enabled applications and then use the Inbox >Repair Tool. Fo...

suddenly getting SMTP errors with Outlook -- cannot send out mail
I use ATT Worldnet thru an outside DSL provider (Verizon). I can receive mail just fine (so no POP problem). But SMTP is screwy and I do not know why. This began happening last night -- intermittently. Today -- nothing will go out. (I have had this system, Worldnet + VZ DSL, for two-three years, and never had this problem before. Using Outlook XP with WinXP. The Verizon mail works perfectly) here are the two errors I get (sometimes one, sometimes the other, sometimes both): 1 Task 'albert - outlook - ipostoffice.worldnet.att.net - Sending and Receiving' reported error (0x800CCC...

Help with 0x800CCC0f error in Outllook XP and OE 6
I am helping a friend. This is on an HP laptop running WinXP Home edidtion. When tring to setup OL, we "tested" his setting, the bottom two items failed with a 0x800ccc0f error. I have deleted and recreated his account (same setting work fine on desktop, both going through the same router) I get the same thing. I then tested with OE 6 and had the same results error 0x800ccc0f. I worked with the ISP, and left them scratching their head. I have tried eliminating the router and going straight to the cable modem, same results. we have done a cold reboot, same thing, we dis abled AV, ...

Outlook 2007 password storing error
I'm sporadically and frequently getting a popup asking to enter my pop-server password even though its saved. It happens to random email accounts. First: System and background: Win7, Outlook 2007 Enterprise, POP server (owned domain at hosting service). Win7 was a clean installation and had no issues until a couple days ago. I've read just about everything I can find and here is what I've done, none of it having worked: -Deleted every mailbox account and rebuilt them -Deleted the PROTECT folder -Removed all anti-virus software -Did a System restore to ...

Toggle button code to insert user response into template
Hello, I've created a User Form to create content for a letter. This is the first time I've ever used VB - I'm a complete Newbie - and I've had a lot of help using an article I found online. I have included toggle buttons in the form and what I would like them to do is insert text into the letter when they're selected, but if they're not selected, then the space where the bookmark is in the letter remains blank. This is the segment of code that concerned the toggle button and what the bookmark was supposed to fill in with: If togPartAwardsText.Value ...

Exchange services start order
I have Exchange 2003 on WK3 server. If I were to stop the Exchange services manually, what order would I start them? On Thu, 20 Oct 2005 13:19:55 -0400, "Spin" <Spin@spin.com> wrote: >I have Exchange 2003 on WK3 server. If I were to stop the Exchange services >manually, what order would I start them? > It doesn't really matter so much as they're dependencies will start them. Make sure all the IIS services are running so start the SMTP and WWW first which will ensure the IIS Admin comes up. The start the Exchange SA, then the MTA and then the IS. There ...

Version error
Hello all. I'm getting this error Missing mandatory attribute 'version'. with the below XML <?xml version="1.0" encoding="UTF-8"?> <rs:data xmlns:rs="namespace_for_rs" xmlns:z="namespace_for_z"> <z:row PageID="index.aspx" ParentID="0" PageTitle="Home" PageAddress="../Index.aspx"/> <z:row PageID="aboutIndex.aspx" ParentID="0" PageTitle="About" PageAddress="../about/aboutIndex.aspx"/> <z:row PageID="customers.aspx" ...

Opening Email Web Link In New Window
First off, I know about the "solution" to this problem wherein you go to IE's Tools->Internet Options->Advanced and uncheck "Reuse Windows for launching shortcuts". My problem is I use Mozilla and Mozilla doesn't control hyperlinks in Outlook. I hate to get legalistic about this, but the annoying "solution" everyone has to adopt to keep Outlook from trashing their web browser sessions is not only indicative of Microsoft's incompetence, but isn't this an anti-trust issue as well? Why couldn't the Outlook team simply do what IE does when...

WIndows Xp 64 bit Service Pack
How many service packs are there for windows xp 64 bit "Tom_AF7J" wrote: > How many service packs are there for windows xp 64 bit Two. Two. Tom_AF7J wrote: > How many service packs are there for windows xp 64 bit ...

Outlook can't connect to Exchange (Terminal Services)
Howdy! Interesting problem here for you all! Got a Windows 2003 SBS. This guy is taking care of Exchange, OWA, SharePoint and Terminal Services Licensing. Also have a Windows 2000 Server, this guy takes care of Terminal Services sessions and it's also a File Server (Local and TS) A little bit of background: The Windows 2000 Server was until recently the Terminal Services Licensing server as well (It wasn't part of the SBS Domain), but since we want the Terminal Services users to be able to use Outlook 2003 we end up joining the 2000 Server to the SBS Domain. And here is where e...

Reading data into a 2 dimensional array
I want to analyse data in a 2 dimensional array but don't know how to get the data from the spreadsheet into the aray. In the old days of GWBASIC I would use the following lines: Dim Table(100,4) For I = 1 to 100 : For J = 1 to 4 Read Table(I,J) Next J : Next I I know macros can handle FOR/NEXT loops but how do you 'READ' the data that is, say, in the range A1:D100 ? Thanks in anticipation. See if the following 2 examples explains what you need. Note that you simply declare a variant and assign the range to the variant. Have included the Lbound and Ubound...

"Unnamed file contains an invalid path" error
Hi, My application creates a directory in InitInstance() before ProcessShellCommand(). It throws the error "Unnamed file contains an invalid path" when ProcessShellCommand() is executed. Iam totally stumped by this weird error. There is not enough documentation on this and I have no clue what it is or what to do. Plz help. Thanks. Without knowing what your command line looks like, it is impossible to guess what is going on here. Show some code, and better still, use the debugger to examine the command line. joe On Thu, 30 Oct 2003 09:26:10 -0800, "Practical Soul...

How to display 2D-Array as Bitmap??
Hello everyone, i'm new to windows programming in C++. I have to display a 2-D array as a bitmap. I tried to compile the following code..but the compiler doesnt identify the CBitmap class...can anyone tell me what is missing (headers/functions) so as to complete the code?? HDC dc= ::GetDC(0); int Bps = ::GetDeviceCaps(dc,BITSPIXEL); ::ReleaseDC(0,dc); int size = 100*100*Bps/8; BYTE *bbits = new BYTE[size]; //-------------bbits is a 2D(100*100) array memset(bbits,192,size); CBitmap bitmap; bitmap.CreateBitmap(100, 100, 1, Bps, bbits); BITMAP bmp; bitmap.GetBitmap(...