.net - Parse HTML in C# without AgilityPack -


i have html file, several input fields id, loaded c# string:

<div>    <input id="inpname" type="text" />    <input type="checkbox" /> </div> 

lets want add required attribute input id inpname.

in jquery do:

$('input#inpname').prop('required', true); 

q: how can achieve add attribute without adding htmlagilypack?

can use xmldocument or choice regular expressions ?

u can use xml objects

like in http://msdn.microsoft.com/en-us/library/system.xml.xmlnode.selectnodes.aspx

and use xmlnode object take want http://msdn.microsoft.com/en-us/library/system.xml.xmlnode.aspx

you can use expressions search want http://www.w3schools.com/xpath/xpath_syntax.asp

you can use code node

xmldocument doc = new xmldocument(); doc.loadxml(myxmlcontent);  xmlnode root = doc.documentelement; xmlnode mynode = root.selectsinglenode("mytag"); 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -