I have a xml inside content place holder that I need to get, like:
<asp:Content ID="Content2" ContentPlaceHolderID="header" runat="server">
<div>
<categories>
<category>
<name>item 1</name>
<categories>
<category>
<name>item 1.1.</name>
</category>
<category>
<name>item 1.2.</name>
</category>
</categories>
</category>
</categories>
</div>
</asp:Content>
And so on. I ll build the proper html using LINQ to XML over the root categories, but I’m failing to extract all the xml with regular expression. Is there a better way to extract the xml?
See Reading XML documents using LINQ to XML and XML Made Easy with LINQ to XML
Does it matter if the .xml is surrounded? Just give the root to Linq and work your way through it. Simple, robust and easy to maintain. In general don’t even think about doing what you are about to do.