Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

How to load XHTML file using LoadXML or equivalent method?

$
0
0

I am trying to load a XHTML file in using below piece of code and its not working... Kindly help..

   string xmlText = File.ReadAllText(@"C:\test.htm");
   var doc = new XmlDocument();
   doc.LoadXml(xmlText);
   Console.WriteLine(doc.InnerText);
   Console.ReadKey();

test.htm (XHTML file)

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>An XHTML 1.0 Strict standard template</title>
<meta http-equiv="content-type" 
content="text/html;charset=utf-8" />
</head>

<body>
     <p>… My HTML content here …</p>
</body>
</html>



http://www.selvaonline.com - Live a Happy & Balanced Life


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>