0

I have a block of html code which represents the second verse of the book of James from the bible:

</span>
</span>
<span class="verse v2" data-usfm="JAS.1.2">
    <span class="label">2</span>
    <span class="content">  </span>
    <span class="note x">
        <span class="label">#</span>
        <span class=" body">    See Matt. 5:12   </span>
    </span>
    <span class="content">Count it all joy, my brothers,</span>
    <span class="note f">
        <span class="label">#</span>
        <span class=" body">
            <span class="fr">1:2 </span>
            <span class="ft">Or </span>
            <span class="fq">brothers and sisters</span>
            <span class="ft">. In New Testament usage, depending on the context, the plural Greek word </span>
            <span class="fq">adelphoi </span>
            <span class="ft">(translated &#8220;brothers&#8221;) may refer either to </span>
            <span class="fq">brothers </span>
            <span class="ft">or to </span>
            <span class="fq">brothers and sisters</span>
            <span class="ft">; also verses 16, 19</span>
        </span>
    </span>
    <span class="content"> when you meet trials </span>
    <span class="note x">
        <span class="label">#</span>
        <span class=" body">1 Pet. 1:6</span>
    </span>
    <span class="content">of various kinds, </span>
</span>

<span class="verse v3" data-usfm="JAS.1.3">
    <span class="label">3</span>
    <span class="content">for you know that </span>
    <span class="note x">
        <span class="label">#</span>
        <span class=" body">1 Pet. 1:7 </span>
    </span>
    <span class="content">the testing of your faith </span>
    <span class="note x">
        <span class="label">#</span>
        <span class=" body">Rom. 5:3; [ch. 5:11; Heb. 10:36; 2 Pet. 1:6]</span>
    </span>
    <span class="content">produces steadfastness. </span>

I ultimately just want to return the verse numbers and text as a string.I am trying to use CsQuery to retrieve certain span classes, so I can omit the classes I do not need. For example to return the class "content" and class "body" as a string. I can currently only display one span class, with the following code:

CQ dom = CQ.Create(text);
dom = dom["span.content"];
string cleanedText = dom.Text();
Console.WriteLine(cleanedText);

Any help would be greatly appreciated

wazz
  • 4,953
  • 5
  • 20
  • 34
  • I have no idea how csquery works, but there are several spans with the class `content` so it looks like you'll need some more filtering of some kind. – wazz Dec 30 '20 at 05:20
  • @wazz the current code takes all of the content spans and puts them together as text. I'm trying to have it so you can take multiple spans and put them together – Joshua Fullerton-Harvey Dec 30 '20 at 09:25

0 Answers0