Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

c# - Loading XML or XHTML content with html encoded or escaped characters -


i'm developing class content management system. input content supplied in xhtml format. , can contain valid escaped characters £ see example below.

<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">   <head xmlns="">     <meta name="attr_documenttitle" content="hello world books" />    </head>   <body>   <div>british pound   &#163;</div>   <div>registered sign &#174;</div>   <div>copyright sign &#169; </div>    </body> </html> 

my objective write method loads xml .net object processing , save database. want maintain escaped characters are. , here method:

public static xmldocument loadxmlfromstring(string xhtmlcontent) {     byte[] xhtmlbyte = encoding.ascii.getbytes(xhtmlcontent);     memorystream mstream = new memorystream(xhtmlbyte);     xmlreadersettings settings = new xmlreadersettings();     //upon loading xml, prevent dtd download, blocked our      //firewall , generate "503 server unavailable" error.     settings.xmlresolver = null;     settings.prohibitdtd = false;     xmlreader reader = xmlreader.create(mstream, settings);     xmldocument xmldoc = new xmldocument();     xmldoc.loadxml(xhtmlcontent);     return xmldoc; //value of xmldoc.innerxml contains £ ® © in place                      // of &#163; &#174; , &#169; } 

this method converts escaped characters character equivalents. how can avoid , keep escaped characters.

check this: why xmltextreader convert html encoded utf8 characters utf8 string automatically


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -