开发者

not reading content of html file in asp.net

I am using asp.net page where I use html coding.. I am reading a html file using XmlDocument, but the problem is, it is giving an exception:

Name cannot begin with the '"' character, hexadecimal value 0x22

i am using the xmldocument as:

string dir = HttpContext.Current.Request.PhysicalApplicationPath;
            string htmfile = dir  + "webform.html";
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(htmfile);
            XmlNodeList list = xmlDoc.SelectNodes("html/body/form/div/table/tbody/tr/td/img");
            list.Item(0).Attributes[1].Value = thumbpath + Session["WorkingImage"].ToString();
            xmlDoc.Save("webform.html");

and my html file is :

<html>
<head>
    <title>Untitled Page</title>

</head>
<body>
    <form id="form1" runat="server" style="margin:10px 100px 20px 350px; border:1px solid; width:500px; height:800px;">
    <div>
     <table width="490px" style=" border:1px solid; margin:4px 4px 4px 4px; height:150px;">
      <tbody>
        <tr>
            <td style="width:480px; height:145px; margin:4px 4px 4px 4px;">
                <img src="images1.jpg" width="480px" height="145px"/>
            </td>
        </tr>
      </tbody>    
    </table>
    </div>
    <div>
      <table width="192px" style=" margin-left:4px; margin-top:10px; margin-right:10px ; padding:4px 4px">  
        <tbody>
             <tr> 
                <td> 


                    <div id="topdiv" style="color:Blue; width:485px; height:130px;" >
                     <input type="image" id="Image1" style="margin: 9px 4px 4px 4px; width:142px; height:117px;"
                      src="images.jpg" onmouseover="mousein(this);" onmouseout="mouseout(this);"/>                   
                        <textarea id="txtarea1" value="sample text" disabled="true" style=" width:300px; height:117px;
                             m开发者_开发技巧argin:0px 0px 4px 4px; color:Maroon;" onmouseover="mousein(this);" 
                            onmouseout="outmouse();"">
                          first div tag 
                         </textarea>
                    </div>
                </td>    
            </tr>
      </tbody>
    </table>
    </div>
    <table>
        <tbody>
            <tr>
                <td>    

                        <textarea id="txtarea2" value="sample text" disabled="true" style=" width:300px; height:117px;
                             margin:5px 0px 4px 4px; color:Maroon" onmouseover="mousein(this);"  >
                         Second Div Tag
                         </textarea>&nbsp;&nbsp;&nbsp;  
                        <input type="image" id="img" 
                        style="margin: 8px 4px 4px 4px; width:142px; height:117px;" src="images2.jpg" 
                        onmouseover="mousein(this);" onmouseout="mouseout(this);"  />   

                </td>
            </tr>
        </tbody>    
    </table>    
    </form>
</body>
</html>

I am not getting past the point from where I am getting this exception.. please help me ..


In the opening tag of the textarea1 there are two double quotes at the end, which makes the HTML invalid.

Change

<textarea id="txtarea1" ... onmouseout="outmouse();"">

to

<textarea id="txtarea1" ... onmouseout="outmouse();">
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜