8 ms·
With the rise of numerous hierarchical document formats (JSON, YAML, TOML, properties files), what XPath REALLY should have evolved into was a more format-flexi
by AtlasBarfed 6y ago
With the rise of numerous hierarchical document formats (JSON, YAML, TOML, properties files), what XPath REALLY should have evolved into was a more format-flexible path language with format-specific extensions as needed.
- 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.