Jim Kring Posted May 9, 2008 Report Share Posted May 9, 2008 Sometimes, you want to explicitly state the order of XML elements. XML doesn't natively support element ordering. So, if you have XML that looks like this, you can't deterministically say that the element with "foo" data comes before element with "bar" data. <element> <data>foo</data> </element> <element> <data>bar</data> </element> <element> <data>monkey</data> </element> <element> <data>fish</data> </element> You can get around this XML limitation by explicitly adding an order/index attribute to your ordered elements. For example: <element n="1"> <data>foo</data> </element> <element n="2"> <data>bar</data> </element> <element n="3"> <data>monkey</data> </element> <element n="4"> <data>fish</data> </element> In order to work with data like this, you'll need to pre-populate the "n" attribute before you generate the XML and you'll need to post-process the "n" attribute after you parse the XML. Here's an example, that demonstrates this technique: Example VI Element_Ordering.vi Front Panel Block Diagram Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.