Getting ItemGroup collection and their Items from MSBuild xml
<p>I want to know the name of the ItemGroup by parsing the below xml in dotnet c#. I tried various options but couldn't get it. Basically i want to know that there are ItemGroup , it can be more. Is there anyway we can load this xml and get the ItemGroups's list and their names.</p>

<p>Here i want the ItemGroup name as "cssfile_individual" , cssfile_individual2</p>

<pre><code>    &lt;Project xmlns="http://schemas.microsoft.com/developer/MsBuild/2003"&gt;

      &lt;UsingTask TaskName="CssCompressorTask" AssemblyFile="Yahoo.Yui.Compressor.Build.MsBuild.dll" /&gt;
      &lt;UsingTask TaskName="JavaScriptCompressorTask" AssemblyFile="Yahoo.Yui.Compressor.Build.MsBuild.dll" /&gt;

      &lt;PropertyGroup&gt;

      &lt;/PropertyGroup&gt;

        &lt;Target Name="Minify"&gt;

        &lt;ItemGroup&gt;
          &lt;cssfile_individual Include="test1.css"/&gt;
          &lt;cssfile_individual Include="test2.css"/&gt;
          &lt;cssfile_individual Include="test3.css"/&gt;
          &lt;cssfile_individual Include="test3.css"/&gt;      
        &lt;/ItemGroup&gt;

 &lt;ItemGroup&gt;
      &lt;cssfile_individual2 Include="test1.css"/&gt;
      &lt;cssfile_individual2 Include="test2.css"/&gt;
      &lt;cssfile_individual2 Include="test3.css"/&gt;
      &lt;cssfile_individual2 Include="test3.css"/&gt;      
    &lt;/ItemGroup&gt;

        &lt;/Target&gt;
    &lt;/Project&gt;
</code></pre>

<p>I tried as below</p>

<pre><code> XmlDocument objXML = new XmlDocument();
             objXML.Load(path);
</code></pre>

<p>and then started getting childs and all.</p>

<p>Sample XML looks like this</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;Project xmlns="http://schemas.microsoft.com/developer/MsBuild/2003"&gt;
  &lt;UsingTask TaskName="CompressorTask"
             AssemblyFile="D:\JsCssCompressor\JsCssCompressor\bin\Yahoo.Yui.Compressor.Build.MsBuild.dll" /&gt;

  &lt;Target Name="MyTaskTarget"&gt;
    &lt;ItemGroup&gt;
      &lt;JavaScriptFiles Include="C:\Work\Purchase_Flow\eBizSol_App\Release\WebSites\Websites\McAfee.Consumer.Website\UIDesign\LegacySite\Scripts\FlexDashboard\AddDevice.js"/&gt;
    &lt;/ItemGroup&gt;
    &lt;CompressorTask
        JavaScriptCompressionType="YuiStockCompression"
        JavaScriptFiles="@(JavaScriptFiles)"
        ObfuscateJavaScript="True"
        PreserveAllSemicolons="False"
        DisableOptimizations="Nope"
        EncodingType="Default"
        DeleteJavaScriptFiles="false"
        LineBreakPosition="-1"
        JavaScriptOutputFile="C:\Work\Purchase_Flow\eBizSol_App\Release\WebSites\Websites\McAfee.Consumer.Website\UIDesign\LegacySite\Scripts\FlexDashboard\MAA2.0.js"
        LoggingType="ALittleBit"
        ThreadCulture="en-us"
        IsEvalIgnored="false"
            /&gt;
  &lt;/Target&gt;
&lt;/Project&gt;
</code></pre>
