Hello café, <br><br>I have seen tutorials about extracting information from a tag soup, but I have a different use case:<br>I want to read a xml file, find a tag, change its content, and write the xml file back.<br><br>This is an example of the files<br>
<br><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;<br>&lt;idPkg:Story xmlns:idPkg=&quot;<a href="http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging">http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging</a>&quot; DOMVersion=&quot;7.0&quot;&gt;<br>
        &lt;Story Self=&quot;ub9fad&quot; AppliedTOCStyle=&quot;n&quot; TrackChanges=&quot;false&quot; StoryTitle=&quot;$ID/&quot; AppliedNamedGrid=&quot;n&quot;&gt;<br>                &lt;StoryPreference OpticalMarginAlignment=&quot;false&quot; OpticalMarginSize=&quot;12&quot; FrameType=&quot;TextFrameType&quot; StoryOrientation=&quot;Horizontal&quot; StoryDirection=&quot;LeftToRightDirection&quot;/&gt;<br>
                &lt;InCopyExportOption IncludeGraphicProxies=&quot;true&quot; IncludeAllResources=&quot;false&quot;/&gt;<br>                &lt;ParagraphStyleRange AppliedParagraphStyle=&quot;ParagraphStyle/prix&quot;&gt;<br>
                        &lt;CharacterStyleRange AppliedCharacterStyle=&quot;CharacterStyle/$ID/[No character style]&quot;&gt;<br>                                &lt;Content&gt;zzznba5&lt;/Content&gt;<br>                        &lt;/CharacterStyleRange&gt;<br>
                &lt;/ParagraphStyleRange&gt;<br>        &lt;/Story&gt;<br>&lt;/idPkg:Story&gt;</font><br><br>Assuming I want to change the content of the &quot;Content&quot; tag, this is what I came up with (simplified), I&#39;m using direct recursion. Is there a better way ?<div>
<br><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ts = do<br>  soup &lt;- parseTags `fmap` readFile &quot;idml/h00/Stories/Story_ub9fad.xml&quot;<br>  writeFile &quot;test&quot; $ renderTagsOptions renderOptions{optMinimize = const True}<br>
                   $ modif soup<br><br>modif [] = []<br>modif (x@(TagOpen &quot;Content&quot; []):TagText _m : xs) = x : TagText &quot;modified&quot; : modif xs<br>modif (x:xs) = x : modif xs</font><br><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br>
</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">David.</font></div></div>