Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML parsing - End of file error

Status
Not open for further replies.

JohnnyRazzle

Programmer
May 4, 2005
10
GB
I am parsing an XML document using XMLTextReader, and when it comes to the end of the file i recieve an error stating that

"error occured: An unexpected end of file parsing CDATA has occured"

I was wondering if there was an exception handler i could use to catch this error.

Many thanks for any help

Regards
Johnny
 
The Read() method returns a boolean. If it is false, there are no more nodes to read.

XmlTextReader also has an EOF property, which is true if the end of the file is reached.

Finally, you could enclose the reading statements in a try finally statement.

Hope that helps.

|| ABC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top