.net - How do I sort elements by the attributes of the elements' children? -


for xelement like

<a>  <b><c id="2"></b>  <b><c id="3"></b>  <b><c id="1"></b> </a> 

is there way list of <b> ordered <c> id values?

i unsuccessfully tried

belements.orderby(function b xelement) b.elements.attributes("id")) , belements.orderby(function b xelement) b.elements.tostring).

depending on precise needs, this:

belements.orderby(function (b xelement) b.elements.attributes("id").first().value) 

or this:

belements.orderby(function (b xelement) b.elements.first().attribute("id").value) 

or this:

belements.orderby(function (b xelement) b.<c>.@id) 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

java.util.scanner - How to read and add only numbers to array from a text file -

iphone - Three second countdown in cocos2d -