Is there a way to diff two xaml files that differ in non functional white space i.e. new lines after attributes or the order of attributes?
I would like the following two xaml snippets to be recognized as the same
Snippet 1
<Button Name="myButton1" Click="myButton1_Clicked"/>
Snippet 2
<Button
Click="myButton1_Clicked"
Name="myButton1" />
But differences in element order should not be treated as being the same i.e.
<StackPanel>
<Button />
<TextBox />
</StackPanel>
should differ from
<StackPanel>
<TextBox />
<Button />
</StackPanel>
I looked into canonicalization for xml files with xmllint, but I could not get that to work with xaml files. Xmllint only returns an error when I call it on my xaml files with
xmllint -c14n myfile.xaml > myfile-canocicalized.xaml
In the ideal case I would like to be able to tell git about this, so that it generates meaningful diffs. I know that this can be achieved through setting diff.textconv in the .gitattribute
file to a program that canonicalizes xaml files.