Class SvgException
Thrown when an SVG file is not well-formed XML, breaks a safety limit, or, with Strict, has anything a lenient load would skip.
public sealed class SvgException : EgamiException, ISerializable
- Inheritance
-
SvgException
- Implements
- Inherited Members
Examples
// Strict turns everything a lenient load would skip into an exception with the line and column.
try
{
SvgDocument.Parse("<svg>\n <rect width='10' height='10'/>\n</svg>", new SvgLoadOptions { Strict = true });
}
catch (SvgException e)
{
Console.WriteLine($"Line {e.Line}, column {e.Column}: {e.Problem}");
}
Constructors
SvgException(int, int, string, Exception?)
Initializes a new instance of the SvgException class.
public SvgException(int line, int column, string problem, Exception? innerException = null)
Parameters
lineintThe 1-based line of the problem in the file, or 0 if unknown.
columnintThe 1-based column of the problem, or 0 if unknown.
problemstringWhat is wrong, as a sentence.
innerExceptionExceptionThe exception that caused this one, if any.
Properties
Column
Gets the 1-based column of the problem, or 0 if unknown.
public int Column { get; }
Property Value
Line
Gets the 1-based line of the problem in the file, or 0 if unknown.
public int Line { get; }
Property Value
Problem
Gets what is wrong, as a sentence.
public string Problem { get; }