PC Review


Reply
Thread Tools Rate Thread

Check if valid XML doc

 
 
Adrian
Guest
Posts: n/a
 
      8th Aug 2005
Hi
I have a text box where I can paste XML docs into and then send them
however sometimes the call fails I assume to incorrectly formatted text! it
fails on the line below:

doc.LoadXml(txtToSend.Text.ToString)

How can I check if the text constitutes a valid XML xml document before
loading it?

Thanks


 
Reply With Quote
 
 
 
 
Chris
Guest
Posts: n/a
 
      8th Aug 2005
Adrian wrote:
> Hi
> I have a text box where I can paste XML docs into and then send them
> however sometimes the call fails I assume to incorrectly formatted text! it
> fails on the line below:
>
> doc.LoadXml(txtToSend.Text.ToString)
>
> How can I check if the text constitutes a valid XML xml document before
> loading it?
>
> Thanks
>
>


I think you are checking. Look at the exception that is being thrown,
it probably tells you that your xml is poorly formatted. Catch the
exception and handle it accordingly.

Chris
 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      8th Aug 2005
"Adrian" <(E-Mail Removed)> schrieb:
> I have a text box where I can paste XML docs into and then send them
> however sometimes the call fails I assume to incorrectly formatted text!
> it fails on the line below:
>
> doc.LoadXml(txtToSend.Text.ToString)
>
> How can I check if the text constitutes a valid XML xml document before
> loading it?


You could attempt to load the document and catch the exception which is
thrown when loading fails.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check valid particular Dictionary Luigi Microsoft C# .NET 6 2nd Oct 2008 02:45 PM
valid culturename check alexandervanveelen@gmail.com Microsoft C# .NET 5 24th Jun 2008 10:31 AM
How to check if a date is valid? =?Utf-8?B?cG9rZGJ6?= Microsoft Access 10 26th Sep 2005 04:33 PM
how to check if URL is valid? Rolf Mistelbacher Microsoft VB .NET 2 9th Nov 2004 07:22 PM
Check for valid license TTs Windows XP General 2 31st Jul 2004 07:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:33 AM.