title: Create tree bookmarks from XML in iTextSharp
body: <p>I want create tree bookmarks in pdf. I know, that I can creat this with <code>PdfOutline</code> class. I created bookmarks without ramification. How can I create tree bookmarks using XML file?</p>
  
  <p>This is my XML file:</p>
  
  <pre><code>&lt;node text="****" path="" type="book"&gt;
   &lt;node text="******" path="" type="part"&gt;
     &lt;node text="********" path="" type="chapter"&gt;
      &lt;node text="**********" path="" type="subject"&gt;
        &lt;node text="*********" path="####.htm" type="frame" /&gt;
        &lt;node text="****" path="###.htm" type="frame" /&gt;
        &lt;node text="*******" path="######.htm" type="frame" /&gt;
        &lt;node text="********" path="#####.htm" type="frame" /&gt;
      &lt;/node&gt;
     &lt;/node&gt;
    &lt;/node&gt;
   &lt;/node&gt;
  </code></pre>
  
  <p>I create content of PDf file using XML file and  HTML file.
  In XML file are headlines("text"). I'm parsing xml file and drag nodes.</p>
  
  <p>How can I create tree bookmarks?</p>
  
  <p>Now I'm getting bookmarks just without ramification. Maybe should I use recursion? But I don't understand how. Because, I should add to <code>PdfOutline()</code> child, but where am I can take child?</p>
  
  <pre><code>        foreach (KeyValuePair&lt;string, KeyValuePair&lt;string, int&gt;&gt; entry in entries)
          {
              KeyValuePair&lt;string, int&gt; value = entry.Value;
  
              bookmark = new PdfOutline(root, PdfAction.GotoLocalPage(value.Value, new PdfDestination(value.Value), writer), entry.Key, true);
  
          }
  </code></pre>
  
  <p>Thank you.</p>