By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,870 Members | 2,347 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,870 IT Pros & Developers. It's quick & easy.

Determine order of different elements in a structure

!NoItAll
100+
P: 296
I have a structure
Expand|Select|Wrap|Line Numbers
  1. Structure Dogs
  2.    Dim Boxers as Dog()
  3.    Dim Pitbulls as Dog()
  4.    Dim Mutts as Dog()
  5. End Structure
  6.  
  7. Structure Dog
  8.    Dim Color as String
  9.    Dim Name as String
  10. End Structure
  11.  
I am deserializing this structure from an XML file

Expand|Select|Wrap|Line Numbers
  1. <Dogs>
  2.    <Pitbulls>
  3.        <Dog>
  4.            <Color>Brown</Color>
  5.            <Name>Charlie</Name>
  6.        </Dog>
  7.        <Dog>
  8.            <Color>Black</Color>
  9.            <Name>Hermione</Name>
  10.        </Dog>
  11.    </Pitbulls>
  12.    <Mutts>
  13.        <Dog>
  14.            <Color>Tan</Color>
  15.            <Name>Riley</Name>
  16.        </Dog>
  17.        <Dog>
  18.            <Color>Red</Color>
  19.            <Name>Sam</Name>
  20.        </Dog>
  21.    </Mutts>
  22.    <Boxers>
  23.        <Dog>
  24.            <Color>Tortoise</Color>
  25.            <Name>Sargent</Name>
  26.        </Dog>
  27.        <Dog>
  28.            <Color>White</Color>
  29.            <Name>Missy</Name>
  30.        </Dog>
  31.    </Boxers>
  32. </Dogs>
  33.  
Notice that the order of the structure and the order of the XML is different - that shouldn't matter. But... the order I present the data to the user is important. The data was entered in a specific order and needs to be presented in the same order.
So based on the XML I need to present the data as follows.


Pittbulls
Charlie/Brown
Hermione/Black
Mutts
Riley/Tan
Sam/Red
Boxers
Sargent/Tortoise
Missy/White


So the structure fills out just fine, but the order in the XML file is different each time and I need to honor that in my display of the data. Ok - my actual program is not about dogs, this is just for illustrative purposes.
Does anyone have a suggestion (or is this too obtuse)?

!NoItAll
Jan 20 '14 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.