Bob Wyman on Nostr: #[0] #[1] Consider this object: {"object": { "type": "Note", "content": "<p>Some ...
npub1u27r9h3j9pvrplaffsmpn698e8xhmuqhdgcxldv67ammql9pumnqha3qfq (npub1u27…3qfq) npub177x40845gmz06jsrpkqvrww3skwn6yj2cx2xk6ynzakn5xr7j72suzpv55 (npub177x…pv55) Consider this object:
{"object": {
"type": "Note",
"content": "<p>Some Text<div>1st div</div><div>2nd div</div></p>"
}}
If I treat HTML like JSON, I can fetch the content of the first div with JSONPath like:
"$..object[?(@.type == 'Note')].content.p.div[0]"
but, the XPath for that first div would be "//p/div[1]" (Note: 1-base, not 0-base) So, should the full query be the following?:
"$..object[?(@.type == 'Note')].content//p/div[1]"
{"object": {
"type": "Note",
"content": "<p>Some Text<div>1st div</div><div>2nd div</div></p>"
}}
If I treat HTML like JSON, I can fetch the content of the first div with JSONPath like:
"$..object[?(@.type == 'Note')].content.p.div[0]"
but, the XPath for that first div would be "//p/div[1]" (Note: 1-base, not 0-base) So, should the full query be the following?:
"$..object[?(@.type == 'Note')].content//p/div[1]"