×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Error "XmlException was unhandled"

Error "XmlException was unhandled"

Error "XmlException was unhandled"

(OP)
Colleagues,

Picture worth 1000 words, therefore:

What am I doing wrong?

TIA!

Regards,

Ilya

RE: Error "XmlException was unhandled"

Because you don't have a legitimate XML file

You earlier 'test' for legitimacy is no such thing, I am afraid. Let the XMLReader do the validation for you ...

RE: Error "XmlException was unhandled"

(OP)
strongm: "Let the XMLReader do the validation for you"

How? Try-Catch and analyze the error message?
Please advise.
TIA!

Regards,

Ilya

RE: Error "XmlException was unhandled"

>How? Try-Catch and analyze the error message?

Yep, that would be one way.

You can even validate against a schema, if you had one (one of the things you can use XMLReaderSettings for).

But you never actually set any XMLreader settings, which is beginning to make me think that much of this looks like cut'n'pasted code from multiple sources without really knowing what the code is doing

You might want to examine the documentation for XMLReaderSettings and fore XML schemas

RE: Error "XmlException was unhandled"

(OP)
Actually, this "one way" (Try-Catch) did work!

And you have guessed right: this test POStart.XML (that I "inherited" from my predecessor) was a kind of header (or template of a sorts) for a real test XML. And it has no closing tags for the 1st several levels... coz there's POEnd.XML with all these closing tags. And the test data is supposed to be "sandwiched" between these former two.

This my predecessor read it with System.IO.File.OpenText()/While Peek()/ReadLine()/Close(), and I am trying to read it with XmlReader... (Doh!)

"You can always count on Americans to do the right thing - after they've tried everything else." (Sir W. Churchill, I presume? winky smile )
Apparently, I haven't tried everything else... yet! lol

Regards,

Ilya

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close