문제

I have an xml with some attributes and i want to rearrange those attributes. And i am having different elements with different attributes. I want all elements 'id' as my first attribute.

Here the small example,

<item name="product" dep="DE" id="I001">Item</item>

and i want to rearrange the attributes like

<item id="I001" name="product" dep="DE">Item</item>
도움이 되었습니까?

해결책

Dim x As XElement = <item name="product" dep="DE" id="I001">Item</item>

x.ReplaceAttributes(x.Attributes("id").Concat(x.Attributes().Where(Function(a) a.Name <> "id")))
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top