I’m building a very rough implementation of some of the basic SVG elements. I’d like to serialize the object to a usable XML stream. Much of the details I’m OK with, but for some reason, I’m getting stuck on the basics of an type of object (“g) that can contain one or more of the same type of objects.
Here’s a stripped down example:
<svg>
<g display="inline">
<g display="inline">
<circle id="myCircle1"/>
<rectangle id="myRectangle1"/>
</g>
<circle id="myCircle2"/>
<rectangle id="myRectangle2"/>
</g>
</svg>
The first ‘g’ element contains other g elements. What’s the best way to design that object?
[XMLTypeOf("svg")]
public class SVG
{
public GraphicGroup g {set; get;}
}
public GraphicGroup
{
public GraphicGroup g {set; get;}
public Circle circle { set; get;}
public Rectangle rectangle { set; get;}
}
public Circle...
public Rectangle...
This isn’t quite right, or not even close. Any ideas?
use xsd and xsd to code generators