I need to sort xml documents sometimes by attributes, sometimes by elements, depending on what type of documents comes in. How can I use one sortBy method in c# to solove this problem? Many thanks for your help! For example my sorting key is "bookID"element or attribute, and the xml files are:
<bookstore>
<book>
<bookID>100</bookID>
<name> The cat in the hat <name>
</book>
<book>
<bookID>90</bookID>
<name> another book <name>
</book>
<book>
<bookID>103</bookID>
<name> a new book <name>
</book>
</bookstore>
or sometimes the xml comes in the below format:
<bookstore>
<book bookID="100">The cat in the hat</book>
<book bookID="90">another book</book>
<book bookID="103"> a new book</book>
</bookstore>