开发者

Best way to sort XML attributes consistently throughout XML files in C#

开发者 https://www.devze.com 2023-02-05 21:51 出处:网络
I am trying to write a Xaml parser that would sort all the attributes of every tags in xaml files to keep the code organized and consistent.

I am trying to write a Xaml parser that would sort all the attributes of every tags in xaml files to keep the code organized and consistent.

I have fairly limited knowledge of C# and LINQ as I'm a front-end designer / developer, not a C# guru.

As far as I know, xaml is XML therefore, this would work with just any xml files. I will have parameters that will let the user order the attributes.

I tried using Regexp, it didn't go too well, I then tried using "XElement.Parse", no l开发者_JAVA百科uck. It seems to not like x:Name etc.

What would be the best way?


Please show your XAML.

I successfully parsed XAML with x:Key attribute and self:NullableBoolToStringConvreter node from this sample.


Try something like this, using the 4.0 .NET runtime:

http://www.codeproject.com/KB/dotnet/pitfalls_xml_4_0.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消