title: How to fill XFA form with iText: Modifying not the datasets, but an other data group in the XDP
body: <p>I have an XFA form, which I want to fill automatically with either Python or C# or both.</p>
  <p>It would be easy if the form data was in datasets like in usual XFA pdfs, but it is not. Here is an example of some data in the datasets:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;topmostSubform
  &gt;&lt;Effacer
  /&gt;&lt;Rangée3 xmlns:xfa=&quot;http://www.xfa.org/schema/xfa-data/1.0/&quot; xfa:dataNode=&quot;dataGroup&quot;
  /&gt;&lt;table2
  &gt;&lt;Rangée1
  &gt;&lt;colG
  &gt;&lt;positioner xmlns:xfa=&quot;http://www.xfa.org/schema/xfa-data/1.0/&quot; xfa:dataNode=&quot;dataGroup&quot;
  /&gt;&lt;/colG
  &gt;&lt;colD xmlns:xfa=&quot;http://www.xfa.org/schema/xfa-data/1.0/&quot; xfa:dataNode=&quot;dataGroup&quot;
  /&gt;&lt;/Rangée1
  &gt;&lt;/table2
  &gt;&lt;positioner1 xmlns:xfa=&quot;http://www.xfa.org/schema/xfa-data/1.0/&quot; xfa:dataNode=&quot;dataGroup&quot;
  /&gt;&lt;table2
  &gt;&lt;Rangée1
  &gt;&lt;colG
  &gt;&lt;positioner xmlns:xfa=&quot;http://www.xfa.org/schema/xfa-data/1.0/&quot; xfa:dataNode=&quot;dataGroup&quot;
  /&gt;&lt;/colG 
  </code></pre>
  <p>It points to an other datagroup which is in position 15 in the file XDP.
  Using python, I could easily access the XDP, here is its configuration:</p>
  <pre><code>[xdp:xdp 115 0 R config 2 0 R template 3 0 R datasets 116 0 R localeSet 5 0 R xmpmeta 6 0 R xfdf 7 0 R form 117 0 R &lt;/xdp:xdp&gt; 118 0 R ]
  </code></pre>
  <p>I found all the form data in the &quot;form&quot; stream, here is a part of it:</p>
  <pre><code>&lt;form xmlns=&quot;http://www.xfa.org/schema/xfa-form/2.8/&quot; checksum=&quot;8cn7XfZQ5SK/27lJmAiqCnPmd4M=&quot;&gt;
    &lt;subform name=&quot;topmostSubform&quot;&gt;
      &lt;field name=&quot;pMultilineModified&quot;&gt;
        &lt;value&gt;
          &lt;text&gt;N&lt;/text&gt;
        &lt;/value&gt;
        &lt;assist&gt;
          &lt;toolTip/&gt;
        &lt;/assist&gt;
      &lt;/field&gt;
      &lt;instanceManager name=&quot;_page1&quot;/&gt;
      &lt;subform name=&quot;page1&quot;&gt;
        &lt;instanceManager name=&quot;_sf0&quot;/&gt;
        &lt;subform name=&quot;sf0&quot;&gt;
          &lt;instanceManager name=&quot;_container1&quot;/&gt;
          &lt;subform name=&quot;container1&quot;&gt;
            &lt;instanceManager name=&quot;_positioner&quot;/&gt;
            &lt;subform name=&quot;positioner&quot;&gt;
              &lt;instanceManager name=&quot;_sf_numeroEvenement&quot;/&gt;
              &lt;subform name=&quot;sf_numeroEvenement&quot;&gt;
                &lt;instanceManager name=&quot;_container&quot;/&gt;
                &lt;subform name=&quot;container&quot;&gt;
                  &lt;instanceManager name=&quot;_Figure&quot;/&gt;
                  &lt;subform name=&quot;Figure&quot;&gt;
                    &lt;field name=&quot;NumeroEvenement&quot;&gt;
                      &lt;assist&gt;
                        &lt;toolTip/&gt;
                      &lt;/assist&gt;
                      &lt;value override=&quot;1&quot;&gt;
                        &lt;text&gt;12234445522&lt;/text&gt;
                      &lt;/value&gt;
                    &lt;/field&gt;
                  &lt;/subform&gt;
                &lt;/subform&gt;
              &lt;/subform&gt;
              &lt;field name=&quot;txt0_UnitePlaignante&quot;&gt;
                &lt;assist&gt;
                  &lt;toolTip/&gt;
                &lt;/assist&gt;
                &lt;value override=&quot;1&quot;&gt;
                  &lt;text&gt;200&lt;/text&gt;
                &lt;/value&gt;
              &lt;/field&gt;
              &lt;field name=&quot;Effacer&quot;&gt;
                &lt;assist&gt;
                  &lt;toolTip/&gt;
                &lt;/assist&gt;
              &lt;/field&gt;
            &lt;/subform&gt;
          &lt;/subform&gt;
  </code></pre>
  <p>So the real question is:</p>
  <p>How can I with iText7 get this &quot;form&quot; stream in position 15 of the XDP PdfObject, modify it to put it back in the XDP and put the XDP back in the pdf?
  To replicate what I'm trying to do, one could try getting any other element from the XDP than datasets, modifying it or not, putting it back in the pdf after this. I wasn't able to.</p>
  <p>I tried; Pypdf2 PDFNet (python and C#), iText7..</p>
  <p>I am desperate, I've been trying for weeks now with no solution. I obviously can't use iText FillXfaForm method, since it modifies the datasets and I want to modify the form.</p>