title: How can I extract the tags and content of children using xml-conduit?
body: <p><strong>UPDATE: After many different attempts I have for now concluded that the behaviour seen below is expected and that I am only running into difficulties because I am using ToJson later on. Will update if I solve it completely.</strong></p>
  
  <p><strong>==============================================================</strong></p>
  
  <p>I am trying to use xml-conduit to achieve this: </p>
  
  <ul>
  <li>go down the cursor of a document to the  element of an html document. </li>
  <li>treat any descendants of this node as text. i.e. don't only get the content as text, but also the tags themselves. </li>
  </ul>
  
  <p>so for example, <strong>I edited this example as per my comments below</strong> </p>
  
  <blockquote>
  <pre><code>&lt;ol&gt; 
     &lt;li class="c1"&gt; 
        this is really "good work" &lt;i&gt;John&lt;/i&gt;.
     &lt;/li&gt;
  &lt;/ol&gt;
  </code></pre>
  </blockquote>
  
  <p>should return </p>
  
  <blockquote>
  <pre><code>"&lt;li class="c1"&gt; this is really "good work" &lt;i&gt;John&lt;/i&gt; &lt;/li&gt;" 
  </code></pre>
  </blockquote>
  
  <p>Whereas I'm getting </p>
  
  <blockquote>
    <p>" "\u003cli class=\"c1\"\u003e this is really &quot;good work&quot;\u003ci\u003eJohn\u003c/i\u003e\u003c/li\u003e</p>
  </blockquote>
  
  <p>So there is something going on within the tags that is different from what is happening to the content. I think perhaps the ToHtml instance isnt quite what i want really. I just want to <em>collapse</em> all descendants, turn their tags and content into text. I can't find a way though.</p>
  
  <pre><code>import Text.Blaze.Html                           (toHtml, preEscapedToHtml)
  import Text.Blaze.Html.Renderer.Utf8             (renderHtml)
  --import Text.Blaze.Html.Renderer.String           (renderHtml)
  --import Text.Blaze.Html.Renderer.Text             (renderHtml)
  import           Data.Text.Encoding              (decodeUtf8)
  import           Data.ByteString.Lazy            (toStrict)
  
  
  extractAllParas :: Cursor -&gt; [ Text ]
  extractAllParas c = do
    let mt' = c $/ laxElement "body"  &amp;// laxElement "ol" &amp;/ anyElement
        mt =  (map (decodeUtf8 . toStrict . renderHtml . toHtml . node) $ mt')
    case mt of
      [ "" ] -&gt; []
      paras -&gt; formatParas paras
  </code></pre>
  
  <p>formatParas :: [ Text ] -> [ Text ]</p>