Browse Source

expose IsValidXmlName-API in AXmlParser (useful for XAML rename)

pull/59/merge
Siegfried Pammer 12 years ago
parent
commit
ad54e9f956
  1. 10
      src/Libraries/NRefactory/ICSharpCode.NRefactory.Xml/AXmlParser.cs
  2. 2
      src/Libraries/NRefactory/ICSharpCode.NRefactory.Xml/TagReader.cs
  3. 5
      src/Main/Base/Project/Src/Gui/Pads/DefinitionViewPad.cs

10
src/Libraries/NRefactory/ICSharpCode.NRefactory.Xml/AXmlParser.cs

@ -133,5 +133,15 @@ namespace ICSharpCode.NRefactory.Xml
var heuristic = new TagMatchingHeuristics(newTextSource); var heuristic = new TagMatchingHeuristics(newTextSource);
return new AXmlDocument(null, 0, heuristic.CreateDocument(internalObjects, cancellationToken)); return new AXmlDocument(null, 0, heuristic.CreateDocument(internalObjects, cancellationToken));
} }
/// <summary>
/// Checks whether the given name is a valid XML name.
/// </summary>
public static bool IsValidXmlName(string name)
{
if (string.IsNullOrWhiteSpace(name))
throw new ArgumentException("The XML name cannot be null, empty or consist solely of white space", "name");
return TagReader.IsValidName(name);
}
} }
} }

2
src/Libraries/NRefactory/ICSharpCode.NRefactory.Xml/TagReader.cs

@ -822,7 +822,7 @@ namespace ICSharpCode.NRefactory.Xml
#endregion #endregion
#region Helper functions #region Helper functions
static bool IsValidName(string name) internal static bool IsValidName(string name)
{ {
try { try {
System.Xml.XmlConvert.VerifyName(name); System.Xml.XmlConvert.VerifyName(name);

5
src/Main/Base/Project/Src/Gui/Pads/DefinitionViewPad.cs

@ -123,9 +123,8 @@ namespace ICSharpCode.SharpDevelop.Gui
{ {
if (pos.Equals(oldPosition)) return; if (pos.Equals(oldPosition)) return;
oldPosition = pos; oldPosition = pos;
var fileName = new FileName(pos.FileName); if (pos.FileName != currentFileName)
if (fileName != currentFileName) LoadFile(new FileName(pos.FileName));
LoadFile(fileName);
ctl.TextArea.Caret.Location = pos.Begin; ctl.TextArea.Caret.Location = pos.Begin;
Rect r = ctl.TextArea.Caret.CalculateCaretRectangle(); Rect r = ctl.TextArea.Caret.CalculateCaretRectangle();
if (!r.IsEmpty) { if (!r.IsEmpty) {

Loading…
Cancel
Save