VC++ .NET 2003: XmlTextReader Errors C2144 & C1004

Hi all,
I read the Microsoft KB Q815658 "How to read the XML data from a file using 
Visual C++ .NET" and tried to follow the steps of executing its source code 
in my VC++ .NET 2003  under Console Application (.NET). I lauched a project 
'Q815658XMLRead' (see the attached .cpp file below) and did the "Build" and I 
got the following 2 errors: 
c:\Documents and Settings\Scott H. Chang\My Documents\Visual Studio 
Projects\Q815658XMLRead\Q815658XMLRead.cpp(13): error C2144: syntax error : 
'int' should be preceded by ';'
c:\Documents and Settings\Scott H. Chang\My Documents\Visual Studio 
Projects\Q815658XMLRead\Q815658XMLRead.cpp(13): fatal error C1004: unexpected 
end of file found
Please help and tell me where I made mistakes and how to correct these 2 
errors.
Thanks in advance, 
SHC
/////////---Q815658XMLread.cpp----////////////
// This is the main project file for VC++ application project 
// generated using an Application Wizard.

#include "stdafx.h"
#include <tchar.h>

#using <mscorlib.dll>
#using <system.xml.dll>

using namespace System;
using namespace System::Xml

int _tmain(int argc, char* argv[])
{
    XmlTextReader* reader = new XmlTextReader ("books.xml");

    while (reader->Read())
    {
        switch (reader->NodeType)
        {
			case XmlNodeType::Element: // The node is an element.
				Console::Write("<{0}", reader->Name);

                while (reader->MoveToNextAttribute()) // Read the attributes.
					Console::Write(" {0}='{1}'", reader->Name, reader->Value);
				Console::WriteLine(">");
                break;
			case XmlNodeType::Text: //Display the text in each element.
				Console::WriteLine (reader->Value);
                break;
			case XmlNodeType::EndElement: //Display the end of the element.
				Console::Write("</{0}", reader->Name);
				Console::WriteLine(">");
                break;
        }
    }
    Console::ReadLine();
}

0
SHC (25)
4/23/2005 6:27:02 PM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
553 Views

Similar Articles

[PageSpeed] 31


SHC wrote:


>  I 
> got the following 2 errors: 
> c:\Documents and Settings\Scott H. Chang\My Documents\Visual Studio 
> Projects\Q815658XMLRead\Q815658XMLRead.cpp(13): error C2144: syntax error : 
> 'int' should be preceded by ';'
> c:\Documents and Settings\Scott H. Chang\My Documents\Visual Studio 
> Projects\Q815658XMLRead\Q815658XMLRead.cpp(13): fatal error C1004: unexpected 
> end of file found
> Please help and tell me where I made mistakes and how to correct these 2 
> errors.

> using namespace System;
> using namespace System::Xml
                             ^^^
There the semicolon is missing, you need
   using namespace System::Xml;
according to the error message.


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
0
mahotrash (1778)
4/24/2005 12:38:09 PM
Hi Martin, Thanks for your response.
I corrected the error and did the "Build" again. On the c:\ screen, I got 
the following: Microsoft Development Environment
               An unhandled exception of type 'System.Xml.XmlException' 
occured
               in system.xml.dll
               Addtional Information: System error
                |Break|    |Continue|
I clicked on the |Continue| and I got the following:
     "c:\Documents and Settings\Scott H. Chang\My Documents\Visual Studio
         Projects\Q815658XMLRead.........
      unhandled Excetion: System.Xml.XmlException:
        The XML declaration is unexpected.
          Line 1, position 4
           at System.Xml.XmlTextReader.ParseTag<>
           at System.Xml.XmlTextReader.ParseRoot<>
           at System.Xml.XmlTextReaderRead<>
          at main (Int32argc, SByte ** argv) in 
       c:\documents and 
settings\.....\.....\q815658xmlread\q815658xml.cpp:line 17
The Line 17 in my .cpp program is "while   (read->Read())".

I am new in VC++ .NET 2003 and XML programmming in VC++ .NET. I just have my 
VC++ .NET 2003 installed and this "Q815658XMLRead" is my first XML 
programming project.  I need to tell you the following 2 things:
1) When I read the Microsoft Q815658:How to read the XML data from a file by 
using Viusual C++ .NET, I saw the step #6: Add a reference to System.xml.dll 
in the project and the additional information is in the article of the 
Microsoft Knowledge Base: 310674 - How To Add reference to a managedVisual 
C++ project. I read it, but I did not understand it and I did not do any 
thing about the "reference" in my project.
2)In the original code lisiting, void _tmain(void) was used in my project. I 
changed it to int _tmain(int argc, char* argv[]) - this is based on my 
guessing!!!

Did 1) and 2) cause the problem in my project?  Please hehp and advise me 
how I can correct the problem and make the project working for me.

Many Thanks,  
SHC

P. S.  I itried to abort my "Build" process after 'Debug' and 'Break'. I 
clicked on the 
        "Build" menu, I just saw 'Configuration Managert' only and I do not 
know how
         to abort this process now.   Please advise on this matter also. 

 
0
SHC (25)
4/24/2005 6:39:02 PM
Reply:

Similar Artilces:

"Insert Item" in Outlook 2003 is not available in the Insert menu
The "Insert Item" to attach a mail is available when one clicks the "paper clip" icon which shows "file" and "item"; however using the "Insert" pull down menu, an "Item" can not be attached, as this option is not available. Thus to attach an email received, the only option is to click the paper clip menu. For a new user, this is difficult to spot. Suggest inclusion of Item as an option in the Insert menu, so as to maintain consistency. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the sug...

To use xml files in vc++ resource editor..
Hi..please tell how to use xml files in vc++ resource editor so that we can access it from our application..Thanks What exactly you goin gto do with that XML file -- With Regards Alok Gupta Visit me at http://alok.bizhat.com "I think this will Help" "Mncyb2004" <Mncyb2004@discussions.microsoft.com> wrote in message news:FBC6EF97-1B6F-4012-9FAA-6B437EBC0AD8@microsoft.com... > Hi..please tell how to use xml files in vc++ resource editor so that we can > access it from our application..Thanks The question is a little vague. Do you...

Downloading Templates for Excel error with a windows error.
I have been trying for months to download some of the Excel templates of the Microsoft Office Online site but continually get an error message that Windows has encountered a problem and needs to close. The message is showing up after Excel has been opened and the active x download window has closed. I am using Excel 2000 with SP3 on Windows XP pro SP2. I also get the same error with Windows XP Home SP2. Any ideas on how to resolve this issue? Thanks, Lanie Moore ...

Excel Add-Ins 2002 to 2003
Hi all. I have a query regarding using Excel add-in written in Visual Basic in Excel 2003. We have this add-in, which was originally written for excel 2000. I was not involved in developing it and nor am I that familiar with visual basic. Till recently, it was being used with excel 2002. A few weeks ago our computers were upgraded to office 2003, and hence also excel 2003. Now the add-in has stopped working. When the visual basic editor pops up during debugging I can see that some libraries have been moved around. I looked under Tools-References and there are two that are marked as missing:...

Outlook 2003/Exchange 2003 & POP3 Mail
We have an Exchange 2003 server and use Outlook 2003 on client PCs. Presently the client OL2003 check for internal mail via Exchange 2003 and use an external account to check POP3 mail hosted by an ISP. How do I get Exchange 2003 to go out to the ISP and check for client mail and then deliver to my OL2003 clients? I have about 50 users and cannot for the life of me see how this can and should be done. Thanks. -- J, a rookie system admin Get off the ISP's POP3 server and route the inbound external mail to your Exchange mailboxes! You'll need to open smtp port to your Exchan...

FAiled instalation of Exchange 2003
I have just arrived on site and found some one has tried to install exchange 2003 in the domain and then just deleted all the objects before they left. This is now causing great problems, as I have reinstalled exchange 2003 but it, believes that there is a virtual site "old server name” and I can not get rid of it. Every time I create a mail box it does not appear anywhere. Could anyone point me at an article that shows you how to undo all forest and domain preps from your AD so that I may redeploy this server in a working state? I have removed my new server by running the remoevor...

publisher 2003 #30
How do I scale A4 to print as A3? kate wrote: > How do I scale A4 to print as A3? This would be a function of your printer driver, not Publisher. I assume your printer can print to A3? ...

Minimum Exchange 2003 for CRM 1.2?
Hello We are trying to setup a test deployment of CRM 1.2 for 5 users We (parent organisation) already has a email system (UNIX , pop, smtp) in place. I wish to learn what is the minimum Exchange setup that I need to do to deploy the test environment Is there a way to to configure the Exchange server such that it still uses the parent email system and still be used with the CRM thank you very much for your help vikrantca Hello, vikrantca wrote: > We are trying to setup a test deployment of CRM 1.2 for 5 users. > We (parent organisation) already has a email system (UNIX , pop, > smt...

After running scanpst, can't delete ANY messages in Outlook 2003
My hard drive crashed. I bought a new one and recovered my data from a mirrored image I'd made. When I tried to open Outlook, it said that it couldn't open the files. I ran SCANPST.EXE and it found errors in my personal folders and corrected them all (or so it says). When I reopen Outlook, it appears to now run fine. I got my new e-mail from my POP server without problems. However, when I try to delete ANY messages, I get an error box saying that errors have been detected in my outlook.pst file, shut outlook down and run scanpst.exe. I did that, but this time it finds...

Error code 0x64
what do i do to fix it . windows xp professional Microsoft .NET Framework 1.1 Service Pack 1 Security Update for Windows 2000, Windows XP, Windows Vista, Windows Server 2008, Windows 7, and Windows Server 2008 R2 (KB953297) failed You see these KB articles: Description of the Patch Registration Cleanup Tool http://support.microsoft.com/kb/976220 When installing updates using Windows update or Microsoft Update you may receive Error 0x643 or 0x80070643 (23 Oct-09) http://support.microsoft.com/kb/976982 mootz wrote: > what do i...

Excel 2003 won't open spreadsheet with a chart
When a customer tries to open a spreadsheet with a chart, he gets the error, "Microsoft Office Excel has encountered a problem and needs to close. We are sorry for the inconvenience. The information you were working on might be lost. Microsoft Excel can try to recoved it for you." If he tries to recover, the sheet opens and the data is there, but the charts are blank. Spreadsheets without charts open with no problem. Identical computers on the network can open the spreadsheets he can't, and he created them. This just started today. He has tried rebooting and moving the file...

Microsoft clip organizer
When trying to download clips to my hard drive from Microsoft Clips online I can select clip/sound and add them to my selection basket but when I attempt to download them after selecting the open box an error message appears in a Microsoft Clip Organizer frame: Clip Organizer cannot complete the operation The server threw an exception Error Code: 0x80010105 What do I do to fix this? Please help me!! Find Mstore10.mgc, rename it to Mstore10.old The file is found in a folder similar to this (hidden), there maybe more than one mgc file, change all. C:\Documents and Settings\Owner\Applicat...

Outlook 2003 Pro
I have lost all ability to send messages in Outlook 2003, the send/receive tab disappears after starting, and when I want to send a message the send tab is gone as well, Any ideas about this. I've reinstalled Outlook 2003 twice, I've looked in the toolbar menus for the send tab and can't find it. Any help would be greatly appreciated ...

Upgrade from Word -2003 to -2007
Is that something I can do from my own machine, or do I have to go to my dealer to buy the new version? -- ___________ Knut Willy You can buy an upgrade version of Office 2007 or Word 2007 at office superstores, Best Buy, or anywhere else that sells software. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "Knut Willy" <kwjakset@c2i.net> wrote in message news:4b0b07cd$0$2775$c83e3ef6@anchorman-read.tele2.net... > Is that something I can do from my own machine, or do I have to go to my ...

Formula Error #2
mod(12,2.4) will not return a zero value This is simple roundoff error. If it is not acceptable then use: =12-2.4*(INT(12/2.4)) -- Gary''s Student - gsnu2007k "alaomair@gmail.com" wrote: > mod(12,2.4) will not return a zero value > Try =ROUND(mod(12,2.4),10) or nay number of decimals less than 15 -- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme remove caps from email <alaomair@gmail.com> wrote in message news:a416eaff-b6fe-475e-a4fe-de95e97bc365@m74g2000hsh.googlegroups.com... > mod(12,2.4) will not return a zero value ...

Outlook 2003 Send/Receive Issue
I have a user with Outlook 2003 on his XP SP3 laptop that is having trouble sending\receiving emails. He is using exchange 2003 for his mailbox account. Emails are stuck\delayed in his Outbox for up to several days when he trys to send via a remote connection using our VPN. Emails sent to him are also taking a long time to get to his mailbox when he is remotely connected. However he can use OWA with no problems, emails that appear in OWA are not appearing in his Outlook mailbox while remotely connected thru the VPN. Also he has a personal POP3 account setup in his Outlook that is...

Another strange Media Center Receiver Error...
Hi, everybody. This is driving me crazy and I can't seem to find any info on how to fix it. I'm hoping somebody here will be able to help me. I am running Windows XP MCE 2005 and I am getting the following message: Media Center Receiver Error szAppName: ehRecvr.exe szAppVer: 5.1.2700.2800 szModName: ntdll szModVer: 5.1.2600.5755 offset: 000101b3 It is causing Media Center to not see my tuner cards, so it cannot see or record live tv. I'm so tired of fighting with this thing. Does anybody know a fix for this? Also, does anybody know where I can downloa...

.net 3.0 on GP 7.5?
I need to know if the .net 3.0 framework will "break" GP 7.5. .net 3.0 is necessary for another application which will be running on the same machine. I cannot find an answer on Partnersource or various other resources that I've looked into. 7.5 is not supported by Microsoft anymore... Any insight would be much appreciated! Dear, You can export the data from the first company using SmartList, and use Integration Manager or Macro's to import the transactions into the other company, please let me know if you need any help in either ways. Regards, -- Mohammad R. Daou...

.Net Mass Downloader Reference Source Debugable Under VS2005
Grab your copy from http://www.codeplex.com/NetMassDownloader/Wiki/View.aspx?title=Home It allows batch download, offline debugging and debug under 2005 for MS Permissive Licence Code. NET Mass Downloader Welcome to the .NET Mass Downloader project. While it's great that Microsoft has released the .NET Reference Source Code, you can only get it one file at a time while you're debugging. If you'd like to batch download it for reading or to populate the cache, you'd have to write a program that instantiated and called each method in the Framework Class Library. Fortunately, .NE...

DAO 3.50 and VC++7
Can I force VC++7.0 to use DAO 3.50 or 3.51 instead of 3.60? In VC++6.0 we could set the DAO verion using something similar to: AfxGetModuleState()->m_dwVersion = 0x0421 This does not appear to work in VC++7.0 as no matter what this is set to DAO 3.6 is always loaded. We would like to do this as we hold binary data in MS Access memo fields and this appears to get converted. We can move the data to an OLE type field but this is not conveninet for backwards compatibility. Peter, Are you creating a new database at run time and attempting to re-create the 'old' schema, or ...

vc++ #6
how do we can link our header file (*.h)? header files are not linked. they are normally included with a c/c++ file during compilation. object files and libraries are linked. "m" <paridar@azadinet.net> wrote in message news:OqfcbLqVEHA.1952@TK2MSFTNGP12.phx.gbl... > how do we can link our header file (*.h)? > > m, > how do we can link our header file (*.h)? By including them in your source files (*.c or *c.pp) and compiling, then linking the source files. -- Jonathan Wood SoftCircuits http://www.softcircuits.com Available for consulting: http://www.softc...

This Quick Campaign could not be performed due to an error: 0x8004
Anyone know what this is and what to do about it? The QC was an email blast. There's nothing in the server logs. I am having the same issue. Did you ever get this resolved? "Jeff Metcalf" wrote: > Anyone know what this is and what to do about it? The QC was an email blast. > There's nothing in the server logs. Nope "Kate @ MCC" wrote: > I am having the same issue. Did you ever get this resolved? > > "Jeff Metcalf" wrote: > > > Anyone know what this is and what to do about it? The QC was an email blast. > > ...

exchange 2000 vs. 2003
Our company is considering upgrading from exchange 2000 to 2003. We are currently operating two remote and one main office. The exchange server is at the main office and the remote offices connect to the main office for exchange through a VPN managed by a Watchgaurd Firebox at the main office and two Watchgaurd SOHOs at the remote offices. We never have been very satisfied with this solution and the Watchgaurd product cause frequent headaches My question is this.... does Exchange 2003 combined with Server 2003 eliminate the need for needing the Watchguard's VPN boxes? Any comments ...

Obtain Mcse,Mcsa,Mcdba,Mcsd.Net,Ccna,Ccnp Certificaitons Without Exams(Pay After Check Results)100% Passing Gaurantee..!!!!
All Certifications Like MICROSOFT,CISCO,COMPTIA,SOLARIS,ORACLE,SAP,MICOSOFT BUSINESS SOLUTIONS,EMC at your doorstep without exams..and with 100% passing guarantee...No need to go to any testing centre...we will do everything on behalf of you... We own several test centres worldwide and are able to offer you this fantastic service. If you would like a 100% guaranteed pass, then please read on further...... Mail only at this email id :- all_certs@yahoo.com We are able to offer a guaranteed pass for the following: Microsoft, Cisco, Comptia, Oracle, Solaris. Please send a request for any test th...

Error Code 0x80040E91
My microsoft clip art organization to open Hi maybe http://support.microsoft.com/default.aspx?scid=kb;en-us;248872 -- Regards Frank Kabel Frankfurt, Germany "venkitachalam" <venkitachalam@discussions.microsoft.com> schrieb im Newsbeitrag news:A9E66668-8964-45AA-897E-F892948E5E1A@microsoft.com... > My microsoft clip art organization to open ...