Code similar to the following would write some XML (in a console program):
static void Main(string args)
var document = new SvgDocument
Width = 50,
Height = 50
Radius = 20,
Fill = new SvgColourServer(Color.Red),
Stroke = new SvgColourServer(Color.Black),
StrokeWidth = 2
var xmlWriter = new XmlTextWriter(Console.Out);
However, it's NOT correct (sorry!):
<svg d1p1:width="50" d1p1:height="50" d1p1:viewBox="0, 0, 0, 0" xmlns:d1p1="http://www.w3.org/2000/svg">
<circle d1p1:cx="none" d1p1:cy="none" d1p1:r="20" d1p1:clip-rule="NonZero" d1p1:visibility="True" ... />
The most immediate problem is that a dodgy namespace is being used for the attributes (d1p1). I suspect this will be a relatively simple (but not necessarily easy) fix in
SvgElement.cs.WriteAttributes & other Write* methods. At first glance it appears that the problem is related to the SVG namespace not being written out correctly first. Overriding WriteAttributes in SvgDocument.cs or SvgFragment.cs and
writing the XMLNS first could be the correct fix for this.
The second problem is that all attributes are being written out regardless of whether they have been modified. This shouldn't break anything because the default values are all correct according to the SVG spec, but it will create very verbose files.
As to the TypeConverter at work - it's quite easy to spot the issue here in the clip-rule attribute. The valid value would be "non-zero" (I think) but the SvgClipRule enum has no TypeConverter so the enum value .ToString() method is used to get a string
value (NonZero is how it's represented in code). To fix this issue you'd just need to create a simple TypeConverter for SvgClipRule that overrides the CanConvertTo method to return true for types of string and then override the ConvertTo method to return the
correct values. You can see examples of how this is done in SvgUnitConverter.cs and SvgTransformConverter.cs (and see SvgUnit to see how the TypeConverter is registered at the top of the class).
I don't think there is much work left to do here, but it's obviously not in a working state.