[Nml-wg] xml list examples

romradz at man.poznan.pl romradz at man.poznan.pl
Fri Dec 3 05:55:20 CST 2010



Hi,

during the OGF30 it was said that the namespace for attributes is not a 
good idea (may only complicate things). But maybe in the case of ordering 
items it is worth to consider that?

Let's assume we had a separate namespace for at least 2 attributes (type, 
item) to deal with collections like list, map and set.

Examples:

<x collection:type="list" 
xmlns:collection="http://ggf.org/ns/collections">
   <y collection:item="1">value</y>
   <y collection:item="2">value</y>
   <y collection:item="3">value</y>
</x>


<x collection:type="map" xmlns:collection="http://ggf.org/ns/collections">
   <y collection:item="nameX">value</y>
   <y collection:item="nameY">value</y>
   <y collection:item="nameZ">value</y>
</x>


<!-- 'set' collection is default so does not have to be included 
explicitly -->
<x collection:type="set" xmlns:collection="http://ggf.org/ns/collections">
   <y>value</y>
   <y>value</y>
   <y>value</y>
</x>


Collection namespace and its attributes would not be a part of NML, just a 
definition which could be used by NML and other standards (for example, 
NMC). Only when collection structures are needed. This way NML would not 
have to define ordering (format issue) but focus on topology elements and 
their relations.



regards,
Roman




On Thu, 2 Dec 2010, 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:
>
>      <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):
>
>     <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>
>
> Cheers,
> Aaron
> _______________________________________________
> nml-wg mailing list
> nml-wg at ogf.org
> http://www.ogf.org/mailman/listinfo/nml-wg
>


More information about the nml-wg mailing list