/// <summary>
/// Create <see cref="NewFolding"/>s for the specified document.
/// </summary>
public IEnumerable<NewFolding> CreateNewFoldings(TextDocument document, out int firstErrorOffset)
{
firstErrorOffset = 0;
if (document.TextLength < 1)
return Enumerable.Empty<NewFolding>();
try
{
if (document.IndexOf('<', 0, document.TextLength) < 0)
return Enumerable.Empty<NewFolding>();
var reader = new XmlTextReader(document.CreateReader());
reader.XmlResolver = null; // don't resolve DTDs
return CreateNewFoldings(document, reader, out firstErrorOffset);
}
catch (XmlException)
{
return Enumerable.Empty<NewFolding>();
}
}