I have HTML output of the form:
<!-- wp:uagb/section {"block_id":"e00ee750-246d-46fd-a034-c6dc37497309","contenttype":"exercise","contenttitle":"here is exercise 1","contentname":"Exercise"} -->
<div id="here-is-exercise-1" class="contenttype-wrapper sometopictype-exercise" data-id="e00ee750-246d-46fd-a034-c6dc37497309">
<!-- wp:paragraph -->
<p>Some stuff</p>
<!-- /wp:paragraph -->
</div>
<!-- /wp:uagb/section -->
So you have these comments that start with <!-- wp:uagb/section and in those comments you have JSON of form
{"block_id":"e00ee750-246d-46fd-a034-c6dc37497309","contenttype":"exercise","contenttitle":"here is exercise 1","contentname":"Exercise"}
I am trying to form an XPATH query (in PHP) that is of form
"Get me all JSON objects that contain parameter `contenttype`"
I am pretty proficient with XPATH when it comes to normal DOM extraction, but not quite sure how to go about this. Ideas?
//comment()[contains(.,'contenttype')]) should work, why would you need the rest?