
All; Lets try this again. Some comments inline. On 12/2/10 4:16 PM, Aaron Brown wrote:
On the call, I was asked to send some examples of how we've done ordered lists in XML before. Looking through various xml bits, I found a few different ways that we've sorted lists.
1) a numerical 'id' element:
<nmwg-cp:hop id=”0”> .... </nmwg-cp:hop> <nmwg-cp:hop id=”1”> .... </nmwg-cp:hop> <nmwg-cp:hop id=”2”> .... </nmwg-cp:hop> <nmwg-cp:hop id=”3”> .... </nmwg-cp:hop>
2) explicit 'next' pointers:
As Guilherme pointed out, there may need to be some way to denote the 'head' (e.g. a 'firstHop' attribute/element) or maybe a 'doubly' linked list to point forward and backward from each element. I am not sure this is a requirement, but it makes things 'easier' to interpret. If all elements were parsed in a different order we could build the correct order by examining all, its just not immediately clear which would be first without seeing all.
<path> <hop id="internet2-1"> .... <nextHop>esnet-1</nextHop> </hop> <hop id="esnet-1"> .... <nextHop>bnl-1</nextHop> </hop> <hop id="bnl-1"> .... </hop> </path>
3) implicit document ordering (this data corresponds to a traceroute. there would be more 'datum' elements in a real traceroute instance each of which corresponds to a single traceroute probe sent. This was cleaned up to make it easier to read):
N.B. Aaron was incorrect in his original synopsis here. Note that the 'ttl' field is being used to specify the order, so this example is similar to #1. It is a coincidence that the example is 'in order', and due to XML libraries having spotty support for ordering (e.g. 'document order') and the lack of a true ordering consideration in the XML spec itself, there needs to be an alternate way to unambiguously determine the order of elements.
<nmwg:data id="data.AAAFFF.0" metadataIdRef="meta.AAAFFF" xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"> <traceroute:datum hop="198.129.254.29" numBytes="64" queryNum="1" timeType="unix" timeValue="1282079154" ttl="1" value="0.135" valueUnits="ms"/> <traceroute:datum hop="134.55.219.10" numBytes="64" queryNum="1" timeType="unix" timeValue="1282079154" ttl="2" value="1.14" valueUnits="ms"/> <traceroute:datum hop="134.55.217.2" numBytes="64" queryNum="1" timeType="unix" timeValue="1282079154" ttl="3" value="37.212" valueUnits="ms"/> <traceroute:datum hop="134.55.209.98" numBytes="64" queryNum="1" timeType="unix" timeValue="1282079154" ttl="4" value="1.616" valueUnits="ms"/> <traceroute:datum hop="134.55.220.49" numBytes="64" queryNum="1" timeType="unix" timeValue="1282079154" ttl="5" value="28.643" valueUnits="ms"/> <traceroute:datum hop="134.55.209.46" numBytes="64" queryNum="1" timeType="unix" timeValue="1282079154" ttl="6" value="41.773" valueUnits="ms"/> <traceroute:datum hop="134.55.221.58" numBytes="64" queryNum="1" timeType="unix" timeValue="1282079154" ttl="7" value="52.36" valueUnits="ms"/> <traceroute:datum hop="134.55.218.101" numBytes="64" queryNum="1" timeType="unix" timeValue="1282079154" ttl="8" value="52.373" valueUnits="ms"/> <traceroute:datum hop="198.124.252.141" numBytes="64" queryNum="1" timeType="unix" timeValue="1282079154" ttl="9" value="52.311" valueUnits="ms"/> </nmwg:data>
Thanks; -jason