Click here to Skip to main content
15,892,199 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have many xml files. I want bound them each by each.


Samples of my xml files like these

<Brands TopCategory="Categories" SubCategory="Models">
  <Brand Id="0" Name="Brand1" />
  <Brand Id="1" Name="Brand2" />
</Brands>
<Models TopCategory="Brands" SubCategory="Products, Features">
  <Model Id="0" Name="Model1" />
  <Model Id="1" Name="Model2" />
</Models>
<Products TopCategory="Models" SubCategory="-1">
  <Product Id="0" Name="Product1" />
  <Product Id="1" Name="Product2" />
</Products>
<Features TopCategory="Models" SubCategory="Features1, Features2">
  <Feature Id="0" Name="Feature1" />
  <Feature Id="1" Name="Feature2" />
</Features>
<Features1 TopCategory="Features" SubCategory="-1">
  <Feature Id="0" Name="Feature1" />
  <Feature Id="1" Name="Feature2" />
</Features>
<Features2 TopCategory="Features" SubCategory="-1">
  <Feature Id="0" Name="Feature1" />
  <Feature Id="1" Name="Feature2" />
</Features>


I want order like these

Index1 = {"Brands", "Models", "Products", "-1"}
Index2 = {"Brands", "Models", "Features", "Features1", "-1"}
Index3 = {"Brands", "Models", "Features", "Features2", "-1"}


If sub category have "-1" then must finish indexing

What I have tried:

How can i create index order? do you have any sugsesstion?
Thanks
Posted
Updated 21-Feb-17 2:14am
v4
Comments
Maciej Los 6-Mar-17 14:00pm    
Sorry, i don't get you...

1 solution

You could use Linq .OrderBy(x => x).ToArry() or Index.Sort() on the array.
 
Share this answer
 
Comments
Maciej Los 6-Mar-17 14:01pm    
???
Graeme_Grant 6-Mar-17 20:26pm    
well... need to bring them into classes or arrays... the question was vague...
Maciej Los 7-Mar-17 1:54am    
And the answer is not related to the OP question. OP wants to "bound" (whatever it means) xml files, but the method he wants to use is unknown.
Graeme_Grant 7-Mar-17 1:59am    
The tag was Linq... maybe it should have been XLinq instead. ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900