This is a little macro which will unescape > and %lt; and convert them to the correct mode when editing XML in VS2010
1 Imports System
2 Imports EnvDTE
3 Imports EnvDTE80
4 Imports EnvDTE90
5 Imports System.Diagnostics
6
7 Public Module UnEscapeGTLT
8 Sub UnEscapeGTLT()
9
10 DTE.ExecuteCommand("Edit.Replace")
11
12 DTE.ActiveDocument.Activate()
13 DTE.ExecuteCommand("Edit.Replace")
14 DTE.Find.FindWhat = ">"
15 DTE.Find.ReplaceWith = ">"
16 DTE.Find.Target = vsFindTarget.vsFindTargetCurrentDocument
17 DTE.Find.MatchCase = False
18 DTE.Find.MatchWholeWord = False
19 DTE.Find.MatchInHiddenText = False
20 DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxLiteral
21 DTE.Find.ResultsLocation = vsFindResultsLocation.vsFindResultsNone
22 DTE.Find.Action = vsFindAction.vsFindActionReplaceAll
23 If (DTE.Find.Execute() = vsFindResult.vsFindResultNotFound) Then
24 Throw New System.Exception("vsFindResultNotFound")
25 End If
26 DTE.Windows.Item("{CF2DDC32-8CAD-11D2-9302-005345000000}").Activate() 'Find and Replace
27 DTE.Find.FindWhat = "<"
28 DTE.Find.ReplaceWith = "<"
29 DTE.ActiveDocument.Activate()
30 DTE.Find.Target = vsFindTarget.vsFindTargetCurrentDocument
31 DTE.Find.MatchCase = False
32 DTE.Find.MatchWholeWord = False
33 DTE.Find.MatchInHiddenText = False
34 DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxLiteral
35 DTE.Find.ResultsLocation = vsFindResultsLocation.vsFindResultsNone
36 DTE.Find.Action = vsFindAction.vsFindActionReplaceAll
37 If (DTE.Find.Execute() = vsFindResult.vsFindResultNotFound) Then
38 Throw New System.Exception("vsFindResultNotFound")
39 End If
40 DTE.Windows.Item("{CF2DDC32-8CAD-11D2-9302-005345000000}").Close()
41 DTE.ExecuteCommand("Edit.FormatDocument")
42 End Sub
43
44 End Module
45