Home > Blockchain >  I want the xpath to get the all the text in <strong> tag, the problem is that there is a stron
I want the xpath to get the all the text in <strong> tag, the problem is that there is a stron

Time:10-12

The HTML code is given below, i want all the text in <p> tag including text in both <strong> tags.

<p>
      <strong>
              <strong >لاہور:&nbsp;</strong>
              پاکستانی اداکار فواد خان کا کہنا ہے کہ پاکستان اور انڈیا کے درمیان سیاسی تناؤ کا اثر ان کے بالی وڈ میں موجود افراد سے تعلقات پر بالکل نہیں پڑا لیکن موجودہ صورتحال میں ساتھ کام کرنا آسان نہیں ہے۔
      </strong>
    </p>

CodePudding user response:

Use double backslash

//p//strong/text()

CodePudding user response:

if I reading your question correctly you just want the text in the strong elements and not all the html

this should get the text in the first strong element

$x("//p/strong/text()[last()]")

and this should get the text in the nested strong element

$x("//p/strong/strong/text()")
  • Related