Here's the problem: I'm in a Web environment and I have data expressed in some structured format, say XML or JSON. I want to target elements inside these representations.
Here's an example:
The XML representation of a zoo:
<?xml version="1.0" encoding="UTF-8" ?>
<zoo>
<dog>Joe</dog>
<cat>Alfred</cat>
<mouse>Ricky</mouse>
</zoo>
The JSON representation of the same zoo:
{
"zoo": {
"dog": "Joe",
"cat": "Alfred",
"mouse": "Ricky"
}
}
Say, I'd like to hit the dog's name.
I see that there are several technologies to accomplish the task but they are bound to the content type. XML has XPath or Xpointer, JSON has JSONPath and so on.
The question is: if XML and JSON are two ways of representing structured information (which are almost equivalent), do you know some high level, implementation-independent notation which is not bound to a specific representation?
CONSTRAINTS:
Please consider that I can't go with the plain URL mechanism. I mean, I can't do something like http://authority/.../zoo/dog
.
Here the resource is the zoo
, I need to traverse its content (treating it as a content).
Just to clarify a little, something like http://authority/.../zoo#dog
would do the trick because it separates the resource name (what stands before the #
) from the content name (what stands after the #
) but I'm not sure whether if using it in this way can be considered standard or not. In addition, the # strategy requires that the resource is annotated with anchor points, which is not desirable for my case.
The question is: if XML and JSON are two ways of representing structured information (which are almost equivalent), do you know some high level, implementation-independent notation which is not bound to a specific representation?
Here are a few:
References
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With