I am using version 1.4 of HtmlAgilityPack, and as I understand it, MixedCodeDocument and its related classes will help you parse asp.net markup as found in aspx and ascx files. I found zero documentation or examples for the MixedCodeDocument class. From what I tried, it seems that MixedCodeDocument breaks the text of the file into pieces, separating asp.net fragments from nonasp.net fragments. For example, the following snippet:
<asp:Label ID="lbl_xyz" runat="server" Text='<%=Name%>'></asp:Label> <a href='#'>blah</a>
will be broken down into:
// Text fragment 1 <asp:Label ID="lbl_xyz" runat="server" Text=" // Code fragment 1 <%=Name%> // Text fragment 2 (two lines) ></asp:Label> <a href='#'>blah</a>
But no parsing goes deeper than that, i.e. the a tag is not parsed into its own node with attributes or something like that.
Therefore, I assume that MixedCodeDocument will be used to highlight code fragments so that the remaining text fragments can be put together and then parsed using the HtmlDocument class.
Does anyone know if this is correct? Or even better, does anyone have any tips on how to successfully parse and manage an aspx or ascx file using HAP or another?
source share