Nitin Taneja

I can think of nothing less pleasurable than a life devoted to pleasure !!

Wednesday, January 18, 2012

Xml is well formed or not !!

Code to check whether the xml string is well formed or not -

public bool IsValidXml(string xmlContent)
{
var textStream = new StringReader(xmlContent);

using (var xmlTextReader = new XmlTextReader(textStream))
{
try
{
while (xmlTextReader.Read())
{
}
}
catch
{
return false;
}
}
return true;
}
Posted by Nitz at 2:45 AM No comments:
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Blog Archive

  • ►  2014 (1)
    • ►  04/27 - 05/04 (1)
  • ►  2013 (1)
    • ►  09/01 - 09/08 (1)
  • ▼  2012 (5)
    • ►  09/16 - 09/23 (1)
    • ►  03/18 - 03/25 (1)
    • ►  02/19 - 02/26 (1)
    • ►  02/12 - 02/19 (1)
    • ▼  01/15 - 01/22 (1)
      • Xml is well formed or not !!
  • ►  2011 (9)
    • ►  10/02 - 10/09 (1)
    • ►  09/04 - 09/11 (1)
    • ►  08/21 - 08/28 (1)
    • ►  08/14 - 08/21 (1)
    • ►  07/17 - 07/24 (1)
    • ►  06/12 - 06/19 (2)
    • ►  05/29 - 06/05 (1)
    • ►  05/22 - 05/29 (1)
  • ►  2010 (11)
    • ►  11/28 - 12/05 (1)
    • ►  11/21 - 11/28 (2)
    • ►  11/14 - 11/21 (1)
    • ►  11/07 - 11/14 (3)
    • ►  10/31 - 11/07 (4)
  • ►  2008 (3)
    • ►  10/12 - 10/19 (1)
    • ►  09/21 - 09/28 (1)
    • ►  06/22 - 06/29 (1)
  • ►  2006 (2)
    • ►  06/11 - 06/18 (1)
    • ►  04/23 - 04/30 (1)

About Me

Nitz
View my complete profile

Links

  • Google News
  • Edit-Me
  • Edit-Me
  • Sandy's blog
  • Sumit's blog
  • Minal's blog
  • NobodysDevil blog
Simple theme. Theme images by gaffera. Powered by Blogger.