SVG Builder
JAXB Classes for SVG.
Usage
In Java code, the fluent API can be used to build SVG
ObjectFactory objectFactory = new ObjectFactory();
Svg svg = objectFactory.createSvg().withHeight("3").withWidth("7").
withSVGDescriptionClassOrSVGAnimationClassOrSVGStructureClass(
objectFactory.createCircle(
objectFactory.createCircle()
),
objectFactory.createA(
objectFactory.createSVGHyperlinkClass()
)
);
In Groovy code, the same can be done. Alternately a simpler DSL can be used.
@NewifySvg
void foo() {
def svg =
Svg(height: '3', width: '7').content {
it << Circle()
it << SVGHyperlinkClass()
}
}
Similarly, in Kotlin you could do this
val svg = Svg().withHeight("3").withWidth("7")
.content {
add(Circle())
add(SVGHyperlinkClass())
}
The resulting object is like any JAXB Root Element and can be marshaled from that point on.