c# - load aspx file into xmldocument -


I want to be able to load the aspx page in XmlDocument variable. How do I do that? Here's what I have tried and expect .xml file and not an .aspx page. Change the excel page to XML document and load it? Thanks string filepath = @ "C: \ WebApplication1 \ webform4.aspx"; XmlDocument Document = New XmlDocument (); Document.Load (filepath);

I get the following error:

The name can not start with the '%' character, hexadecimal value 0x25. Line1, position 2

The reason you get this error is:

The name can not start with a '%' character, hexadecimal value 0x25. Line 1, position 2.

This is because the .aspx pages often do not contain valid XML ASP.NET .aspx pages include instructions such as:

  & lt;% @ Page language = "C #" [possibly other stuff]%>   

and %> and %> is not a valid XML, so you can not load raw ASPX pages

Now, even if you want to break these instructions, then there is a great chance that You are not really in fact, are strict and all markups on the page are XHTML, then it will not be

You can use the HTML Agility Pack Pages (or without instructions) can try and load:



Comments

Popular posts from this blog

java - NullPointerException for a 2d Array -

python - Assemble mpeg file unable to play in mediaplayer -

c# - NameSpace Manager or XsltContent to parse aspx page -