3 ms·
> what XPath REALLY should have evolved into was a more format-flexible path language with format-specific extensions as needed. You can probably already do th
by masklinn 6y ago
> what XPath REALLY should have evolved into was a more format-flexible path language with format-specific extensions as needed.
You can probably already do that just fine: ignore attribute nodes, and e.g.
{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}}
/menu/popup/menuitem/*[last()]/preceding-sibling::*[1]/value
selects "Open". Something along those lines.
Maybe relax nodetypes so they can be pluggable per-language, but I'm not sure that's even useful or necessary.